Previous 199869 Revisions Next

r23905 Monday 24th June, 2013 at 10:30:07 UTC by Fabio Priuli
(MESS) some meat added to the bone (nothing relevant, though). nw.
[src/mess/machine]sns_sgb.c sns_sgb.h

trunk/src/mess/machine/sns_sgb.c
r23904r23905
2424
2525sns_rom_sgb_device::sns_rom_sgb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2626               : sns_rom_device(mconfig, SNS_LOROM_SUPERGB, "SNES Super Game Boy Cart", tag, owner, clock, "sns_rom_sgb", __FILE__),
27               m_gb_cpu(*this, "supergb"),
27               m_gb_cpu(*this, "sgb_cpu"),
28               m_gb_snd(*this, "sgb_snd"),
29               m_gb_lcd(*this, "sgb_lcd"),
2830               m_cartslot(*this, "gb_slot")
2931{
3032}
r23904r23905
6668   m_cartslot->write_ram(space, offset, data);
6769}
6870
71READ8_MEMBER(sns_rom_sgb_device::gb_echo_r)
72{
73   return space.read_byte(0xc000 + offset);
74}
6975
76WRITE8_MEMBER(sns_rom_sgb_device::gb_echo_w)
77{
78   return space.write_byte(0xc000 + offset, data);
79}
80
81READ8_MEMBER(sns_rom_sgb_device::gb_io_r)
82{
83   return 0;
84}
85
86WRITE8_MEMBER(sns_rom_sgb_device::gb_io_w)
87{
88}
89
90READ8_MEMBER(sns_rom_sgb_device::gb_ie_r)
91{
92//   return m_gb_cpu->get_ie();
93   return 0;
94}
95
96WRITE8_MEMBER(sns_rom_sgb_device::gb_ie_w)
97{
98//   m_gb_cpu->set_ie(data & 0x1f);
99}
100
101
102
70103static ADDRESS_MAP_START(supergb_map, AS_PROGRAM, 8, sns_rom_sgb_device )
71104   ADDRESS_MAP_UNMAP_HIGH
72105   AM_RANGE(0x0000, 0x7fff) AM_READWRITE(gb_cart_r, gb_bank_w)
106   AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE("sgb_lcd", sgb_lcd_device, vram_r, vram_w)  /* 8k VRAM */
73107   AM_RANGE(0xa000, 0xbfff) AM_READWRITE(gb_ram_r, gb_ram_w )   /* 8k switched RAM bank (cartridge) */
74   AM_RANGE(0xc000, 0xfdff) AM_RAM                     /* 8k low RAM, echo RAM */
108   AM_RANGE(0xc000, 0xdfff) AM_RAM                               /* 8k low RAM */
109   AM_RANGE(0xe000, 0xfdff) AM_READWRITE(gb_echo_r, gb_echo_w)  /* echo RAM */
110   AM_RANGE(0xff00, 0xff0f) AM_READWRITE(gb_io_r, gb_io_w)      /* I/O */
111   AM_RANGE(0xff10, 0xff26) AM_DEVREADWRITE("sgb_snd", gameboy_sound_device, sound_r, sound_w)      /* sound registers */
112   AM_RANGE(0xfe00, 0xfeff) AM_DEVREADWRITE("sgb_lcd", sgb_lcd_device, oam_r, oam_w)    /* OAM RAM */
75113   AM_RANGE(0xff27, 0xff2f) AM_NOP                     /* unused */
114   AM_RANGE(0xff30, 0xff3f) AM_DEVREADWRITE("sgb_snd", gameboy_sound_device, wave_r, wave_w)        /* Wave RAM */
115   AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE("sgb_lcd", sgb_lcd_device, video_r, video_w) /* also disable bios?? */        /* Video controller & BIOS flip-flop */
76116   AM_RANGE(0xff80, 0xfffe) AM_RAM                     /* High RAM */
117   AM_RANGE(0xffff, 0xffff) AM_READWRITE(gb_ie_r, gb_ie_w)        /* Interrupt enable register */
77118ADDRESS_MAP_END
78119
79120
r23904r23905
84125
85126
86127static SLOT_INTERFACE_START(supergb_cart)
128   SLOT_INTERFACE_INTERNAL("rom",  GB_STD_ROM)
129   SLOT_INTERFACE_INTERNAL("rom_mbc1",  GB_ROM_MBC1)
87130SLOT_INTERFACE_END
88131
89132static MACHINE_CONFIG_FRAGMENT( supergb )
90   MCFG_CPU_ADD("supergb", LR35902, 4295454)   /* 4.295454 MHz */
133   MCFG_CPU_ADD("sgb_cpu", LR35902, 4295454)   /* 4.295454 MHz */
91134   MCFG_CPU_PROGRAM_MAP(supergb_map)
92135   MCFG_LR35902_TIMER_CB(WRITE8(sns_rom_sgb_device, gb_timer_callback))
93136   MCFG_LR35902_HALT_BUG
94137
138   MCFG_GB_LCD_SGB_ADD("sgb_lcd")
139
140   MCFG_SOUND_ADD("sgb_snd", GAMEBOY, 0)
141
95142   MCFG_GB_CARTRIDGE_ADD("gb_slot", supergb_cart, NULL)
96143MACHINE_CONFIG_END
97144
trunk/src/mess/machine/sns_sgb.h
r23904r23905
44#include "machine/sns_slot.h"
55#include "machine/sns_rom.h"
66
7//#include "cpu/lr35902/lr35902.h"
78#include "machine/gb_slot.h"
9#include "machine/gb_rom.h"
10#include "machine/gb_mbc.h"
11#include "video/gb_lcd.h"
12#include "audio/gb.h"
813
914
1015// ======================> sns_rom_sgb_device
r23904r23905
3035   virtual DECLARE_WRITE8_MEMBER(gb_bank_w);
3136   virtual DECLARE_READ8_MEMBER(gb_ram_r);
3237   virtual DECLARE_WRITE8_MEMBER(gb_ram_w);
38   virtual DECLARE_READ8_MEMBER(gb_echo_r);
39   virtual DECLARE_WRITE8_MEMBER(gb_echo_w);
40   virtual DECLARE_READ8_MEMBER(gb_io_r);
41   virtual DECLARE_WRITE8_MEMBER(gb_io_w);
42   virtual DECLARE_READ8_MEMBER(gb_ie_r);
43   virtual DECLARE_WRITE8_MEMBER(gb_ie_w);
3344   virtual DECLARE_WRITE8_MEMBER(gb_timer_callback);
3445
3546   required_device<cpu_device> m_gb_cpu;
47   required_device<gameboy_sound_device> m_gb_snd;
48   required_device<sgb_lcd_device> m_gb_lcd;
3649   required_device<gb_cart_slot_device> m_cartslot;
3750
3851   void lcd_render(UINT32 *source);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team