More simplification of the shared.h file

This commit is contained in:
SergioMartin86 2024-03-29 18:43:20 +01:00
parent fae1cab0a2
commit 9df952f9a2
44 changed files with 200 additions and 158 deletions

View File

@ -40,6 +40,7 @@
#include <fileio.h>
#include "shared.h"
#include "m68k.h"
#include "genesis.h"
#define TYPE_PRO1 0x12
#define TYPE_PRO2 0x22

View File

@ -39,6 +39,7 @@
#include "shared.h"
#include "../input_hw/gamepad.h"
#include "../loadrom.h"
#include "../genesis.h"
#include "m68k.h"
/* Some notes from 8BitWizard (http://gendev.spritesmind.net/forum/viewtopic.php?t=206):
@ -158,7 +159,7 @@ static const T_I2C_GAME i2c_database[] =
{"XXXXXXXX" , 0 , 0xDF39 , mapper_i2c_jcart_init , NO_EEPROM }, /* Pete Sampras Tennis 96 (Prototype ?) */
};
static struct
struct
{
uint8 sda; /* current SDA line state */
uint8 scl; /* current SCL line state */

View File

@ -41,6 +41,7 @@
#include <osd.h>
#include <fileio.h>
#include "../genesis.h"
#include "shared.h"
#include "m68k.h"

View File

@ -46,6 +46,7 @@
#include <config.h>
#include "../system.h"
#include "../loadrom.h"
#include "../genesis.h"
#include "shared.h"
#include "eeprom_i2c.h"
#include "eeprom_spi.h"

View File

@ -37,6 +37,7 @@
****************************************************************************************/
#include "shared.h"
#include "../system.h"
#include "../genesis.h"
#include "m68k.h"
typedef struct

View File

@ -44,6 +44,7 @@
#include "../system.h"
#include "../loadrom.h"
#include "../z80/z80.h"
#include "../genesis.h"
#include "shared.h"
#include "eeprom_93c.h"
#include "terebi_oekaki.h"

View File

@ -38,6 +38,8 @@
#include <zlib.h>
#include "../loadrom.h"
#include "../macros.h"
#include "../genesis.h"
#include "shared.h"
T_SRAM sram;

View File

@ -190,6 +190,7 @@
*/
#include "shared.h"
#include "../../genesis.h"
#define u32 unsigned int

View File

@ -11,6 +11,7 @@
*/
#include "shared.h"
#include "../../genesis.h"
#include "m68k.h"
svp_t *svp;

View File

@ -37,6 +37,7 @@
****************************************************************************************/
#include "shared.h"
#include "../genesis.h"
#include "m68k.h"
/*--------------------------------------------------------------------------*/

View File

@ -37,6 +37,7 @@
****************************************************************************************/
#include "shared.h"
#include "../genesis.h"
#include "m68k.h"
/* IFSTAT register bitmasks */

View File

@ -39,11 +39,14 @@
#include <config.h>
#include <stdlib.h>
#include "../system.h"
#include "../genesis.h"
#include "shared.h"
#include "megasd.h"
#include "m68k.h"
#if defined(USE_LIBTREMOR) || defined(USE_LIBVORBIS)
#include "../tremor/ogg.h"
#include "../tremor/ivorbisfile.h"
#define SUPPORTED_EXT 20
#else
#define SUPPORTED_EXT 10

View File

@ -37,6 +37,7 @@
****************************************************************************************/
#include "shared.h"
#include "../genesis.h"
#include "m68k.h"
/***************************************************************/

View File

@ -38,6 +38,7 @@
#include <config.h>
#include "../system.h"
#include "../genesis.h"
#include "shared.h"
#define PCM_SCYCLES_RATIO (384 * 4)

View File

@ -38,12 +38,13 @@
#include "shared.h"
#include "../system.h"
#include "../genesis.h"
#include "m68k.h"
/*--------------------------------------------------------------------------*/
/* Unused area (return open bus data, i.e prefetched instruction word) */
/*--------------------------------------------------------------------------*/
static unsigned int s68k_read_bus_8(unsigned int address)
unsigned int s68k_read_bus_8(unsigned int address)
{
#ifdef LOGERROR
error("[SUB 68k] Unused read8 %08X (%08X)\n", address, s68k.pc);
@ -52,7 +53,7 @@ static unsigned int s68k_read_bus_8(unsigned int address)
return READ_BYTE(s68k.memory_map[((address)>>16)&0xff].base, (address) & 0xffff);
}
static unsigned int s68k_read_bus_16(unsigned int address)
unsigned int s68k_read_bus_16(unsigned int address)
{
#ifdef LOGERROR
error("[SUB 68k] Unused read16 %08X (%08X)\n", address, s68k.pc);
@ -61,14 +62,14 @@ static unsigned int s68k_read_bus_16(unsigned int address)
return *(uint16 *)(s68k.memory_map[((address)>>16)&0xff].base + ((address) & 0xffff));
}
static void s68k_unused_8_w(unsigned int address, unsigned int data)
void s68k_unused_8_w(unsigned int address, unsigned int data)
{
#ifdef LOGERROR
error("[SUB 68k] Unused write8 %08X = %02X (%08X)\n", address, data, s68k.pc);
#endif
}
static void s68k_unused_16_w(unsigned int address, unsigned int data)
void s68k_unused_16_w(unsigned int address, unsigned int data)
{
#ifdef LOGERROR
error("[SUB 68k] Unused write16 %08X = %04X (%08X)\n", address, data, s68k.pc);
@ -79,7 +80,7 @@ static void s68k_unused_16_w(unsigned int address, unsigned int data)
/* Locked area (cause SUB-CPU to wait for /DTACK assertion) */
/*--------------------------------------------------------------------------*/
static void s68k_lockup_w_8 (unsigned int address, unsigned int data)
void s68k_lockup_w_8 (unsigned int address, unsigned int data)
{
#ifdef LOGERROR
error ("[SUB 68k] Lockup write8 %08X = %02X (%08X)\n", address, data, s68k.pc);
@ -87,7 +88,7 @@ static void s68k_lockup_w_8 (unsigned int address, unsigned int data)
s68k_pulse_wait(address, 1);
}
static void s68k_lockup_w_16 (unsigned int address, unsigned int data)
void s68k_lockup_w_16 (unsigned int address, unsigned int data)
{
#ifdef LOGERROR
error ("[SUB 68k] Lockup write16 %08X = %04X (%08X)\n", address, data, s68k.pc);
@ -95,7 +96,7 @@ static void s68k_lockup_w_16 (unsigned int address, unsigned int data)
s68k_pulse_wait(address, 1);
}
static unsigned int s68k_lockup_r_8 (unsigned int address)
unsigned int s68k_lockup_r_8 (unsigned int address)
{
#ifdef LOGERROR
error ("[SUB 68k] Lockup read8 %08X.b (%08X)\n", address, s68k.pc);
@ -104,7 +105,7 @@ static unsigned int s68k_lockup_r_8 (unsigned int address)
return 0xff;
}
static unsigned int s68k_lockup_r_16 (unsigned int address)
unsigned int s68k_lockup_r_16 (unsigned int address)
{
#ifdef LOGERROR
error ("[SUB 68k] Lockup read16 %08X.w (%08X)\n", address, s68k.pc);
@ -155,7 +156,7 @@ void prg_ram_dma_w(unsigned int length)
/*--------------------------------------------------------------------------*/
/* PRG-RAM write protected area */
/*--------------------------------------------------------------------------*/
static void prg_ram_write_byte(unsigned int address, unsigned int data)
void prg_ram_write_byte(unsigned int address, unsigned int data)
{
address &= 0x7ffff;
if (address >= (scd.regs[0x02>>1].byte.h << 9))
@ -168,7 +169,7 @@ static void prg_ram_write_byte(unsigned int address, unsigned int data)
#endif
}
static void prg_ram_write_word(unsigned int address, unsigned int data)
void prg_ram_write_word(unsigned int address, unsigned int data)
{
address &= 0x7fffe;
if (address >= (scd.regs[0x02>>1].byte.h << 9))
@ -184,7 +185,7 @@ static void prg_ram_write_word(unsigned int address, unsigned int data)
/*--------------------------------------------------------------------------*/
/* PRG-RAM bank mirrored access */
/*--------------------------------------------------------------------------*/
static unsigned int prg_ram_z80_read_byte(unsigned int address)
unsigned int prg_ram_z80_read_byte(unsigned int address)
{
int offset = (address >> 16) & 0x03;
@ -196,7 +197,7 @@ static unsigned int prg_ram_z80_read_byte(unsigned int address)
return READ_BYTE(m68k.memory_map[offset].base, address & 0xffff);
}
static void prg_ram_z80_write_byte(unsigned int address, unsigned int data)
void prg_ram_z80_write_byte(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x03;
@ -210,7 +211,7 @@ static void prg_ram_z80_write_byte(unsigned int address, unsigned int data)
}
}
static unsigned int prg_ram_m68k_read_byte(unsigned int address)
unsigned int prg_ram_m68k_read_byte(unsigned int address)
{
int offset = (address >> 16) & 0x03;
@ -222,7 +223,7 @@ static unsigned int prg_ram_m68k_read_byte(unsigned int address)
return READ_BYTE(m68k.memory_map[offset].base, address & 0xffff);
}
static unsigned int prg_ram_m68k_read_word(unsigned int address)
unsigned int prg_ram_m68k_read_word(unsigned int address)
{
int offset = (address >> 16) & 0x03;
@ -234,7 +235,7 @@ static unsigned int prg_ram_m68k_read_word(unsigned int address)
return *(uint16 *)(m68k.memory_map[offset].base + (address & 0xffff));
}
static void prg_ram_m68k_write_byte(unsigned int address, unsigned int data)
void prg_ram_m68k_write_byte(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x03;
@ -248,7 +249,7 @@ static void prg_ram_m68k_write_byte(unsigned int address, unsigned int data)
}
}
static void prg_ram_m68k_write_word(unsigned int address, unsigned int data)
void prg_ram_m68k_write_word(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x03;
@ -265,7 +266,7 @@ static void prg_ram_m68k_write_word(unsigned int address, unsigned int data)
/*--------------------------------------------------------------------------*/
/* Word-RAM bank mirrored access */
/*--------------------------------------------------------------------------*/
static unsigned int word_ram_z80_read_byte(unsigned int address)
unsigned int word_ram_z80_read_byte(unsigned int address)
{
int offset = (address >> 16) & 0x23;
@ -277,7 +278,7 @@ static unsigned int word_ram_z80_read_byte(unsigned int address)
return READ_BYTE(m68k.memory_map[offset].base, address & 0xffff);
}
static void word_ram_z80_write_byte(unsigned int address, unsigned int data)
void word_ram_z80_write_byte(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x23;
@ -291,7 +292,7 @@ static void word_ram_z80_write_byte(unsigned int address, unsigned int data)
}
}
static unsigned int word_ram_m68k_read_byte(unsigned int address)
unsigned int word_ram_m68k_read_byte(unsigned int address)
{
int offset = (address >> 16) & 0x23;
@ -303,7 +304,7 @@ static unsigned int word_ram_m68k_read_byte(unsigned int address)
return READ_BYTE(m68k.memory_map[offset].base, address & 0xffff);
}
static unsigned int word_ram_m68k_read_word(unsigned int address)
unsigned int word_ram_m68k_read_word(unsigned int address)
{
int offset = (address >> 16) & 0x23;
@ -315,7 +316,7 @@ static unsigned int word_ram_m68k_read_word(unsigned int address)
return *(uint16 *)(m68k.memory_map[offset].base + (address & 0xffff));
}
static void word_ram_m68k_write_byte(unsigned int address, unsigned int data)
void word_ram_m68k_write_byte(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x23;
@ -329,7 +330,7 @@ static void word_ram_m68k_write_byte(unsigned int address, unsigned int data)
}
}
static void word_ram_m68k_write_word(unsigned int address, unsigned int data)
void word_ram_m68k_write_word(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x23;
@ -343,7 +344,7 @@ static void word_ram_m68k_write_word(unsigned int address, unsigned int data)
}
}
static unsigned int word_ram_s68k_read_byte(unsigned int address)
unsigned int word_ram_s68k_read_byte(unsigned int address)
{
int offset = (address >> 16) & 0x0f;
@ -355,7 +356,7 @@ static unsigned int word_ram_s68k_read_byte(unsigned int address)
return READ_BYTE(s68k.memory_map[offset].base, address & 0xffff);
}
static unsigned int word_ram_s68k_read_word(unsigned int address)
unsigned int word_ram_s68k_read_word(unsigned int address)
{
int offset = (address >> 16) & 0x0f;
@ -367,7 +368,7 @@ static unsigned int word_ram_s68k_read_word(unsigned int address)
return *(uint16 *)(s68k.memory_map[offset].base + (address & 0xffff));
}
static void word_ram_s68k_write_byte(unsigned int address, unsigned int data)
void word_ram_s68k_write_byte(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x0f;
@ -381,7 +382,7 @@ static void word_ram_s68k_write_byte(unsigned int address, unsigned int data)
}
}
static void word_ram_s68k_write_word(unsigned int address, unsigned int data)
void word_ram_s68k_write_word(unsigned int address, unsigned int data)
{
int offset = (address >> 16) & 0x0f;
@ -398,7 +399,7 @@ static void word_ram_s68k_write_word(unsigned int address, unsigned int data)
/*--------------------------------------------------------------------------*/
/* internal backup RAM (8KB) */
/*--------------------------------------------------------------------------*/
static unsigned int bram_read_byte(unsigned int address)
unsigned int bram_read_byte(unsigned int address)
{
/* LSB only */
if (address & 0x01)
@ -409,12 +410,12 @@ static unsigned int bram_read_byte(unsigned int address)
return 0xff;
}
static unsigned int bram_read_word(unsigned int address)
unsigned int bram_read_word(unsigned int address)
{
return (scd.bram[(address >> 1) & 0x1fff] | 0xff00);
}
static void bram_write_byte(unsigned int address, unsigned int data)
void bram_write_byte(unsigned int address, unsigned int data)
{
/* LSB only */
if (address & 0x01)
@ -423,7 +424,7 @@ static void bram_write_byte(unsigned int address, unsigned int data)
}
}
static void bram_write_word(unsigned int address, unsigned int data)
void bram_write_word(unsigned int address, unsigned int data)
{
scd.bram[(address >> 1) & 0x1fff] = data & 0xff;
}
@ -432,7 +433,7 @@ static void bram_write_word(unsigned int address, unsigned int data)
/* SUB-CPU polling detection and MAIN-CPU synchronization */
/*--------------------------------------------------------------------------*/
static void s68k_poll_detect(unsigned int reg_mask)
void s68k_poll_detect(unsigned int reg_mask)
{
/* detect SUB-CPU register polling */
if (s68k.poll.detected & reg_mask)
@ -472,7 +473,7 @@ static void s68k_poll_detect(unsigned int reg_mask)
s68k.poll.pc = s68k.pc;
}
static void s68k_poll_sync(unsigned int reg_mask)
void s68k_poll_sync(unsigned int reg_mask)
{
/* relative MAIN-CPU cycle counter */
unsigned int cycles = (s68k.cycles * MCYCLES_PER_LINE) / SCYCLES_PER_LINE;
@ -507,7 +508,7 @@ static void s68k_poll_sync(unsigned int reg_mask)
m68k.poll.detected &= ~reg_mask;
}
static void m68k_sync(void)
void m68k_sync(void)
{
if (!m68k.stopped)
{
@ -529,7 +530,7 @@ static void m68k_sync(void)
/* PCM chip & Gate-Array area */
/*--------------------------------------------------------------------------*/
static unsigned int scd_read_byte(unsigned int address)
unsigned int scd_read_byte(unsigned int address)
{
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
if (!(address & 0x8000))
@ -648,7 +649,7 @@ static unsigned int scd_read_byte(unsigned int address)
return scd.regs[address >> 1].byte.h;
}
static unsigned int scd_read_word(unsigned int address)
unsigned int scd_read_word(unsigned int address)
{
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
if (!(address & 0x8000))
@ -804,9 +805,9 @@ INLINE void word_ram_switch(uint8 mode)
}
}
static void scd_write_word(unsigned int address, unsigned int data);
void scd_write_word(unsigned int address, unsigned int data);
static void scd_write_byte(unsigned int address, unsigned int data)
void scd_write_byte(unsigned int address, unsigned int data)
{
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
if (!(address & 0x8000))
@ -1166,7 +1167,7 @@ static void scd_write_byte(unsigned int address, unsigned int data)
}
}
static void scd_write_word(unsigned int address, unsigned int data)
void scd_write_word(unsigned int address, unsigned int data)
{
/* PCM area (8K) mirrored into $xF0000-$xF7FFF */
if (!(address & 0x8000))

View File

@ -46,6 +46,7 @@
#include "m68k.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
#ifdef USE_DYNAMIC_ALLOC
external_t *ext;

View File

@ -37,8 +37,9 @@
****************************************************************************************/
#include "shared.h"
#include "../macros.h"
static struct
struct
{
uint8_t State;
uint8_t Counter;

View File

@ -43,7 +43,7 @@
#include "m68k.h"
#include "z80.h"
static struct
struct
{
uint8 State;
uint8 Counter;

View File

@ -40,6 +40,7 @@
#include <config.h>
#include "../loadrom.h"
#include "../system.h"
#include "../genesis.h"
#include "shared.h"
#include "gamepad.h"
#include "lightgun.h"

View File

@ -38,6 +38,7 @@
#include <stdlib.h>
#include "../system.h"
#include "../genesis.h"
#include "shared.h"
#include "m68k.h"
#include "z80.h"
@ -87,7 +88,7 @@ static const uint8 hc_320[210] =
0xFE, 0xFF
};
static struct
struct
{
uint8 State;
uint8 Port;

View File

@ -37,8 +37,9 @@
****************************************************************************************/
#include "shared.h"
#include "../macros.h"
static struct
struct
{
uint8_t State;
uint8_t Counter;

View File

@ -37,8 +37,9 @@
****************************************************************************************/
#include "shared.h"
#include "../macros.h"
static struct
struct
{
uint8_t State;
uint8_t Counter;

View File

@ -37,8 +37,9 @@
****************************************************************************************/
#include "shared.h"
#include "../macros.h"
static struct
struct
{
uint8_t State;
uint8_t Counter;

View File

@ -37,10 +37,11 @@
****************************************************************************************/
#include "shared.h"
#include "../macros.h"
#define XE_1AP_LATENCY 3
static struct
struct
{
uint8_t State;
uint8_t Counter;

View File

@ -52,6 +52,7 @@
#include "graphic_board.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
uint8_t io_reg[0x10];

View File

@ -43,6 +43,7 @@
#include "shared.h"
#include "loadrom.h"
#include "system.h"
#include "genesis.h"
/*** ROM Information ***/
#define ROMCONSOLE 256

View File

@ -24,7 +24,7 @@ extern int vdp_68k_irq_ack(int int_level);
/* ======================================================================== */
#ifdef BUILD_TABLES
static unsigned char m68ki_cycles[0x10000];
unsigned char m68ki_cycles[0x10000];
#endif
static int irq_latency;

View File

@ -1377,7 +1377,7 @@ INLINE void m68ki_exception_address_error(void)
/* See MC68000 User Manual appendix B for autovectors interrupts processing time */
/* 44 cycles + N wait-state cycles where N depends on CPU clock alignement with internal E clock (corresponding to CPU clock / 10) when interrupt ack cycle starts */
/* N minimal/maximal values are 6..15 cycles according to manual but real hardware measure apparently indicate 5..14 cycles (cf https://gendev.spritesmind.net/forum/viewtopic.php?f=2&t=2202&p=27485) */
static uint m68ki_cycle_interrupts[10] = {50*MUL, 59*MUL, 58*MUL, 57*MUL, 56*MUL, 55*MUL, 54*MUL, 53*MUL, 52*MUL, 51*MUL};
static const uint m68ki_cycle_interrupts[10] = {50*MUL, 59*MUL, 58*MUL, 57*MUL, 56*MUL, 55*MUL, 54*MUL, 53*MUL, 52*MUL, 51*MUL};
/* Service an interrupt request and start exception processing */
INLINE void m68ki_exception_interrupt(uint int_level)

View File

@ -1,5 +1,6 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#pragma once
#include <stdio.h>
#ifdef LSB_FIRST
@ -67,4 +68,3 @@
#define cdStreamGets fgets
#endif
#endif /* _MACROS_H_ */

View File

@ -41,6 +41,7 @@
#include "shared.h"
#include "m68k.h"
#include "system.h"
#include "genesis.h"
/*--------------------------------------------------------------------------*/
/* Unused areas (return open bus data, i.e prefetched instruction word) */

View File

@ -39,6 +39,7 @@
#include <config.h>
#include "shared.h"
#include "genesis.h"
#include "z80.h"
t_zbank_memory_map zbank_memory_map[256];

View File

@ -44,6 +44,7 @@
#include "m68k.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
/*--------------------------------------------------------------------------*/
/* Handlers for access to unused addresses and those which make the */

View File

@ -1,7 +1,6 @@
#ifndef _SHARED_H_
#define _SHARED_H_
#include "genesis.h"
#include "vdp_ctrl.h"
#include "vdp_render.h"
#include "mem68k.h"

View File

@ -39,6 +39,8 @@
#include <config.h>
#include "../system.h"
#include "../genesis.h"
#include "../macros.h"
#include "shared.h"
#include "blip_buf.h"
@ -47,39 +49,39 @@
/* FM output buffer (large enough to hold a whole frame at original chips rate) */
#if defined(HAVE_YM3438_CORE) || defined(HAVE_OPLL_CORE)
static int fm_buffer[1080 * 2 * 24];
int fm_buffer[1080 * 2 * 24];
#else
static int fm_buffer[1080 * 2];
int fm_buffer[1080 * 2];
#endif
static int fm_last[2];
static int *fm_ptr;
int fm_last[2];
int *fm_ptr;
/* Cycle-accurate FM samples */
static int fm_cycles_ratio;
static int fm_cycles_start;
static int fm_cycles_count;
static int fm_cycles_busy;
int fm_cycles_ratio;
int fm_cycles_start;
int fm_cycles_count;
int fm_cycles_busy;
/* YM chip function pointers */
static void (*YM_Update)(int *buffer, int length);
void (*YM_Update)(int *buffer, int length);
void (*fm_reset)(unsigned int cycles);
void (*fm_write)(unsigned int cycles, unsigned int address, unsigned int data);
unsigned int (*fm_read)(unsigned int cycles, unsigned int address);
#ifdef HAVE_YM3438_CORE
static ym3438_t ym3438;
static short ym3438_accm[24][2];
static int ym3438_sample[2];
static int ym3438_cycles;
ym3438_t ym3438;
short ym3438_accm[24][2];
int ym3438_sample[2];
int ym3438_cycles;
#endif
#ifdef HAVE_OPLL_CORE
static opll_t opll;
static int opll_accm[18][2];
static int opll_sample;
static int opll_cycles;
static int opll_status;
opll_t opll;
int opll_accm[18][2];
int opll_sample;
int opll_cycles;
int opll_status;
#endif
/* Run FM chip until required M-cycles */

View File

@ -43,7 +43,8 @@ to do:
/************************************************/
#include "shared.h"
#include "math.h"
#include <math.h>
#include "../macros.h"
#define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */
#define EG_SH 16 /* 16.16 fixed point (EG timing) */
@ -180,7 +181,7 @@ typedef struct {
/* table is 3dB/octave, DV converts this into 6dB/octave */
/* 0.1875 is bit 0 weight of the envelope counter (volume) expressed in the 'decibel' scale */
#define DV (0.1875/1.0)
static const uint32_t ksl_tab[8*16]=
const uint32_t ksl_tab[8*16]=
{
/* OCT 0 */
0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV,
@ -228,7 +229,7 @@ static const uint32_t ksl_tab[8*16]=
/* sustain level table (3dB per step) */
/* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,45 (dB)*/
#define SC(db) (uint32_t) ( db * (1.0/ENV_STEP) )
static const uint32_t sl_tab[16]={
const uint32_t sl_tab[16]={
SC( 0),SC( 1),SC( 2),SC(3 ),SC(4 ),SC(5 ),SC(6 ),SC( 7),
SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(15)
};
@ -262,7 +263,7 @@ static const unsigned char eg_inc[14*RATE_STEPS]={
};
static const unsigned char eg_mul[17*RATE_STEPS]={
const unsigned char eg_mul[17*RATE_STEPS]={
/*cycle:0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15*/
@ -383,7 +384,7 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),
/* multiple table */
#define ML 2
static const uint8_t mul_tab[16]= {
const uint8_t mul_tab[16]= {
/* 1/2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,10,12,12,15,15 */
0.50*ML, 1.00*ML, 2.00*ML, 3.00*ML, 4.00*ML, 5.00*ML, 6.00*ML, 7.00*ML,
8.00*ML, 9.00*ML,10.00*ML,10.00*ML,12.00*ML,12.00*ML,15.00*ML,15.00*ML
@ -396,13 +397,13 @@ static const uint8_t mul_tab[16]= {
* TL_RES_LEN - sinus resolution (X axis)
*/
#define TL_TAB_LEN (11*2*TL_RES_LEN)
static signed int tl_tab[TL_TAB_LEN];
signed int ym2413_tl_tab[TL_TAB_LEN];
#define ENV_QUIET (TL_TAB_LEN>>5)
/* sin waveform table in 'decibel' scale */
/* two waveforms on OPLL type chips */
static unsigned int sin_tab[SIN_LEN * 2];
unsigned int ym2413_sin_tab[SIN_LEN * 2];
/* LFO Amplitude Modulation table (verified on real YM3812)
@ -420,7 +421,7 @@ We use data>>1, until we find what it really is on real chip...
#define LFO_AM_TAB_ELEMENTS 210
static const uint8_t lfo_am_table[LFO_AM_TAB_ELEMENTS] = {
const uint8_t lfo_am_table[LFO_AM_TAB_ELEMENTS] = {
0,0,0,0,0,0,0,
1,1,1,1,
2,2,2,2,
@ -512,7 +513,7 @@ static const int8_t lfo_pm_table[8*8] = {
*/
/* 2021/04/23: corrected with values extracted from YM2413 instrument ROM, cf. https://siliconpr0n.org/archive/doku.php?id=vendor:yamaha:opl2#ym2413_instrument_rom */
static unsigned char table[19][8] = {
unsigned char table[19][8] = {
/* MULT MULT modTL DcDmFb AR/DR AR/DR SL/RR SL/RR */
/* 0 1 2 3 4 5 6 7 */
/*{0x49, 0x4c, 0x4c, 0x12, 0x00, 0x00, 0x00, 0x00 }, */ /* 0 */
@ -577,13 +578,13 @@ static unsigned char table[19][8] = {
{0x05, 0x01, 0x00, 0x00, 0xf8, 0xaa, 0x59, 0x55 } /* TOM, TOP CYM */
};
static signed int output[2];
signed int output[2];
static uint32_t LFO_AM;
static int32_t LFO_PM;
uint32_t LFO_AM;
int32_t LFO_PM;
/* emulated chip */
static YM2413 ym2413;
YM2413 ym2413;
/* advance LFO to next sample */
INLINE void advance_lfo(void)
@ -841,20 +842,20 @@ INLINE void advance(void)
INLINE signed int op_calc(uint32_t phase, unsigned int env, signed int pm, unsigned int wave_tab)
{
uint32_t p = (env<<5) + sin_tab[wave_tab + ((((signed int)((phase & ~FREQ_MASK) + (pm<<17))) >> FREQ_SH ) & SIN_MASK) ];
uint32_t p = (env<<5) + ym2413_sin_tab[wave_tab + ((((signed int)((phase & ~FREQ_MASK) + (pm<<17))) >> FREQ_SH ) & SIN_MASK) ];
if (p >= TL_TAB_LEN)
return 0;
return tl_tab[p];
return ym2413_tl_tab[p];
}
INLINE signed int op_calc1(uint32_t phase, unsigned int env, signed int pm, unsigned int wave_tab)
{
uint32_t p = (env<<5) + sin_tab[wave_tab + ((((signed int)((phase & ~FREQ_MASK) + pm)) >> FREQ_SH ) & SIN_MASK) ];
uint32_t p = (env<<5) + ym2413_sin_tab[wave_tab + ((((signed int)((phase & ~FREQ_MASK) + pm)) >> FREQ_SH ) & SIN_MASK) ];
if (p >= TL_TAB_LEN)
return 0;
return tl_tab[p];
return ym2413_tl_tab[p];
}
#define volume_calc(OP) (((OP)-> state != EG_OFF) ? (OP)->TLL + ((uint32_t)(OP)->volume) + (LFO_AM & (OP)->AMmask) : ENV_QUIET)
@ -1096,7 +1097,7 @@ INLINE void rhythm_calc( YM2413_OPLL_CH *CH, unsigned int noise )
/* generic table initialize */
static int init_tables(void)
int init_tables(void)
{
signed int i,x;
signed int n;
@ -1117,13 +1118,13 @@ static int init_tables(void)
else
n = n>>1;
/* 11 bits here (rounded) */
tl_tab[ x*2 + 0 ] = n;
tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ];
ym2413_tl_tab[ x*2 + 0 ] = n;
ym2413_tl_tab[ x*2 + 1 ] = -ym2413_tl_tab[ x*2 + 0 ];
for (i=1; i<11; i++)
{
tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i;
tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
ym2413_tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = ym2413_tl_tab[ x*2+0 ]>>i;
ym2413_tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -ym2413_tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
}
}
@ -1148,22 +1149,22 @@ static int init_tables(void)
n = n>>1;
/* waveform 0: standard sinus */
sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
ym2413_sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
/* waveform 1: __ __ */
/* / \____/ \____*/
/* output only first half of the sinus waveform (positive one) */
if (i & (1<<(SIN_BITS-1)) )
sin_tab[1*SIN_LEN+i] = TL_TAB_LEN;
ym2413_sin_tab[1*SIN_LEN+i] = TL_TAB_LEN;
else
sin_tab[1*SIN_LEN+i] = sin_tab[i];
ym2413_sin_tab[1*SIN_LEN+i] = ym2413_sin_tab[i];
}
return 1;
}
static void OPLL_initalize(void)
void OPLL_initalize(void)
{
int i;
@ -1363,7 +1364,7 @@ INLINE void set_sl_rr(int slot,int v)
SLOT->eg_sel_rr = eg_rate_select[SLOT->rr + SLOT->ksr ];
}
static void load_instrument(uint32_t chan, uint32_t slot, uint8_t* inst )
void load_instrument(uint32_t chan, uint32_t slot, uint8_t* inst )
{
set_mul(slot, inst[0]);
set_mul(slot+1, inst[1]);
@ -1375,7 +1376,7 @@ static void load_instrument(uint32_t chan, uint32_t slot, uint8_t* inst )
set_sl_rr(slot+1, inst[7]);
}
static void update_instrument_zero(uint8_t r)
void update_instrument_zero(uint8_t r)
{
uint8_t* inst = &ym2413.inst_tab[0][0]; /* point to user instrument */
uint32_t chan;
@ -1469,7 +1470,7 @@ static void update_instrument_zero(uint8_t r)
}
/* write a value v to register r on chip chip */
static void OPLLWriteReg(int r, int v)
void OPLLWriteReg(int r, int v)
{
YM2413_OPLL_CH *CH;
YM2413_OPLL_SLOT *SLOT;

View File

@ -106,7 +106,7 @@
** - added SSG-EG support (verified on real YM2203)
**
** 12-08-2001 Jarek Burczynski:
** - corrected sin_tab and tl_tab data (verified on real chip)
** - corrected ym2612_sin_tab and ym2612_tl_tab data (verified on real chip)
** - corrected feedback calculations (verified on real chip)
** - corrected phase generator calculations (verified on real chip)
** - corrected envelope generator calculations (verified on real chip)
@ -148,7 +148,9 @@
/************************************************************************/
#include "shared.h"
#include "math.h"
#include <math.h>
#include "../macros.h"
#include "../genesis.h"
/* envelope generator */
#define ENV_BITS 10
@ -184,12 +186,12 @@
* TL_RES_LEN - sinus resolution (X axis)
*/
#define TL_TAB_LEN (13*2*TL_RES_LEN)
static signed int tl_tab[TL_TAB_LEN];
signed int ym2612_tl_tab[TL_TAB_LEN];
#define ENV_QUIET (TL_TAB_LEN>>3)
/* sin waveform table in 'decibel' scale */
static unsigned int sin_tab[SIN_LEN];
unsigned int ym2612_sin_tab[SIN_LEN];
/* sustain level table (3dB per step) */
/* bit0, bit1, bit2, bit3, bit4, bit5, bit6 */
@ -199,7 +201,7 @@ static unsigned int sin_tab[SIN_LEN];
/* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/
/* attenuation value (10 bits) = (SL << 2) << 3 */
#define SC(db) (uint32_t) ( db * (4.0/ENV_STEP) )
static const uint32_t sl_table[16]={
const uint32_t sl_table[16]={
SC( 0),SC( 1),SC( 2),SC(3 ),SC(4 ),SC(5 ),SC(6 ),SC( 7),
SC( 8),SC( 9),SC(10),SC(11),SC(12),SC(13),SC(14),SC(31)
};
@ -240,7 +242,7 @@ static const uint8_t eg_inc[19*RATE_STEPS]={
#define O(a) (a*RATE_STEPS)
/*note that there is no O(17) in this table - it's directly in the code */
static const uint8_t eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */
const uint8_t eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */
/* 32 infinite time rates (same as Rate 0) */
O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18),
O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18),
@ -339,7 +341,7 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0)
};
#undef O
static const uint8_t dt_tab[4 * 32]={
const uint8_t dt_tab[4 * 32]={
/* this is YM2151 and YM2612 phase increment data (in 10.10 fixed point format)*/
/* FD=0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -358,12 +360,12 @@ static const uint8_t dt_tab[4 * 32]={
/* OPN key frequency number -> key code follow table */
/* fnum higher 4bit -> keycode lower 2bit */
static const uint8_t opn_fktable[16] = {0,0,0,0,0,0,0,1,2,3,3,3,3,3,3,3};
const uint8_t opn_fktable[16] = {0,0,0,0,0,0,0,1,2,3,3,3,3,3,3,3};
/* 8 LFO speed parameters */
/* each value represents number of samples that one LFO level will last for */
static const uint32_t lfo_samples_per_step[8] = {108, 77, 71, 67, 62, 44, 8, 5};
const uint32_t lfo_samples_per_step[8] = {108, 77, 71, 67, 62, 44, 8, 5};
/*There are 4 different LFO AM depths available, they are:
@ -383,7 +385,7 @@ static const uint32_t lfo_samples_per_step[8] = {108, 77, 71, 67, 62, 44, 8, 5};
1 for 5.9 dB
0 for 11.8 dB
*/
static const uint8_t lfo_ams_depth_shift[4] = {8, 3, 1, 0};
const uint8_t lfo_ams_depth_shift[4] = {8, 3, 1, 0};
@ -394,7 +396,7 @@ static const uint8_t lfo_ams_depth_shift[4] = {8, 3, 1, 0};
(bits 8,9,10 = FNUM MSB from OCT/FNUM register)
Here we store only first quarter (positive one) of full waveform.
Full table (lfo_pm_table) containing all 128 waveforms is build
Full table (ym2612_lfo_pm_table) containing all 128 waveforms is build
at run (init) time.
One value in table below represents 4 (four) basic LFO steps
@ -407,7 +409,7 @@ static const uint8_t lfo_ams_depth_shift[4] = {8, 3, 1, 0};
samples (32*432=13824; 32 because we store only a quarter of whole
waveform in the table below)
*/
static const uint8_t lfo_pm_output[7*8][8]={
const uint8_t lfo_pm_output[7*8][8]={
/* 7 bits meaningful (of F-NUMBER), 8 LFO output levels per one depth (out of 32), 8 LFO depths */
/* FNUM BIT 4: 000 0001xxxx */
/* DEPTH 0 */ {0, 0, 0, 0, 0, 0, 0, 0},
@ -482,7 +484,7 @@ static const uint8_t lfo_pm_output[7*8][8]={
};
/* all 128 LFO PM waveforms */
static int32_t lfo_pm_table[128*8*32]; /* 128 combinations of 7 bits meaningful (of F-NUMBER), 8 LFO depths, 32 LFO output levels per one depth */
int32_t ym2612_lfo_pm_table[128*8*32]; /* 128 combinations of 7 bits meaningful (of F-NUMBER), 8 LFO depths, 32 LFO output levels per one depth */
/* register number to channel number , slot offset */
#define OPN_CHAN(N) (N&3)
@ -626,16 +628,16 @@ typedef struct
} YM2612;
/* emulated chip */
static YM2612 ym2612;
YM2612 ym2612;
/* current chip state */
static int32_t m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */
static int32_t mem; /* one sample delay memory */
static int32_t out_fm[6]; /* outputs of working channels */
int32_t m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */
int32_t mem; /* one sample delay memory */
int32_t out_fm[6]; /* outputs of working channels */
/* chip type */
static uint32_t op_mask[8][4]; /* operator output bitmasking (DAC quantization) */
static int chip_type = YM2612_DISCRETE;
uint32_t op_mask[8][4]; /* operator output bitmasking (DAC quantization) */
int chip_type = YM2612_DISCRETE;
INLINE void FM_KEYON(FM_CH *CH , int s )
@ -1293,7 +1295,7 @@ INLINE void update_ssg_eg_channels(FM_CH *CH)
INLINE void update_phase_lfo_slot(FM_SLOT *SLOT, uint32_t pm, uint8_t kc, uint32_t fc)
{
int32_t lfo_fn_offset = lfo_pm_table[((fc & 0x7f0) << 4) + pm];
int32_t lfo_fn_offset = ym2612_lfo_pm_table[((fc & 0x7f0) << 4) + pm];
if (lfo_fn_offset) /* LFO phase modulation active */
{
@ -1319,7 +1321,7 @@ INLINE void update_phase_lfo_channel(FM_CH *CH)
{
uint32_t fc = CH->block_fnum;
int32_t lfo_fn_offset = lfo_pm_table[((fc & 0x7f0) << 4) + CH->pms + ym2612.OPN.LFO_PM];
int32_t lfo_fn_offset = ym2612_lfo_pm_table[((fc & 0x7f0) << 4) + CH->pms + ym2612.OPN.LFO_PM];
if (lfo_fn_offset) /* LFO phase modulation active */
{
@ -1418,20 +1420,20 @@ INLINE void refresh_fc_eg_chan(FM_CH *CH )
INLINE signed int op_calc(uint32_t phase, unsigned int env, unsigned int pm, unsigned int opmask)
{
uint32_t p = (env<<3) + sin_tab[ ( (phase >> SIN_BITS) + (pm >> 1) ) & SIN_MASK ];
uint32_t p = (env<<3) + ym2612_sin_tab[ ( (phase >> SIN_BITS) + (pm >> 1) ) & SIN_MASK ];
if (p >= TL_TAB_LEN)
return 0;
return (tl_tab[p] & opmask);
return (ym2612_tl_tab[p] & opmask);
}
INLINE signed int op_calc1(uint32_t phase, unsigned int env, unsigned int pm, unsigned int opmask)
{
uint32_t p = (env<<3) + sin_tab[ ( ( phase >> SIN_BITS ) + pm ) & SIN_MASK ];
uint32_t p = (env<<3) + ym2612_sin_tab[ ( ( phase >> SIN_BITS ) + pm ) & SIN_MASK ];
if (p >= TL_TAB_LEN)
return 0;
return (tl_tab[p] & opmask);
return (ym2612_tl_tab[p] & opmask);
}
INLINE void chan_calc(FM_CH *CH, int num)
@ -1746,7 +1748,7 @@ INLINE void OPNWriteReg(int r, int v)
}
case 1: /* 0xb4-0xb6 : L , R , AMS , PMS */
/* b0-2 PMS */
CH->pms = (v & 7) * 32; /* CH->pms = PM depth * 32 (index in lfo_pm_table) */
CH->pms = (v & 7) * 32; /* CH->pms = PM depth * 32 (index in ym2612_lfo_pm_table) */
/* b4-5 AMS */
CH->ams = lfo_ams_depth_shift[(v>>4) & 0x03];
@ -1760,7 +1762,7 @@ INLINE void OPNWriteReg(int r, int v)
}
}
static void reset_channels(FM_CH *CH , int num )
void reset_channels(FM_CH *CH , int num )
{
int c,s;
@ -1783,7 +1785,7 @@ static void reset_channels(FM_CH *CH , int num )
}
/* initialize generic tables */
static void init_tables(void)
void ym2612_init_tables(void)
{
signed int d,i,x;
signed int n;
@ -1808,8 +1810,8 @@ static void init_tables(void)
n <<= 2; /* 13 bits here (as in real chip) */
/* 14 bits (with sign bit) */
tl_tab[ x*2 + 0 ] = n;
tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ];
ym2612_tl_tab[ x*2 + 0 ] = n;
ym2612_tl_tab[ x*2 + 1 ] = -ym2612_tl_tab[ x*2 + 0 ];
/* one entry in the 'Power' table use the following format, xxxxxyyyyyyyys with: */
/* s = sign bit */
@ -1818,8 +1820,8 @@ static void init_tables(void)
/* any value above 13 (included) would be discarded. */
for (i=1; i<13; i++)
{
tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i;
tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
ym2612_tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = ym2612_tl_tab[ x*2+0 ]>>i;
ym2612_tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -ym2612_tl_tab[ x*2+0 + i*2*TL_RES_LEN ];
}
}
@ -1844,7 +1846,7 @@ static void init_tables(void)
n = n>>1;
/* 13-bits (8.5) value is formatted for above 'Power' table */
sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
ym2612_sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 );
}
/* build LFO PM modulation table */
@ -1871,10 +1873,10 @@ static void init_tables(void)
}
}
/* 32 steps for LFO PM (sinus) */
lfo_pm_table[(fnum*32*8) + (i*32) + step + 0] = value;
lfo_pm_table[(fnum*32*8) + (i*32) +(step^7)+ 8] = value;
lfo_pm_table[(fnum*32*8) + (i*32) + step +16] = -value;
lfo_pm_table[(fnum*32*8) + (i*32) +(step^7)+24] = -value;
ym2612_lfo_pm_table[(fnum*32*8) + (i*32) + step + 0] = value;
ym2612_lfo_pm_table[(fnum*32*8) + (i*32) +(step^7)+ 8] = value;
ym2612_lfo_pm_table[(fnum*32*8) + (i*32) + step +16] = -value;
ym2612_lfo_pm_table[(fnum*32*8) + (i*32) +(step^7)+24] = -value;
}
}
}
@ -1906,7 +1908,7 @@ static void init_tables(void)
void YM2612Init(void)
{
memset(&ym2612,0,sizeof(YM2612));
init_tables();
ym2612_init_tables();
}
/* reset OPN registers */

View File

@ -41,6 +41,7 @@
#include "m68k.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
int state_load(unsigned char *state)
{

View File

@ -47,6 +47,7 @@
#include "m68k.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
/* Global variables */
t_bitmap bitmap;

View File

@ -46,6 +46,7 @@
#include "m68k.h"
#include "z80.h"
#include "system.h"
#include "genesis.h"
/* Mark a pattern as modified */
#define MARK_BG_DIRTY(addr) \

View File

@ -39,8 +39,9 @@
*
****************************************************************************************/
#ifndef _VDP_H_
#define _VDP_H_
#pragma once
#include <stdint.h>
/* VDP context */
extern uint8_t reg[0x20];
@ -105,4 +106,3 @@ extern unsigned int vdp_hvc_r(unsigned int cycles);
extern void vdp_test_w(unsigned int data);
extern int vdp_68k_irq_ack(int int_level);
#endif /* _VDP_H_ */

View File

@ -47,6 +47,7 @@
#include "md_ntsc.h"
#include "sms_ntsc.h"
#include "system.h"
#include "macros.h"
#ifndef HAVE_NO_SPRITE_LIMIT
#define MAX_SPRITES_PER_LINE 20

View File

@ -127,6 +127,7 @@
#include "shared.h"
#include "string.h"
#include "z80.h"
#include "macros.h"
/* execute main opcodes inside a big switch statement */
#define BIG_SWITCH 1
@ -221,18 +222,18 @@ unsigned char (*z80_readmem)(unsigned int address);
void (*z80_writeport)(unsigned int port, unsigned char data);
unsigned char (*z80_readport)(unsigned int port);
static uint32_t EA;
uint32_t EA;
static uint8_t SZ[256]; /* zero and sign flags */
static uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
static uint8_t SZP[256]; /* zero, sign and parity flags */
static uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
static uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
uint8_t SZ[256]; /* zero and sign flags */
uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
uint8_t SZP[256]; /* zero, sign and parity flags */
uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
static uint8_t SZHVC_add[2*256*256]; /* flags for ADD opcode */
static uint8_t SZHVC_sub[2*256*256]; /* flags for SUB opcode */
uint8_t SZHVC_add[2*256*256]; /* flags for ADD opcode */
uint8_t SZHVC_sub[2*256*256]; /* flags for SUB opcode */
static const uint16_t cc_op[0x100] = {
const uint16_t cc_op[0x100] = {
4*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15, 4*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,
8*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,12*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,
7*15,10*15,16*15, 6*15, 4*15, 4*15, 7*15, 4*15, 7*15,11*15,16*15, 6*15, 4*15, 4*15, 7*15, 4*15,
@ -250,7 +251,7 @@ static const uint16_t cc_op[0x100] = {
5*15,10*15,10*15,19*15,10*15,11*15, 7*15,11*15, 5*15, 4*15,10*15, 4*15,10*15, 0*15, 7*15,11*15,
5*15,10*15,10*15, 4*15,10*15,11*15, 7*15,11*15, 5*15, 6*15,10*15, 4*15,10*15, 0*15, 7*15,11*15};
static const uint16_t cc_cb[0x100] = {
const uint16_t cc_cb[0x100] = {
8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15,
@ -268,7 +269,7 @@ static const uint16_t cc_cb[0x100] = {
8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,15*15, 8*15};
static const uint16_t cc_ed[0x100] = {
const uint16_t cc_ed[0x100] = {
8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,
@ -286,7 +287,7 @@ static const uint16_t cc_ed[0x100] = {
8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15,
8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15, 8*15};
/*static const uint8_t cc_xy[0x100] = {
/*const uint8_t cc_xy[0x100] = {
4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,15*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,
4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,15*15, 4*15, 4*15, 4*15, 4*15, 4*15, 4*15,
4*15,14*15,20*15,10*15, 9*15, 9*15,11*15, 4*15, 4*15,15*15,20*15,10*15, 9*15, 9*15,11*15, 4*15,
@ -306,7 +307,7 @@ static const uint16_t cc_ed[0x100] = {
*/
/* illegal combo should return 4 + cc_op[i] */
static const uint16_t cc_xy[0x100] ={
const uint16_t cc_xy[0x100] ={
8*15,14*15,11*15,10*15, 8*15, 8*15,11*15, 8*15, 8*15,15*15,11*15,10*15, 8*15, 8*15,11*15, 8*15,
12*15,14*15,11*15,10*15, 8*15, 8*15,11*15, 8*15,16*15,15*15,11*15,10*15, 8*15, 8*15,11*15, 8*15,
11*15,14*15,20*15,10*15, 9*15, 9*15,12*15, 8*15,11*15,15*15,20*15,10*15, 9*15, 9*15,12*15, 8*15,
@ -324,7 +325,7 @@ static const uint16_t cc_xy[0x100] ={
9*15,14*15,14*15,23*15,14*15,15*15,11*15,15*15, 9*15, 8*15,14*15, 8*15,14*15, 4*15,11*15,15*15,
9*15,14*15,14*15, 8*15,14*15,15*15,11*15,15*15, 9*15,10*15,14*15, 8*15,14*15, 4*15,11*15,15*15};
static const uint16_t cc_xycb[0x100] = {
const uint16_t cc_xycb[0x100] = {
23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,
23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,
23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,
@ -343,7 +344,7 @@ static const uint16_t cc_xycb[0x100] = {
23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15,23*15};
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
static const uint16_t cc_ex[0x100] = {
const uint16_t cc_ex[0x100] = {
0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15,
5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* DJNZ */
5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 5*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, 0*15, /* JR NZ/JR Z */
@ -361,7 +362,7 @@ static const uint16_t cc_ex[0x100] = {
6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15,
6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15, 6*15, 0*15, 0*15, 0*15, 7*15, 0*15, 0*15, 2*15};
static const uint16_t *cc[6];
const uint16_t *cc[6];
#define Z80_TABLE_dd Z80_TABLE_xy
#define Z80_TABLE_fd Z80_TABLE_xy
@ -434,7 +435,7 @@ typedef void (*funcptr)(void);
INLINE void prefix##_fc(void); INLINE void prefix##_fd(void); INLINE void prefix##_fe(void); INLINE void prefix##_ff(void);
#define FUNCTABLE(tablename,prefix) \
static const funcptr tablename[0x100] = { \
const funcptr tablename[0x100] = { \
prefix##_00,prefix##_01,prefix##_02,prefix##_03,prefix##_04,prefix##_05,prefix##_06,prefix##_07, \
prefix##_08,prefix##_09,prefix##_0a,prefix##_0b,prefix##_0c,prefix##_0d,prefix##_0e,prefix##_0f, \
prefix##_10,prefix##_11,prefix##_12,prefix##_13,prefix##_14,prefix##_15,prefix##_16,prefix##_17, \
@ -3233,7 +3234,7 @@ OP(op,fe) { CP(ARG());
OP(op,ff) { RST(0x38); } /* RST 7 */
static void take_interrupt(void)
void take_interrupt(void)
{
/* Check if processor was halted */
LEAVE_HALT;

View File

@ -43,6 +43,7 @@
#include <stdlib.h>
#include <unzip.h>
#include <zlib.h>
#include <stdio.h>
#include "shared.h"
#include "types.h"

View File

@ -5,6 +5,7 @@
#include <osd.h>
#include <loadrom.h>
#include <system.h>
#include <genesis.h>
#include "shared.h"
#include "sms_ntsc.h"