Previous 199869 Revisions Next

r33700 Friday 5th December, 2014 at 23:21:03 UTC by hap
stopthie.c WIP (hmm i need to double check the romdump)
[src/mess/drivers]cnsector.c comp4.c simon.c starwbc.c stopthie.c ticalc1x.c
[src/mess/layout]stopthie.lay

trunk/src/mess/drivers/cnsector.c
r242211r242212
1010  Refer to the official manual for more information, it is not a simple game.
1111
1212
13  TODO:
14  - MCU clock is unknown
15
1316***************************************************************************/
1417
1518#include "emu.h"
r242211r242212
1720
1821#include "cnsector.lh"
1922
20
21// master clock is cpu internal, the value below is an approximation
23// master clock is unknown, the value below is an approximation
2224#define MASTER_CLOCK (250000)
2325
2426
trunk/src/mess/drivers/comp4.c
r242211r242212
1313  Refer to the official manual for more information.
1414
1515
16  TODO:
17  - MCU clock is unknown
18
1619***************************************************************************/
1720
1821#include "emu.h"
r242211r242212
2023
2124#include "comp4.lh"
2225
23
24// master clock is cpu internal, the value below is an approximation
26// master clock is unknown, the value below is an approximation
2527#define MASTER_CLOCK (250000)
2628
2729
trunk/src/mess/drivers/simon.c
r242211r242212
6565   // read selected button rows
6666   for (int i = 0; i < 4; i++)
6767   {
68      const int r[4] = { 0, 1, 2, 9 };
69      if (m_r >> r[i] & 1)
68      const int ki[4] = { 0, 1, 2, 9 };
69      if (m_r >> ki[i] & 1)
7070         k |= m_button_matrix[i]->read();
7171   }
7272
trunk/src/mess/drivers/starwbc.c
r242211r242212
1010  START TURN. Refer to the official manual for more information.
1111
1212
13  TODO:
14  - MCU clock is unknown
15
1316***************************************************************************/
1417
1518#include "emu.h"
r242211r242212
1821
1922#include "starwbc.lh"
2023
21
2224// master clock is unknown, the value below is an approximation
2325// (patent says R=51K, C=47pf, but then it sounds too low pitched)
2426#define MASTER_CLOCK (350000)
r242211r242212
142144   // read selected button rows
143145   for (int i = 0; i < 5; i++)
144146   {
145      const int r[5] = { 0, 1, 3, 5, 7 };
146      if (m_r >> r[i] & 1)
147      const int ki[5] = { 0, 1, 3, 5, 7 };
148      if (m_r >> ki[i] & 1)
147149         k |= m_button_matrix[i]->read();
148150   }
149151
trunk/src/mess/drivers/stopthie.c
r242211r242212
1// license:BSD-3-Clause
2// copyright-holders:hap
3/***************************************************************************
4
5  Parker Brothers Stop Thief
6  * MP0905BNL TMS0980NLL MP6101B (die labeled 0980B-01A)
7 
8  bla
9
10
11  TODO:
12  - ON/OFF button callbacks
13  - MCU clock is unknown
14
15***************************************************************************/
16
117#include "emu.h"
218#include "cpu/tms0980/tms0980.h"
19#include "sound/speaker.h"
320
4/* Layout */
521#include "stopthie.lh"
622
23// master clock is unknown, the value below is an approximation
24#define MASTER_CLOCK (350000)
725
8class stopthie_state : public driver_device
26
27class stopthief_state : public driver_device
928{
1029public:
11   stopthie_state(const machine_config &mconfig, device_type type, const char *tag)
12      : driver_device(mconfig, type, tag) ,
13      m_maincpu(*this, "maincpu") { }
30   stopthief_state(const machine_config &mconfig, device_type type, const char *tag)
31      : driver_device(mconfig, type, tag),
32      m_maincpu(*this, "maincpu"),
33      m_button_matrix(*this, "IN"),
34      m_speaker(*this, "speaker")
35   { }
1436
15   DECLARE_READ8_MEMBER(stopthie_read_k);
16   DECLARE_WRITE16_MEMBER(stopthie_write_o);
17   DECLARE_WRITE16_MEMBER(stopthie_write_r);
1837   required_device<cpu_device> m_maincpu;
38   required_ioport_array<3> m_button_matrix;
39   required_device<speaker_sound_device> m_speaker;
40
41   UINT16 m_r;
42   UINT16 m_o;
43
44   UINT16 m_leds_state[0x10];
45   UINT16 m_leds_cache[0x10];
46   UINT8 m_leds_decay[0x100];
47
48   DECLARE_READ8_MEMBER(read_k);
49   DECLARE_WRITE16_MEMBER(write_o);
50   DECLARE_WRITE16_MEMBER(write_r);
51
52   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
53   void leds_update();
54
55   virtual void machine_start();
1956};
2057
2158
2259
23#define LOG 1
60/***************************************************************************
2461
25static INPUT_PORTS_START( stopthie )
26INPUT_PORTS_END
62  LEDs
2763
64***************************************************************************/
2865
29READ8_MEMBER(stopthie_state::stopthie_read_k)
30{
31   UINT8 data = 0;
66// The device strobes the outputs very fast, it is unnoticeable to the user.
67// To prevent flickering here, we need to simulate a decay.
3268
33   if (LOG)
34      logerror( "stopthie_read_k\n" );
69// decay time, in steps of 10ms
70#define LEDS_DECAY_TIME 4
3571
36   return data;
72void stopthief_state::leds_update()
73{
74   UINT16 active_state[0x10];
75   
76   for (int i = 0; i < 0x10; i++)
77   {
78      active_state[i] = 0;
79     
80      for (int j = 0; j < 0x10; j++)
81      {
82         int di = j << 4 | i;
83         
84         // turn on powered leds
85         if (m_leds_state[i] >> j & 1)
86            m_leds_decay[di] = LEDS_DECAY_TIME;
87         
88         // determine active state
89         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
90         active_state[i] |= (ds << j);
91      }
92   }
93   
94   // on difference, send to output
95   for (int i = 0; i < 0x10; i++)
96      if (m_leds_cache[i] != active_state[i])
97         output_set_digit_value(i, active_state[i]);
98   
99   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
37100}
38101
102TIMER_DEVICE_CALLBACK_MEMBER(stopthief_state::leds_decay_tick)
103{
104   // slowly turn off unpowered leds
105   for (int i = 0; i < 0x100; i++)
106      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
107         m_leds_decay[i]--;
108   
109   leds_update();
110}
39111
40WRITE16_MEMBER(stopthie_state::stopthie_write_o)
112
113
114/***************************************************************************
115
116  I/O
117
118***************************************************************************/
119
120READ8_MEMBER(stopthief_state::read_k)
41121{
42   if (LOG)
43      logerror( "stopthie_write_o: write %02x\n", data );
122   // the Vss row is always on
123   UINT8 k = m_button_matrix[2]->read();
124
125   // read selected button rows
126   for (int i = 0; i < 2; i++)
127   {
128      const int ki[2] = { 0, 6 };
129      if (m_o >> ki[i] & 1)
130         k |= m_button_matrix[i]->read();
131   }
132
133   return k;
44134}
45135
136WRITE16_MEMBER(stopthief_state::write_r)
137{
138   // R0-R2: select digit
139   UINT8 o = BITSWAP8(m_o,3,5,0,6,7,2,1,4) & 0x7f;
140   for (int i = 0; i < 10; i++)
141      m_leds_state[i] = (data >> i & 1) ? o : 0;
142   
143   leds_update();
144   
145   // R3-..: sound
46146
47WRITE16_MEMBER(stopthie_state::stopthie_write_r)
147
148   m_r = data;
149}
150
151WRITE16_MEMBER(stopthief_state::write_o)
48152{
49   if (LOG)
50      logerror( "stopthie_write_r: write %04x\n", data );
153   // O0,O6: input mux
154   // O3: sound on
155   // O0-O2,O4-O7: led segments A-G
156   m_o = data;
51157}
52158
53159
54160
161/***************************************************************************
55162
163  Inputs
56164
57static MACHINE_CONFIG_START( stopthie, stopthie_state )
165***************************************************************************/
58166
167/* physical button layout and labels is like this:
168
169    [1] [2] [OFF]
170    [3] [4] [ON]
171    [5] [6] [T, TIP]
172    [7] [8] [A, ARREST]
173    [9] [0] [C, CLUE]
174*/
175
176static INPUT_PORTS_START( stopthief )
177   PORT_START("IN.0") // O0
178   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
179   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
180   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
181   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
182   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
183
184   PORT_START("IN.1") // O6
185   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
186   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
187   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
188   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
189   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
190
191   // note: even though power buttons are on the matrix, they are not CPU-controlled
192   PORT_START("IN.2") // Vss!
193   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGUP) PORT_NAME("On")
194   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Tip")
195   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_NAME("Arrest")
196   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_NAME("Clue")
197   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off")
198INPUT_PORTS_END
199
200
201
202/***************************************************************************
203
204  Machine Config
205
206***************************************************************************/
207
208void stopthief_state::machine_start()
209{
210   memset(m_leds_state, 0, sizeof(m_leds_state));
211   memset(m_leds_cache, 0, sizeof(m_leds_cache));
212   memset(m_leds_decay, 0, sizeof(m_leds_decay));
213   m_r = 0;
214   m_o = 0;
215
216   save_item(NAME(m_leds_state));
217   save_item(NAME(m_leds_cache));
218   save_item(NAME(m_leds_decay));
219   save_item(NAME(m_r));
220   save_item(NAME(m_o));
221}
222
223
224static MACHINE_CONFIG_START( stopthief, stopthief_state )
225
59226   /* basic machine hardware */
60   MCFG_CPU_ADD( "maincpu", TMS0980, 500000 ) /* Clock is wrong */
61   MCFG_TMS1XXX_READ_K_CB( READ8( stopthie_state, stopthie_read_k ) )
62   MCFG_TMS1XXX_WRITE_O_CB( WRITE16( stopthie_state, stopthie_write_o ) )
63   MCFG_TMS1XXX_WRITE_R_CB( WRITE16( stopthie_state, stopthie_write_r ) )
227   MCFG_CPU_ADD("maincpu", TMS0980, MASTER_CLOCK)
228   MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k))
229   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o))
230   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r))
64231
232   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", stopthief_state, leds_decay_tick, attotime::from_msec(10))
233   
65234   MCFG_DEFAULT_LAYOUT(layout_stopthie)
235
236   /* no video! */
237
238   /* sound hardware */
239   MCFG_SPEAKER_STANDARD_MONO("mono")
240   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
241   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
66242MACHINE_CONFIG_END
67243
68ROM_START( stopthie )
69   ROM_REGION( 0x1000, "maincpu", 0 )
70   ROM_LOAD16_WORD( "stopthie.bin", 0x0000, 0x1000, CRC(03691115) SHA1(bdcd212aa50bb1c26cb2d0ee97e5cfc04841c108) )
71244
72   ROM_REGION( 1246, "maincpu:ipla", ROMREGION_ERASE00 )
73   ROM_REGION( 1982, "maincpu:mpla", ROMREGION_ERASE00 )
74   ROM_REGION( 352, "maincpu:opla", ROMREGION_ERASE00 )
75   ROM_REGION( 157, "maincpu:spla", ROMREGION_ERASE00 )
76ROM_END
77245
78246/***************************************************************************
79247
r242211r242212
81249
82250***************************************************************************/
83251
84/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT   INIT    COMPANY            FULLNAME      FLAGS */
85CONS( 1979, stopthie,   0,      0,      stopthie,   stopthie, driver_device,  0,      "Parker Brothers", "Stop Thief", GAME_NOT_WORKING | GAME_NO_SOUND)
252ROM_START( stopthie )
253   ROM_REGION( 0x1000, "maincpu", 0 )
254   ROM_LOAD( "tms0980nll_mp6101b", 0x0000, 0x1000, CRC(5b4114af) SHA1(30a9b20dd5f0d57ed34c53e46f5adbf959d47828) )
255
256   ROM_REGION( 1246, "maincpu:ipla", 0 )
257   ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) )
258   ROM_REGION( 1982, "maincpu:mpla", 0 )
259   ROM_LOAD( "tms0980_default_mpla.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) )
260   ROM_REGION( 352, "maincpu:opla", 0 )
261   ROM_LOAD( "tms0980_stopthie_opla.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) )
262   ROM_REGION( 157, "maincpu:spla", 0 )
263   ROM_LOAD( "tms0980_stopthie_spla.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) )
264ROM_END
265
266ROM_START( stopthiep )
267   ROM_REGION( 0x1000, "maincpu", 0 )
268   ROM_LOAD16_WORD( "us4341385", 0x0000, 0x1000, CRC(03691115) SHA1(bdcd212aa50bb1c26cb2d0ee97e5cfc04841c108) ) // from patent US4341385, data should be correct (it included checksums)
269   // TODO: put in 0980 proper order
270
271   ROM_REGION( 1246, "maincpu:ipla", 0 )
272   ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) )
273   ROM_REGION( 1982, "maincpu:mpla", 0 )
274   ROM_LOAD( "tms0980_default_mpla.pla", 0, 1982, CRC(3709014f) SHA1(d28ee59ded7f3b9dc3f0594a32a98391b6e9c961) )
275   ROM_REGION( 352, "maincpu:opla", 0 )
276   ROM_LOAD( "tms0980_stopthie_opla.pla", 0, 352, CRC(50337a48) SHA1(4a9ea62ed797a9ac5190eec3bb6ebebb7814628c) )
277   ROM_REGION( 157, "maincpu:spla", 0 )
278   ROM_LOAD( "tms0980_stopthie_spla.pla", 0, 157, CRC(399aa481) SHA1(72c56c58fde3fbb657d69647a9543b5f8fc74279) )
279ROM_END
280
281
282CONS( 1979, stopthie,  0,        0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
283CONS( 1979, stopthiep, stopthie, 0, stopthief, stopthief, driver_device, 0, "Parker Brothers", "Stop Thief (Electronic Crime Scanner) (prototype)", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/drivers/ticalc1x.c
r242211r242212
99 
1010  TODO:
1111  - ON/OFF button callbacks, and support OFF callback from the 0980
12  - CPU clocks are unknown
12  - MCU clocks are unknown
1313
14
1514***************************************************************************/
1615
1716#include "emu.h"
r242211r242212
136135      if (m_r >> i & 1)
137136         m_leds_state[i] = m_o;
138137   
139   // exponent sign
138   // exponent sign (not 100% sure this is correct)
140139   m_leds_state[11] = (m_leds_state[0] | m_leds_state[1]) ? 0x40 : 0;
141140
142141   // send to output
r242211r242212
250249
251250READ8_MEMBER(ticalc1x_state::ti30_read_k)
252251{
253   // the top row is always on
252   // the Vss row is always on
254253   UINT8 k = m_button_matrix[8]->read();
255254
256255   // read selected button rows
trunk/src/mess/layout/stopthie.lay
r242211r242212
11<?xml version="1.0"?>
22<mamelayout version="2">
33
4   <element name="digit" defstate="0">
5      <led7seg><color red="1.0" green="0.22" blue="0.18" /></led7seg>
6   </element>
7
48   <view name="Internal Layout">
59      <bounds left="0" right="200" top="0" bottom="200" />
610
11      <bezel name="digit0" element="digit">
12         <bounds x="0" y="0" width="10" height="15" />
13      </bezel>
14      <bezel name="digit1" element="digit">
15         <bounds x="20" y="0" width="10" height="15" />
16      </bezel>
17      <bezel name="digit2" element="digit">
18         <bounds x="30" y="0" width="10" height="15" />
19      </bezel>
20
721   </view>
822</mamelayout>


Previous 199869 Revisions Next


© 1997-2024 The MAME Team