not worth mention: minor addition to support SNES SuperScope in MESS

This commit is contained in:
Fabio Priuli 2010-03-08 07:03:58 +00:00
parent f84bb3da43
commit d1ebfa9d2e
2 changed files with 31 additions and 22 deletions

View File

@ -36,25 +36,25 @@
#endif /* MAME_DEBUG */ #endif /* MAME_DEBUG */
/* Useful definitions */ /* Useful definitions */
#define SNES_SCR_WIDTH 256 /* 32 characters 8 pixels wide */ #define SNES_SCR_WIDTH 256 /* 32 characters 8 pixels wide */
#define SNES_SCR_HEIGHT_NTSC 224 /* Can be 224 or 240 height */ #define SNES_SCR_HEIGHT_NTSC 224 /* Can be 224 or 240 height */
#define SNES_SCR_HEIGHT_PAL 274 /* ??? */ #define SNES_SCR_HEIGHT_PAL 274 /* ??? */
#define SNES_VTOTAL_NTSC 262 /* Maximum number of lines for NTSC systems */ #define SNES_VTOTAL_NTSC 262 /* Maximum number of lines for NTSC systems */
#define SNES_VTOTAL_PAL 312 /* Maximum number of lines for PAL systems */ #define SNES_VTOTAL_PAL 312 /* Maximum number of lines for PAL systems */
#define SNES_HTOTAL 341 /* Maximum number pixels per line (incl. hblank) */ #define SNES_HTOTAL 341 /* Maximum number pixels per line (incl. hblank) */
#define SNES_DMA_BASE 0x4300 /* Base DMA register address */ #define SNES_DMA_BASE 0x4300 /* Base DMA register address */
#define SNES_MODE_20 0x1 /* Lo-ROM cart */ #define SNES_MODE_20 0x1 /* Lo-ROM cart */
#define SNES_MODE_21 0x2 /* Hi-ROM cart */ #define SNES_MODE_21 0x2 /* Hi-ROM cart */
#define SNES_MODE_22 0x4 /* Extended Lo-ROM cart - SDD-1 */ #define SNES_MODE_22 0x4 /* Extended Lo-ROM cart - SDD-1 */
#define SNES_MODE_25 0x8 /* Extended Hi-ROM cart */ #define SNES_MODE_25 0x8 /* Extended Hi-ROM cart */
#define SNES_NTSC 0x00 #define SNES_NTSC 0x00
#define SNES_PAL 0x10 #define SNES_PAL 0x10
#define SNES_VRAM_SIZE 0x20000 /* 128kb of video ram */ #define SNES_VRAM_SIZE 0x20000 /* 128kb of video ram */
#define SNES_CGRAM_SIZE 0x202 /* 256 16-bit colours + 1 tacked on 16-bit colour for fixed colour */ #define SNES_CGRAM_SIZE 0x202 /* 256 16-bit colours + 1 tacked on 16-bit colour for fixed colour */
#define SNES_OAM_SIZE 0x440 /* 1088 bytes of Object Attribute Memory */ #define SNES_OAM_SIZE 0x440 /* 1088 bytes of Object Attribute Memory */
#define SNES_SPCRAM_SIZE 0x10000 /* 64kb of spc700 ram */ #define SNES_SPCRAM_SIZE 0x10000 /* 64kb of spc700 ram */
#define SNES_EXROM_START 0x1000000 #define SNES_EXROM_START 0x1000000
#define FIXED_COLOUR 256 /* Position in cgram for fixed colour */ #define FIXED_COLOUR 256 /* Position in cgram for fixed colour */
/* Definitions for PPU Memory-Mapped registers */ /* Definitions for PPU Memory-Mapped registers */
#define INIDISP 0x2100 #define INIDISP 0x2100
#define OBSEL 0x2101 #define OBSEL 0x2101
@ -369,6 +369,14 @@ struct snes_mouse
int speed; int speed;
}; };
struct snes_superscope
{
INT16 x, y;
UINT8 buttons;
int turbo_lock, pause_lock, fire_lock;
int offscreen;
};
typedef void (*snes_io_read)(running_machine *machine); typedef void (*snes_io_read)(running_machine *machine);
typedef UINT8 (*snes_oldjoy_read)(running_machine *machine); typedef UINT8 (*snes_oldjoy_read)(running_machine *machine);
@ -384,6 +392,7 @@ public:
UINT8 read_idx[2]; UINT8 read_idx[2];
snes_controller_port joypad[4]; snes_controller_port joypad[4];
snes_mouse mouse[2]; snes_mouse mouse[2];
snes_superscope scope[2];
/* input callbacks (to allow MESS to have its own input handlers) */ /* input callbacks (to allow MESS to have its own input handlers) */
snes_io_read io_read; snes_io_read io_read;
@ -471,9 +480,10 @@ extern UINT8 snes_has_addon_chip;
extern UINT32 snes_rom_size; extern UINT32 snes_rom_size;
extern UINT16 snes_htmult; extern UINT16 snes_htmult;
extern void snes_gdma( const address_space *space, UINT8 channels ); extern void snes_gdma(const address_space *space, UINT8 channels);
extern void snes_hdma_init(void); extern void snes_hdma_init(void);
extern void snes_hdma(const address_space *space); extern void snes_hdma(const address_space *space);
extern void snes_latch_counters(running_machine *machine);
/* (PPU) Video related */ /* (PPU) Video related */
extern UINT8 *snes_vram; /* Video RAM (Should be 16-bit, but it's easier this way) */ extern UINT8 *snes_vram; /* Video RAM (Should be 16-bit, but it's easier this way) */

View File

@ -70,7 +70,7 @@ struct snes_cart_info snes_cart;
*************************************/ *************************************/
// utility function - latches the H/V counters. Used by IRQ, writes to WRIO, etc. // utility function - latches the H/V counters. Used by IRQ, writes to WRIO, etc.
static void snes_latch_counters(running_machine *machine) void snes_latch_counters(running_machine *machine)
{ {
snes_ppu.beam.current_horz = video_screen_get_hpos(machine->primary_screen) / snes_htmult; snes_ppu.beam.current_horz = video_screen_get_hpos(machine->primary_screen) / snes_htmult;
snes_ppu.beam.latch_vert = video_screen_get_vpos(machine->primary_screen); snes_ppu.beam.latch_vert = video_screen_get_vpos(machine->primary_screen);
@ -572,7 +572,6 @@ READ8_HANDLER( snes_r_io )
read_ophct = 0; read_ophct = 0;
read_opvct = 0; read_opvct = 0;
value = snes_ram[offset]; value = snes_ram[offset];
value &= ~0x40; // clear 'latched counters' flag
value |= (snes_ppu.ppu1_open_bus & 0x20); value |= (snes_ppu.ppu1_open_bus & 0x20);
value |= (snes_ppu.ppu2_version & 0x0f); value |= (snes_ppu.ppu2_version & 0x0f);
snes_ram[offset] = value; // not sure if this is needed... snes_ram[offset] = value; // not sure if this is needed...