From d1ebfa9d2ed8d2125825bb0b7d2dc575dcf72952 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Mon, 8 Mar 2010 07:03:58 +0000 Subject: [PATCH] not worth mention: minor addition to support SNES SuperScope in MESS --- src/mame/includes/snes.h | 50 ++++++++++++++++++++++++---------------- src/mame/machine/snes.c | 3 +-- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index d38ce01acff..3db43b9d2b3 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -36,25 +36,25 @@ #endif /* MAME_DEBUG */ /* Useful definitions */ -#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_PAL 274 /* ??? */ -#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_HTOTAL 341 /* Maximum number pixels per line (incl. hblank) */ -#define SNES_DMA_BASE 0x4300 /* Base DMA register address */ -#define SNES_MODE_20 0x1 /* Lo-ROM cart */ -#define SNES_MODE_21 0x2 /* Hi-ROM cart */ -#define SNES_MODE_22 0x4 /* Extended Lo-ROM cart - SDD-1 */ -#define SNES_MODE_25 0x8 /* Extended Hi-ROM cart */ -#define SNES_NTSC 0x00 -#define SNES_PAL 0x10 -#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_OAM_SIZE 0x440 /* 1088 bytes of Object Attribute Memory */ -#define SNES_SPCRAM_SIZE 0x10000 /* 64kb of spc700 ram */ -#define SNES_EXROM_START 0x1000000 -#define FIXED_COLOUR 256 /* Position in cgram for fixed colour */ +#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_PAL 274 /* ??? */ +#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_HTOTAL 341 /* Maximum number pixels per line (incl. hblank) */ +#define SNES_DMA_BASE 0x4300 /* Base DMA register address */ +#define SNES_MODE_20 0x1 /* Lo-ROM cart */ +#define SNES_MODE_21 0x2 /* Hi-ROM cart */ +#define SNES_MODE_22 0x4 /* Extended Lo-ROM cart - SDD-1 */ +#define SNES_MODE_25 0x8 /* Extended Hi-ROM cart */ +#define SNES_NTSC 0x00 +#define SNES_PAL 0x10 +#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_OAM_SIZE 0x440 /* 1088 bytes of Object Attribute Memory */ +#define SNES_SPCRAM_SIZE 0x10000 /* 64kb of spc700 ram */ +#define SNES_EXROM_START 0x1000000 +#define FIXED_COLOUR 256 /* Position in cgram for fixed colour */ /* Definitions for PPU Memory-Mapped registers */ #define INIDISP 0x2100 #define OBSEL 0x2101 @@ -369,6 +369,14 @@ struct snes_mouse 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 UINT8 (*snes_oldjoy_read)(running_machine *machine); @@ -384,6 +392,7 @@ public: UINT8 read_idx[2]; snes_controller_port joypad[4]; snes_mouse mouse[2]; + snes_superscope scope[2]; /* input callbacks (to allow MESS to have its own input handlers) */ snes_io_read io_read; @@ -471,9 +480,10 @@ extern UINT8 snes_has_addon_chip; extern UINT32 snes_rom_size; 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(const address_space *space); +extern void snes_latch_counters(running_machine *machine); /* (PPU) Video related */ extern UINT8 *snes_vram; /* Video RAM (Should be 16-bit, but it's easier this way) */ diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index bc34edac1e5..5fcab915207 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -70,7 +70,7 @@ struct snes_cart_info snes_cart; *************************************/ // 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.latch_vert = video_screen_get_vpos(machine->primary_screen); @@ -572,7 +572,6 @@ READ8_HANDLER( snes_r_io ) read_ophct = 0; read_opvct = 0; value = snes_ram[offset]; - value &= ~0x40; // clear 'latched counters' flag value |= (snes_ppu.ppu1_open_bus & 0x20); value |= (snes_ppu.ppu2_version & 0x0f); snes_ram[offset] = value; // not sure if this is needed...