Previous 199869 Revisions Next

r32233 Saturday 20th September, 2014 at 15:30:34 UTC by Robbbert
peyper.c : improved display; added i8279 chip, added inputs.
[src/emu/machine]i8279.c
[src/mame/drivers]peyper.c
[src/mame/layout]peyper.lay

trunk/src/emu/machine/i8279.c
r32232r32233
310310               break;
311311            case 2:
312312               {
313                  UINT8 addr = m_scanner;
313                  UINT8 addr = m_scanner &7;
314314
315315                  if (decoded)
316316                     for (addr=0; !BIT(m_scanner, addr); addr++);
trunk/src/mame/layout/peyper.lay
r32232r32233
7575
7676      <!-- Extra play -->
7777      <bezel name="dpl_27" element="digit">
78         <bounds x="280"  y="40" width="12" height="16" />
78         <bounds x="275"  y="40" width="12" height="16" />
7979      </bezel>
8080      <!-- Extra ball -->
8181      <bezel name="dpl_28" element="digit">
r32232r32233
108108         <bounds x="490"  y="10" width="18" height="24" />
109109      </bezel>
110110
111      <bezel name="led_4" element="red_led">
111      <!-- Jugador 3 -->
112      <bezel name="led_3" element="red_led">
112113         <bounds x="10" y="65" width="10" height="10" />
113114      </bezel>
114      <!-- Jugador 4 -->
115115      <bezel name="dpl_32" element="digit">
116116         <bounds x="30"  y="58" width="18" height="24" />
117117      </bezel>
r32232r32233
139139         <bounds x="260"  y="58" width="18" height="24" />
140140      </bezel>
141141
142      <bezel name="led_3" element="red_led">
142      <bezel name="led_4" element="red_led">
143143         <bounds x="350" y="65" width="10" height="10" />
144144      </bezel>
145      <!-- Jugador 3 -->
145      <!-- Jugador 4 -->
146146      <bezel name="dpl_33" element="digit">
147147         <bounds x="370"  y="58" width="18" height="24" />
148148      </bezel>
trunk/src/mame/drivers/peyper.c
r32232r32233
77
88#include "machine/genpin.h"
99#include "cpu/z80/z80.h"
10#include "machine/i8279.h"
1011#include "sound/ay8910.h"
1112#include "peyper.lh"
1213
r32232r32233
2425   DECLARE_WRITE8_MEMBER(lamp_w);
2526   DECLARE_WRITE8_MEMBER(lamp7_w);
2627   DECLARE_WRITE8_MEMBER(sol_w);
28   DECLARE_WRITE8_MEMBER(p1a_w) { }; // more lamps
29   DECLARE_WRITE8_MEMBER(p1b_w) { }; // more lamps
30   DECLARE_WRITE8_MEMBER(p2a_w) { }; // more lamps
31   DECLARE_WRITE8_MEMBER(p2b_w) { }; // more lamps
2732   DECLARE_CUSTOM_INPUT_MEMBER(wolfman_replay_hs_r);
2833   DECLARE_DRIVER_INIT(peyper);
2934private:
35   UINT8 m_digit;
3036   UINT8 irq_state;
31   UINT8 display_block;
32   UINT8 display[16];
3337   virtual void machine_reset();
3438   required_device<cpu_device> m_maincpu;
3539};
3640
37
38READ8_MEMBER(peyper_state::sw_r)
41WRITE8_MEMBER( peyper_state::col_w )
3942{
40   return 0xff;
43   m_digit = data;
4144}
4245
43WRITE8_MEMBER(peyper_state::col_w)
46READ8_MEMBER( peyper_state::sw_r )
4447{
45   if (data==0x90) display_block = 0;
48   UINT8 data = 0xff;
49
50   if (m_digit < 4)
51   {
52      char kbdrow[6];
53      sprintf(kbdrow,"X%X",m_digit);
54      data = ioport(kbdrow)->read();
55   }
56   return data;
4657}
4758
48static const UINT8 hex_to_7seg[16] =
49   {0x3F, 0x06, 0x5B, 0x4F,
50      0x66, 0x6D, 0x7c, 0x07,
51      0x7F, 0x67, 0x00, 0x00,
52      0x00, 0x00, 0x00, 0x00 }; // 4511
53
5459/* seems to only work correctly for 'solarwap', 'poleposn' and 'sonstwar' (look at how high-scores are displayed for example) - or shall layout be changed ? */
55WRITE8_MEMBER(peyper_state::disp_w)
60WRITE8_MEMBER( peyper_state::disp_w )
5661{
57   display[display_block] = data;
58
62   static const UINT8 patterns[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0 }; // 7448
5963   UINT8 a = data & 0x0f;
6064   UINT8 b = data >> 4;
61   UINT8 hex_a = hex_to_7seg[a];
62   UINT8 hex_b = hex_to_7seg[b];
65   UINT8 hex_a = patterns[a];
66   UINT8 hex_b = patterns[b];
6367/*
64680 -> XA0 DPL25,DPL27
65691 -> XA1 DPL26,DPL28
r32232r32233
70746 -> DPL19,DPL1
71757 -> DPL30,DPL33
7276*/
73   switch(display_block) {
77   switch(m_digit) {
7478      case 0 :
7579            output_set_indexed_value("dpl_",25,hex_a);
7680            output_set_indexed_value("dpl_",27,hex_b);
r32232r32233
100104            output_set_indexed_value("dpl_",1,hex_b);
101105            break;
102106      case 7 :
103            output_set_indexed_value("dpl_",30,hex_a);
104            output_set_indexed_value("dpl_",33,hex_b);
107            output_set_indexed_value("dpl_",33,hex_a);
108            output_set_indexed_value("dpl_",30,hex_b);
105109            break;
106110/*
1071118 ->  XB0
r32232r32233
115119*/
116120      case 8 :
117121            /*
118            if (BIT(a,3)) logerror("TILT\n");
119            if (BIT(a,2)) logerror("ONC\n");
120            if (BIT(a,1)) logerror("GAME OVER\n");
121            if (BIT(a,0)) logerror("BALL IN PLAY\n");
122            if (BIT(b,3)) logerror("TILT\n");
123            if (BIT(b,2)) logerror("ONC\n");
124            if (BIT(b,1)) logerror("GAME OVER\n");
125            if (BIT(b,0)) logerror("BALL IN PLAY\n");
122126            */
123            output_set_indexed_value("led_",1,BIT(b,0)); // PLAYER 1
124            output_set_indexed_value("led_",2,BIT(b,1)); // PLAYER 2
125            output_set_indexed_value("led_",3,BIT(b,2)); // PLAYER 3
126            output_set_indexed_value("led_",4,BIT(b,3)); // PLAYER 4
127            output_set_indexed_value("led_",1,BIT(a,0)); // PLAYER 1
128            output_set_indexed_value("led_",2,BIT(a,1)); // PLAYER 2
129            output_set_indexed_value("led_",3,BIT(a,2)); // PLAYER 3
130            output_set_indexed_value("led_",4,BIT(a,3)); // PLAYER 4
127131            break;
128132      case 9 :
129            if (!BIT(b,0)) output_set_indexed_value("dpl_",6,hex_to_7seg[0]);
130            if (!BIT(b,1)) output_set_indexed_value("dpl_",12,hex_to_7seg[0]);
131            if (!BIT(b,2)) output_set_indexed_value("dpl_",24,hex_to_7seg[0]);
132            if (!BIT(b,3)) output_set_indexed_value("dpl_",18,hex_to_7seg[0]);
133            output_set_indexed_value("dpl_",29,hex_a);
133            if (!BIT(a,0)) output_set_indexed_value("dpl_",6, 0x3f);
134            if (!BIT(a,1)) output_set_indexed_value("dpl_",12, 0x3f);
135            if (!BIT(a,2)) output_set_indexed_value("dpl_",24, 0x3f);
136            if (!BIT(a,3)) output_set_indexed_value("dpl_",18, 0x3f);
137            output_set_indexed_value("dpl_",29,hex_b);
134138            break;
135139      case 10 :
136            output_set_indexed_value("dpl_",11,hex_a);
137            output_set_indexed_value("dpl_",17,hex_b);
140            output_set_indexed_value("dpl_",17,hex_a);
141            output_set_indexed_value("dpl_",11,hex_b);
138142            break;
139143      case 11 :
140            output_set_indexed_value("dpl_",10,hex_a);
141            output_set_indexed_value("dpl_",16,hex_b);
144            output_set_indexed_value("dpl_",16,hex_a);
145            output_set_indexed_value("dpl_",10,hex_b);
142146            break;
143147      case 12 :
144            output_set_indexed_value("dpl_",9,hex_a);
145            output_set_indexed_value("dpl_",15,hex_b);
148            output_set_indexed_value("dpl_",15,hex_a);
149            output_set_indexed_value("dpl_",9,hex_b);
146150            break;
147151      case 13 :
148            output_set_indexed_value("dpl_",8,hex_a);
149            output_set_indexed_value("dpl_",14,hex_b);
152            output_set_indexed_value("dpl_",14,hex_a);
153            output_set_indexed_value("dpl_",8,hex_b);
150154            break;
151155      case 14 :
152            output_set_indexed_value("dpl_",7,hex_a);
153            output_set_indexed_value("dpl_",13,hex_b);
156            output_set_indexed_value("dpl_",13,hex_a);
157            output_set_indexed_value("dpl_",7,hex_b);
154158            break;
155159      case 15 :
156            output_set_indexed_value("dpl_",31,hex_a);
157            output_set_indexed_value("dpl_",32,hex_b);
160            output_set_indexed_value("dpl_",32,hex_a);
161            output_set_indexed_value("dpl_",31,hex_b);
158162            break;
159163   }
160
161   display_block++;
162   display_block&=0x0f;
163164}
164165
165166WRITE8_MEMBER(peyper_state::lamp_w)
r32232r32233
205206static ADDRESS_MAP_START( peyper_io, AS_IO, 8, peyper_state )
206207   ADDRESS_MAP_UNMAP_HIGH
207208   ADDRESS_MAP_GLOBAL_MASK(0xff)
208   AM_RANGE(0x00, 0x00) AM_READWRITE(sw_r,disp_w)
209   AM_RANGE(0x01, 0x01) AM_WRITE(col_w)
209   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w )
210   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w)
210211   AM_RANGE(0x04, 0x04) AM_DEVWRITE("ay1", ay8910_device, address_w)
211212   AM_RANGE(0x06, 0x06) AM_DEVWRITE("ay1", ay8910_device, data_w)
212213   AM_RANGE(0x08, 0x08) AM_DEVWRITE("ay2", ay8910_device, address_w)
r32232r32233
253254   PORT_DIPSETTING(    0x01, "0k 0k and 0k / 0k" )
254255   PORT_DIPSETTING(    0x02, "0k 0k and 0k / 0k" )
255256   PORT_DIPSETTING(    0x03, "0k 0k and 0k / 0k" )
257
258   PORT_START("X0")
259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Outhole")
260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W)
261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E)
262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R)
263   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y)
264   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U)
265   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I)
266   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_O)
267
268   PORT_START("X1")
269   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A)
270   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S)
271   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D)
272   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F)
273   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G)
274   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H)
275   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J)
276   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K)
277
278   PORT_START("X2")
279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z)
280   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C)
281   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_V)
282   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_B)
283   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_N)
284   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_M)
285   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_COMMA)
286   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_STOP)
287
288   PORT_START("X3")
289   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L)
290   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q)
291   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_EQUALS)
292   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSPACE)
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_OPENBRACE)
294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_CLOSEBRACE)
295   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_BACKSLASH)
296   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_COLON)
256297INPUT_PORTS_END
257298
258299
r32232r32233
555596   MCFG_FRAGMENT_ADD( genpin_audio )
556597   MCFG_SPEAKER_STANDARD_MONO("ayvol")
557598   MCFG_SOUND_ADD("ay1", AY8910, 2500000)
558   //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p1a_w))
559   //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p1b_w))
599   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p1a_w))
600   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p1b_w))
560601   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ayvol", 1.0)
561602   MCFG_SOUND_ADD("ay2", AY8910, 2500000)
562   //MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p2a_w))
563   //MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p2b_w))
603   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(peyper_state, p2a_w))
604   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(peyper_state, p2b_w))
564605   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "ayvol", 1.0)
606
607   /* Devices */
608   MCFG_DEVICE_ADD("i8279", I8279, 2500000)
609   MCFG_I8279_OUT_SL_CB(WRITE8(peyper_state, col_w))             // scan SL lines
610   MCFG_I8279_OUT_DISP_CB(WRITE8(peyper_state, disp_w))          // display A&B
611   MCFG_I8279_IN_RL_CB(READ8(peyper_state, sw_r))                // kbd RL lines
612   MCFG_I8279_IN_SHIFT_CB(VCC)                                   // Shift key
613   MCFG_I8279_IN_CTRL_CB(VCC)
565614MACHINE_CONFIG_END
566615
567616
r32232r32233
671720   ROM_LOAD("memoriac.bin", 0x4000, 0x2000, CRC(468f16f0) SHA1(66ce0464d82331cfc0ac1f6fbd871066e4e57262))
672721ROM_END
673722
723/*-------------------------------------------------------------------
724/ Sir Lancelot (1994)
725/-------------------------------------------------------------------*/
674726
675727GAME( 1985, odin,     0,        peyper,   odin_dlx, peyper_state, peyper,   ROT0, "Sonic",  "Odin",                  GAME_IS_SKELETON_MECHANICAL)
676728GAME( 1985, odin_dlx, 0,        peyper,   odin_dlx, peyper_state, peyper,   ROT0, "Sonic",  "Odin De Luxe",          GAME_IS_SKELETON_MECHANICAL)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team