Previous 199869 Revisions Next

r36806 Monday 30th March, 2015 at 17:36:14 UTC by Osso
unkhorse.c: added save state support (nw)
[src/mame/drivers]unkhorse.c

trunk/src/mame/drivers/unkhorse.c
r245317r245318
3030public:
3131   horse_state(const machine_config &mconfig, device_type type, const char *tag)
3232      : driver_device(mconfig, type, tag),
33      m_maincpu(*this, "maincpu"),
34      m_dac(*this, "dac"),
3335      m_video_ram(*this, "video_ram"),
34      m_color_ram(*this, "color_ram"),
35      m_maincpu(*this, "maincpu"),
36      m_dac(*this, "dac") { }
36      m_color_ram(*this, "color_ram") { }
3737
38   required_device<cpu_device> m_maincpu;
39   required_device<dac_device> m_dac;
40
3841   required_shared_ptr<UINT8> m_video_ram;
3942   required_shared_ptr<UINT8> m_color_ram;
43
4044   UINT8 m_output;
41   DECLARE_READ8_MEMBER(horse_input_r);
42   DECLARE_WRITE8_MEMBER(horse_output_w);
43   DECLARE_WRITE_LINE_MEMBER(horse_timer_out);
45
46   DECLARE_READ8_MEMBER(input_r);
47   DECLARE_WRITE8_MEMBER(output_w);
48   DECLARE_WRITE_LINE_MEMBER(timer_out);
49   
50   virtual void machine_start();
4451   DECLARE_PALETTE_INIT(horse);
45   UINT32 screen_update_horse(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
46   INTERRUPT_GEN_MEMBER(horse_interrupt);
47   required_device<cpu_device> m_maincpu;
48   required_device<dac_device> m_dac;
52
53   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54
55   INTERRUPT_GEN_MEMBER(interrupt);
4956};
5057
5158
59void horse_state::machine_start()
60{
61   save_item(NAME(m_output));
62}
63
5264/***************************************************************************
5365
5466  Video
r245317r245318
6274      palette.set_pen_color(i, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
6375}
6476
65UINT32 horse_state::screen_update_horse(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
77UINT32 horse_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6678{
6779   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
6880   {
r245317r245318
98110ADDRESS_MAP_END
99111
100112
101READ8_MEMBER(horse_state::horse_input_r)
113READ8_MEMBER(horse_state::input_r)
102114{
103115   switch (m_output >> 6 & 3)
104116   {
r245317r245318
111123   return 0xff;
112124}
113125
114WRITE8_MEMBER(horse_state::horse_output_w)
126WRITE8_MEMBER(horse_state::output_w)
115127{
116128   m_output = data;
117129
r245317r245318
120132   // other bits: ?
121133}
122134
123WRITE_LINE_MEMBER(horse_state::horse_timer_out)
135WRITE_LINE_MEMBER(horse_state::timer_out)
124136{
125137   m_dac->write_signed8(state ? 0x7f : 0);
126138}
r245317r245318
182194
183195***************************************************************************/
184196
185INTERRUPT_GEN_MEMBER(horse_state::horse_interrupt)
197INTERRUPT_GEN_MEMBER(horse_state::interrupt)
186198{
187199   device.execute().set_input_line(I8085_RST75_LINE, ASSERT_LINE);
188200   device.execute().set_input_line(I8085_RST75_LINE, CLEAR_LINE);
r245317r245318
194206   MCFG_CPU_ADD("maincpu", I8085A, XTAL_12MHz / 2)
195207   MCFG_CPU_PROGRAM_MAP(horse_map)
196208   MCFG_CPU_IO_MAP(horse_io_map)
197   MCFG_CPU_VBLANK_INT_DRIVER("screen", horse_state,  horse_interrupt)
209   MCFG_CPU_VBLANK_INT_DRIVER("screen", horse_state,  interrupt)
198210
199211   MCFG_DEVICE_ADD("i8155", I8155, XTAL_12MHz / 2)
200   MCFG_I8155_IN_PORTA_CB(READ8(horse_state, horse_input_r))
201   MCFG_I8155_OUT_PORTB_CB(WRITE8(horse_state, horse_output_w))
212   MCFG_I8155_IN_PORTA_CB(READ8(horse_state, input_r))
213   MCFG_I8155_OUT_PORTB_CB(WRITE8(horse_state, output_w))
202214   //port C output (but unused)
203   MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(horse_state, horse_timer_out))
215   MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE(horse_state, timer_out))
204216
205217   /* video hardware */
206218   MCFG_SCREEN_ADD("screen", RASTER)
r245317r245318
208220   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
209221   MCFG_SCREEN_SIZE(32*8, 32*8)
210222   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
211   MCFG_SCREEN_UPDATE_DRIVER(horse_state, screen_update_horse)
223   MCFG_SCREEN_UPDATE_DRIVER(horse_state, screen_update)
212224   MCFG_SCREEN_PALETTE("palette")
213225
214226   MCFG_PALETTE_ADD("palette", 8)
r245317r245318
240252ROM_END
241253
242254
243GAME( 1981?, unkhorse, 0, horse, horse, driver_device, 0, ROT270, "<unknown>", "unknown Japanese horse gambling game", 0 ) // copyright not shown, datecodes on pcb suggests early-1981
255GAME( 1981?, unkhorse, 0, horse, horse, driver_device, 0, ROT270, "<unknown>", "unknown Japanese horse gambling game", GAME_SUPPORTS_SAVE ) // copyright not shown, datecodes on pcb suggests early-1981


Previous 199869 Revisions Next


© 1997-2024 The MAME Team