Previous 199869 Revisions Next

r36195 Monday 2nd March, 2015 at 19:50:31 UTC by hap
hh_pic16 fleshed out
[src/mess/drivers]hh_pic16.c hh_tms1k.c hh_ucom4.c
[src/mess/layout]maniac.lay

trunk/src/mess/drivers/hh_pic16.c
r244706r244707
55  Collection of PIC16xx/16Cxx-driven dedicated handhelds or other simple devices
66
77
8  TODO:
9  - it doesn't work, emu/cpu/pic16c5x needs some love (dev note: hack to make it
10    playable: remove the TRIS masks)
11
812***************************************************************************/
913
1014#include "emu.h"
r244706r244707
2024   hh_pic16_state(const machine_config &mconfig, device_type type, const char *tag)
2125      : driver_device(mconfig, type, tag),
2226      m_maincpu(*this, "maincpu"),
23//      m_inp_matrix(*this, "IN"),
24      m_speaker(*this, "speaker")
27      m_inp_matrix(*this, "IN"),
28      m_speaker(*this, "speaker"),
29      m_display_wait(33),
30      m_display_maxy(1),
31      m_display_maxx(0)
2532   { }
2633
2734   // devices
2835   required_device<cpu_device> m_maincpu;
29//   optional_ioport_array<3> m_inp_matrix; // max 3
36   optional_ioport_array<2> m_inp_matrix; // max 2
3037   optional_device<speaker_sound_device> m_speaker;
3138
39   // misc common
40   UINT8 m_b;
41   UINT8 m_c;
42
3243   virtual void machine_start();
44
45   // display common
46   int m_display_wait;
47   int m_display_maxy;
48   int m_display_maxx;
49   
50   UINT32 m_display_state[0x20];
51   UINT32 m_display_cache[0x20];
52   UINT8 m_display_decay[0x20][0x20];
53   UINT16 m_7seg_mask[0x20];
54
55   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
56   void display_update();
57   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
58
59   // game-specific handlers
60   DECLARE_WRITE8_MEMBER(maniac_output_w);
3361};
3462
3563
3664void hh_pic16_state::machine_start()
3765{
66   // zerofill
67   memset(m_display_state, 0, sizeof(m_display_state));
68   memset(m_display_cache, 0, sizeof(m_display_cache));
69   memset(m_display_decay, 0, sizeof(m_display_decay));
70   memset(m_7seg_mask, 0, sizeof(m_7seg_mask));
71   
72   m_b = 0;
73   m_c = 0;
74
75   // register for savestates
76   save_item(NAME(m_display_maxy));
77   save_item(NAME(m_display_maxx));
78   save_item(NAME(m_display_wait));
79
80   save_item(NAME(m_display_state));
81   save_item(NAME(m_display_cache));
82   save_item(NAME(m_display_decay));
83   save_item(NAME(m_7seg_mask));
84
85   save_item(NAME(m_b));
86   save_item(NAME(m_c));
3887}
3988
4089
4190
91/***************************************************************************
4292
93  Helper Functions
4394
95***************************************************************************/
4496
97// The device may strobe the outputs very fast, it is unnoticeable to the user.
98// To prevent flickering here, we need to simulate a decay.
99
100void hh_pic16_state::display_update()
101{
102   UINT32 active_state[0x20];
103
104   for (int y = 0; y < m_display_maxy; y++)
105   {
106      active_state[y] = 0;
107
108      for (int x = 0; x < m_display_maxx; x++)
109      {
110         // turn on powered segments
111         if (m_display_state[y] >> x & 1)
112            m_display_decay[y][x] = m_display_wait;
113
114         // determine active state
115         int ds = (m_display_decay[y][x] != 0) ? 1 : 0;
116         active_state[y] |= (ds << x);
117      }
118   }
119
120   // on difference, send to output
121   for (int y = 0; y < m_display_maxy; y++)
122      if (m_display_cache[y] != active_state[y])
123      {
124         if (m_7seg_mask[y] != 0)
125            output_set_digit_value(y, active_state[y] & m_7seg_mask[y]);
126
127         const int mul = (m_display_maxx <= 10) ? 10 : 100;
128         for (int x = 0; x < m_display_maxx; x++)
129            output_set_lamp_value(y * mul + x, active_state[y] >> x & 1);
130      }
131
132   memcpy(m_display_cache, active_state, sizeof(m_display_cache));
133}
134
135TIMER_DEVICE_CALLBACK_MEMBER(hh_pic16_state::display_decay_tick)
136{
137   // slowly turn off unpowered segments
138   for (int y = 0; y < m_display_maxy; y++)
139      for (int x = 0; x < m_display_maxx; x++)
140         if (!(m_display_state[y] >> x & 1) && m_display_decay[y][x] != 0)
141            m_display_decay[y][x]--;
142   
143   display_update();
144}
145
146void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
147{
148   m_display_maxx = maxx;
149   m_display_maxy = maxy;
150
151   // update current state
152   UINT32 mask = (1 << maxx) - 1;
153   for (int y = 0; y < maxy; y++)
154      m_display_state[y] = (sety >> y & 1) ? (setx & mask) : 0;
155   
156   display_update();
157}
158
159
160
45161/***************************************************************************
46162
47163  Minidrivers (I/O, Inputs, Machine Config)
r244706r244707
51167/***************************************************************************
52168
53169  Ideal Maniac, by Ralph Baer
54  * PIC1655-036
170  * PIC1655A-036
55171
56172
57173***************************************************************************/
58174
175WRITE8_MEMBER(hh_pic16_state::maniac_output_w)
176{
177   // B,C: outputs
178   offset -= PIC16C5x_PORTB;
179   if (offset)
180      m_c = data;
181   else
182      m_b = data;
183   
184   // d7: speaker out/enable
185   m_speaker->level_w((m_b & m_c) >> 7 & 1);
59186
187   // d0-d6: 7seg
188   m_display_maxx = 7;
189   m_display_maxy = 2;
190   
191   m_7seg_mask[offset] = 0x7f;
192   m_display_state[offset] = ~data & 0x7f;
193   display_update();
194}
195
196
60197static INPUT_PORTS_START( maniac )
198   PORT_START("IN.0") // port A
199   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // bottom-right
200   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // upper-right
201   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) // bottom-left
202   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) // upper-left
61203INPUT_PORTS_END
62204
63205
64206static MACHINE_CONFIG_START( maniac, hh_pic16_state )
65207
66208   /* basic machine hardware */
67   MCFG_CPU_ADD("maincpu", PIC16C55, 500000)
209   MCFG_CPU_ADD("maincpu", PIC16C55, 850000) // RC osc. R=13.4K, C=470pf, but unknown RC curve - measured 800-890kHz
210   MCFG_PIC16C5x_READ_A_CB(IOPORT("IN.0"))
211   MCFG_PIC16C5x_WRITE_B_CB(WRITE8(hh_pic16_state, maniac_output_w))
212   MCFG_PIC16C5x_WRITE_C_CB(WRITE8(hh_pic16_state, maniac_output_w))
213   MCFG_PIC16C5x_SET_CONFIG(0) // ?
68214
215   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1))
69216   MCFG_DEFAULT_LAYOUT(layout_maniac)
70217
71218   /* no video! */
r244706r244707
78225
79226
80227
228
229
230/***************************************************************************
231
232  Game driver(s)
233
234***************************************************************************/
235
81236ROM_START( maniac )
82237   ROM_REGION( 0x0800, "maincpu", 0 )
83   ROM_LOAD( "1655-036", 0x0000, 0x0400, CRC(a96f7011) SHA1(e97ae44d3c1e74c7e1024bb0bdab03eecdc9f827) )
238   ROM_LOAD( "pic1655a-036", 0x0000, 0x0400, CRC(a96f7011) SHA1(e97ae44d3c1e74c7e1024bb0bdab03eecdc9f827) )
84239ROM_END
85240
86241
87CONS( 1979, maniac, 0, 0, maniac, maniac, driver_device, 0, "Ideal", "Maniac", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
242
243/*    YEAR  NAME       PARENT COMPAT MACHINE INPUT   INIT              COMPANY, FULLNAME, FLAGS */
244CONS( 1979, maniac,    0,        0, maniac,  maniac, driver_device, 0, "Ideal", "Maniac", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/drivers/hh_tms1k.c
r244706r244707
5050  TODO:
5151  - verify output PLA and microinstructions PLA for MCUs that have been dumped
5252    electronically (mpla is usually the default, opla is often custom)
53  - unknown MCU clocks for some
53  - unknown MCU clocks for some: TMS1000 and TMS1100 RC curve is documented in
54    the data manual, but for TMS1400 it's unknown. TMS0970/0980 osc. is on-die.
5455  - some of the games rely on the fact that faster(longer) strobed leds appear
5556    brighter: tc4(offensive players), bankshot(cue ball)
5657  - add softwarelist for tc4 cartridges?
r244706r244707
250251   lDP = 0x80
251252};
252253
253// The device strobes the outputs very fast, it is unnoticeable to the user.
254// The device may strobe the outputs very fast, it is unnoticeable to the user.
254255// To prevent flickering here, we need to simulate a decay.
255256
256257void hh_tms1k_state::display_update()
r244706r244707
22612262
22622263
22632264
2264CONS( 1980, mathmagi, 0, 0, mathmagi, mathmagi, driver_device, 0, "APF Electronics Inc.", "Mathemagician", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
2265/*    YEAR  NAME       PARENT COMPAT MACHINE   INPUT      INIT              COMPANY, FULLNAME, FLAGS */
2266CONS( 1980, mathmagi,  0,        0, mathmagi,  mathmagi,  driver_device, 0, "APF Electronics Inc.", "Mathemagician", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
22652267
2266CONS( 1979, amaztron, 0, 0, amaztron, amaztron, driver_device, 0, "Coleco", "Amaze-A-Tron", GAME_SUPPORTS_SAVE )
2267CONS( 1981, tc4, 0, 0, tc4, tc4, driver_device, 0, "Coleco", "Total Control 4", GAME_SUPPORTS_SAVE )
2268CONS( 1979, amaztron,  0,        0, amaztron,  amaztron,  driver_device, 0, "Coleco", "Amaze-A-Tron", GAME_SUPPORTS_SAVE )
2269CONS( 1981, tc4,       0,        0, tc4,       tc4,       driver_device, 0, "Coleco", "Total Control 4", GAME_SUPPORTS_SAVE )
22682270
2269CONS( 1978, ebball, 0, 0, ebball, ebball, driver_device, 0, "Entex", "Electronic Baseball (Entex)", GAME_SUPPORTS_SAVE )
2271CONS( 1978, ebball,    0,        0, ebball,    ebball,    driver_device, 0, "Entex", "Electronic Baseball (Entex)", GAME_SUPPORTS_SAVE ) // or 1979?
22702272
2271CONS( 1979, elecdet, 0, 0, elecdet, elecdet, driver_device, 0, "Ideal", "Electronic Detective", GAME_SUPPORTS_SAVE )
2273CONS( 1979, elecdet,   0,        0, elecdet,   elecdet,   driver_device, 0, "Ideal", "Electronic Detective", GAME_SUPPORTS_SAVE ) // unplayable without game cards
22722274
2273CONS( 1979, starwbc,  0,       0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command", GAME_SUPPORTS_SAVE )
2274CONS( 1979, starwbcp, starwbc, 0, starwbc, starwbc, driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command (prototype)", GAME_SUPPORTS_SAVE )
2275CONS( 1979, starwbc,   0,        0, starwbc,   starwbc,   driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command", GAME_SUPPORTS_SAVE )
2276CONS( 1979, starwbcp,  starwbc,  0, starwbc,   starwbc,   driver_device, 0, "Kenner", "Star Wars - Electronic Battle Command (prototype)", GAME_SUPPORTS_SAVE )
22752277
2276CONS( 1977, comp4, 0, 0, comp4, comp4, driver_device, 0, "Milton Bradley", "Comp IV", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
2277CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", GAME_SUPPORTS_SAVE )
2278CONS( 1977, comp4,     0,        0, comp4,     comp4,     driver_device, 0, "Milton Bradley", "Comp IV", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
2279CONS( 1978, simon,     0,        0, simon,     simon,     driver_device, 0, "Milton Bradley", "Simon (Rev. A)", GAME_SUPPORTS_SAVE )
22782280
2279CONS( 1977, cnsector, 0, 0, cnsector, cnsector, driver_device, 0, "Parker Brothers", "Code Name: Sector", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
2280CONS( 1978, merlin, 0, 0, merlin, merlin, driver_device, 0, "Parker Brothers", "Merlin", GAME_SUPPORTS_SAVE )
2281CONS( 1979, stopthie,  0,        0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", GAME_SUPPORTS_SAVE )
2281CONS( 1977, cnsector,  0,        0, cnsector,  cnsector,  driver_device, 0, "Parker Brothers", "Code Name: Sector", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) // unplayable without writing board
2282CONS( 1978, merlin,    0,        0, merlin,    merlin,    driver_device, 0, "Parker Brothers", "Merlin", GAME_SUPPORTS_SAVE )
2283CONS( 1979, stopthie,  0,        0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", GAME_SUPPORTS_SAVE ) // unplayable without game board
22822284CONS( 1979, stopthiep, stopthie, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner) (prototype)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
2283CONS( 1980, bankshot, 0, 0, bankshot, bankshot, driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", GAME_SUPPORTS_SAVE )
2284CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE )
2285CONS( 1980, bankshot,  0,        0, bankshot,  bankshot,  driver_device, 0, "Parker Brothers", "Bank Shot - Electronic Pool", GAME_SUPPORTS_SAVE )
2286CONS( 1980, splitsec,  0,        0, splitsec,  splitsec,  driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE )
22852287
2286CONS( 1981, tandy12, 0, 0, tandy12, tandy12, driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", GAME_SUPPORTS_SAVE )
2288CONS( 1981, tandy12,   0,        0, tandy12,   tandy12,   driver_device, 0, "Tandy Radio Shack", "Tandy-12: Computerized Arcade", GAME_SUPPORTS_SAVE ) // partially unplayable without cards/dice/..
22872289
2288CONS( 1978, unk3403, 0, 0, unk3403, unk3403, driver_device, 0, "<unknown>", "unknown TMS1100 electronic game", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
2290CONS( 1978, unk3403,   0,        0, unk3403,   unk3403,  driver_device, 0, "<unknown>", "unknown TMS1100 electronic game", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/drivers/hh_ucom4.c
r244706r244707
134134
135135***************************************************************************/
136136
137// The device strobes the outputs very fast, it is unnoticeable to the user.
137// The device may strobe the outputs very fast, it is unnoticeable to the user.
138138// To prevent flickering here, we need to simulate a decay.
139139
140140void hh_ucom4_state::display_update()
r244706r244707
231231
232232  NOTE!: MESS external artwork is recommended
233233
234
235234***************************************************************************/
236235
237236WRITE8_MEMBER(hh_ucom4_state::edracula_grid_w)
r244706r244707
456455  - USA: Pac Man
457456  - UK: Puckman (Tomy), and also published by Grandstand as Munchman
458457  - Australia: Pac Man-1, published by Futuretronics
458 
459  The game will start automatically after turning it on. This Pac Man refuses
460  to eat dots with his butt, you can only eat them going right-to-left.
459461
460462  NOTE!: MESS external artwork is recommended
461463
r244706r244707
694696
695697
696698
697CONS( 1982, edracula, 0, 0, edracula, edracula, driver_device, 0, "Epoch", "Dracula (Epoch)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
699/*    YEAR  NAME       PARENT COMPAT MACHINE  INPUT     INIT              COMPANY, FULLNAME, FLAGS */
700CONS( 1982, edracula,  0,        0, edracula, edracula, driver_device, 0, "Epoch", "Dracula (Epoch)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
698701
699CONS( 1980, tmtennis, 0, 0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomy)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
700CONS( 1982, tmpacman, 0, 0, tmpacman, tmpacman, driver_device, 0, "Tomy", "Pac Man (Tomy)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
701CONS( 1984, alnchase, 0, 0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
702CONS( 1980, tmtennis,  0,        0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomy)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
703CONS( 1982, tmpacman,  0,        0, tmpacman, tmpacman, driver_device, 0, "Tomy", "Pac Man (Tomy)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
704CONS( 1984, alnchase,  0,        0, alnchase, alnchase, driver_device, 0, "Tomy", "Alien Chase", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK )
trunk/src/mess/layout/maniac.lay
r244706r244707
55
66   <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
77
8   <element name="digit" defstate="0">
9      <led7seg><color red="1.0" green="0.2" blue="0.2" /></led7seg>
10   </element>
811
12
13
914<!-- build screen -->
1015
1116   <view name="Internal Layout">
12      <bounds left="0" right="64" top="0" bottom="64" />
17      <bounds left="0" right="25" top="0" bottom="25" />
1318      <bezel element="static_black">
14         <bounds left="0" right="64" top="0" bottom="64" />
19         <bounds left="0" right="25" top="0" bottom="25" />
1520      </bezel>
1621
22      <bezel name="digit0" element="digit"><bounds x="2.5" y="5" width="10" height="15" /></bezel>
23      <bezel name="digit1" element="digit"><bounds x="12.5" y="5" width="10" height="15" /></bezel>
1724
25
1826   </view>
1927</mamelayout>


Previous 199869 Revisions Next


© 1997-2024 The MAME Team