Previous 199869 Revisions Next

r36712 Friday 27th March, 2015 at 13:36:13 UTC by Miodrag Milanović
fixed OSX build with Clang on 10.7.x (nw)
Removed internal CC and LD  settings since it's not
needed and can be overwritten  externally now
[/trunk]makefile
[scripts]genie.lua toolchain.lua
[src/mame/drivers]ttchamp.c
[src/mess/drivers]hh_hmcs40.c hh_pic16.c hh_tms1k.c hh_ucom4.c mbdtower.c ticalc1x.c tispeak.c
[src/mess/includes]hh_tms1k.h

trunk/makefile
r245223r245224
154154
155155
156156PYTHON = @python
157CC = @gcc
158LD = @g++
159157
160158#-------------------------------------------------
161159# distribution may change things
r245223r245224
167165ifeq ($(DISTRO),debian-stable)
168166else
169167ifeq ($(DISTRO),ubuntu-intrepid)
170# Force gcc-4.2 on ubuntu-intrepid
171CC = @gcc -V 4.2
172LD = @g++-4.2
173168else
174169ifeq ($(DISTRO),gcc44-generic)
175CC = @gcc-4.4
176LD = @g++-4.4
177170else
178171ifeq ($(DISTRO),gcc45-generic)
179CC = @gcc-4.5
180LD = @g++-4.5
181172else
182173ifeq ($(DISTRO),gcc46-generic)
183CC = @gcc-4.6
184LD = @g++-4.6
185174else
186175ifeq ($(DISTRO),gcc47-generic)
187CC = @gcc-4.7
188LD = @g++-4.7
189176else
190177$(error DISTRO $(DISTRO) unknown)
191178endif
r245223r245224
313300PYTHON_AVAILABLE:=$(shell python --version > /dev/null 2>&1 && echo python)
314301CHECK_CLANG:=$(shell gcc --version  2> /dev/null | grep 'clang' | head -n 1)
315302endif
316ifneq ($(CHECK_CLANG),)
303
304ifeq ($(TARGETOS),macosx)
305ifneq (,$(findstring 3.,$(CLANG_VERSION)))
317306ifeq ($(ARCHITECTURE),x64)
318307ARCHITECTURE=x64_clang
319308else
320309ARCHITECTURE=x86_clang
321310endif
322311endif
312endif
313
323314ifneq ($(PYTHON_AVAILABLE),python)
324315$(error Python is not available in path)
325316endif
trunk/scripts/genie.lua
r245223r245224
535535            "-Wno-dynamic-class-memaccess",
536536            "-Wno-self-assign-field",
537537         }
538         
538         if (version >= 30200) then
539            buildoptions {
540               "-Wno-unused-value",
541            }
542         end   
539543         if (version >= 30400) then
540544            buildoptions {
541545               "-Wno-inline-new-delete",
trunk/scripts/toolchain.lua
r245223r245224
259259      end
260260
261261      if "osx-clang" == _OPTIONS["gcc"] then
262         premake.gcc.cc  = "clang"
263         premake.gcc.cxx = "clang++"
264         premake.gcc.ar  = "ar"
262265         location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang")
263266      end
264267
trunk/src/mame/drivers/ttchamp.c
r245223r245224
5858
5959Notes
6060I think the PIC is used to interface with battry backed RAM instead of an EEPROM,
61we currently simulate this as the PIC is read protected.
61we currently attempt to simulate this as the PIC is read protected.
6262
6363
6464
r245223r245224
264264//   printf("%06x: read from PIC (%04x)\n", space.device().safe_pc(),mem_mask);
265265   if (picmodex == PIC_SET_READLATCH)
266266   {
267//      printf("read data %02x from %02x\n", m_pic_latched, m_pic_readaddr);
267      printf("read data %02x from %02x\n", m_pic_latched, m_pic_readaddr);
268268      picmodex = PIC_IDLE;
269      return m_pic_latched;
269270
270      return m_pic_latched << 8;
271
272271   }
273272   return 0x00;
274273
r245223r245224
298297      {
299298         picmodex = PIC_IDLE;
300299         m_bakram[m_pic_writeaddr] = m_pic_writelatched;
301   //      printf("wrote %02x to %02x\n", m_pic_writelatched, m_pic_writeaddr);
300         printf("wrote %02x to %02x\n", m_pic_writelatched, m_pic_writeaddr);
302301      }
303302      else if (data == 0x22) // next data to latch
304303      {
305         // why does it read twice as many addresses, forcing us to shift the
306         // address by 1 to give correct results? maybe it can read 'previous' data' too?
307         m_pic_latched = m_bakram[m_pic_readaddr>>1];
308
304         m_pic_latched = m_bakram[m_pic_readaddr];
309305//         printf("latch read data %02x from %02x\n",m_pic_latched, m_pic_readaddr );
310306         picmodex = PIC_SET_READLATCH; // waiting to read...
311307      }
r245223r245224
676672
677673DRIVER_INIT_MEMBER(ttchamp_state,ttchamp)
678674{
675//  UINT8 *ROM1 = memregion("user1")->base();
676//  membank("bank1")->set_base(&ROM1[0x100000]);
677//  membank("bank2")->set_base(&ROM1[0x180000]);
679678}
680679
681// only the graphics differ between the two sets, code section is the same
682680GAME( 1995, ttchamp, 0,        ttchamp, ttchamp, ttchamp_state, ttchamp, ROT0,  "Gamart",                               "Table Tennis Champions", 0 ) // this has various advertising boards, including 'Electronic Devices' and 'Deniam'
683681GAME( 1995, ttchampa,ttchamp,  ttchamp, ttchamp, ttchamp_state, ttchamp, ROT0,  "Gamart (Palencia Elektronik license)", "Table Tennis Champions (Palencia Elektronik license)", 0 ) // this only has Palencia Elektronik advertising boards
trunk/src/mess/drivers/hh_hmcs40.c
r245223r245224
8989
9090   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
9191   void display_update();
92   void set_display_size(int maxx, int maxy);
9392   void display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety);
9493
9594   // game-specific handlers
r245223r245224
200199   display_update();
201200}
202201
203void hh_hmcs40_state::set_display_size(int maxx, int maxy)
202void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety)
204203{
205204   m_display_maxx = maxx;
206205   m_display_maxy = maxy;
207}
208206
209void hh_hmcs40_state::display_matrix(int maxx, int maxy, UINT64 setx, UINT32 sety)
210{
211   set_display_size(maxx, maxy);
212
213207   // update current state
214208   UINT64 mask = (1 << maxx) - 1;
215209   for (int y = 0; y < maxy; y++)
trunk/src/mess/drivers/hh_pic16.c
r245223r245224
6565
6666   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
6767   void display_update();
68   void set_display_size(int maxx, int maxy);
6968   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
7069
7170   // game-specific handlers
r245223r245224
163162   display_update();
164163}
165164
166void hh_pic16_state::set_display_size(int maxx, int maxy)
165void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
167166{
168167   m_display_maxx = maxx;
169168   m_display_maxy = maxy;
170}
171169
172void hh_pic16_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
173{
174   set_display_size(maxx, maxy);
175
176170   // update current state
177171   UINT32 mask = (1 << maxx) - 1;
178172   for (int y = 0; y < maxy; y++)
r245223r245224
210204   m_speaker->level_w((m_b >> 7 & 1) | (m_c >> 6 & 2));
211205
212206   // d0-d6: 7seg
207   m_display_maxx = 7;
208   m_display_maxy = 2;
209
213210   m_display_segmask[offset] = 0x7f;
214211   m_display_state[offset] = ~data & 0x7f;
215
216   set_display_size(7, 2);
217212   display_update();
218213}
219214
trunk/src/mess/drivers/hh_tms1k.c
r245223r245224
194194   display_update();
195195}
196196
197void hh_tms1k_state::set_display_size(int maxx, int maxy)
197void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
198198{
199199   m_display_maxx = maxx;
200200   m_display_maxy = maxy;
201}
202201
203void hh_tms1k_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
204{
205   set_display_size(maxx, maxy);
206
207202   // update current state
208203   UINT32 mask = (1 << maxx) - 1;
209204   for (int y = 0; y < maxy; y++)
r245223r245224
275270
276271void hh_tms1k_state::mathmagi_display()
277272{
273   m_display_maxx = 8;
274   m_display_maxy = 11;
275
278276   // R0-R7: 7seg leds
279277   for (int y = 0; y < 8; y++)
280278   {
r245223r245224
288286   for (int y = 8; y < 11; y++)
289287      m_display_state[y] = (m_r >> y & 1) ? m_o : 0;
290288
291   set_display_size(8, 11);
292289   display_update();
293290}
294291
r245223r245224
436433
437434void hh_tms1k_state::amaztron_display()
438435{
436   m_display_maxx = 8;
437   m_display_maxy = 3;
438
439439   // R8,R9: select digit
440440   for (int y = 0; y < 2; y++)
441441   {
r245223r245224
446446   // R6,R7: lamps (-> lamp20,21)
447447   m_display_state[2] = m_r >> 6 & 3;
448448
449   set_display_size(8, 3);
450449   display_update();
451450}
452451
r245223r245224
961960
962961void hh_tms1k_state::ebball3_display()
963962{
963   m_display_maxx = 7;
964   m_display_maxy = 10+2;
965
964966   // update current state
965967   for (int y = 0; y < 10; y++)
966968      m_display_state[y] = (m_r >> y & 1) ? m_o : 0;
r245223r245224
973975   m_display_state[11] = ((m_display_state[4] & 0x10) | (m_display_state[7] & 0x01)) << 1;
974976   m_display_segmask[10] = m_display_segmask[11] = 0x22;
975977
976   set_display_size(7, 10+2);
977978   display_update();
978979}
979980
r245223r245224
16111612
16121613WRITE16_MEMBER(hh_tms1k_state::cnsector_write_r)
16131614{
1615   m_display_maxx = 8;
1616   m_display_maxy = 7;
1617
16141618   // R0-R5: select digit (right-to-left)
16151619   for (int y = 0; y < 6; y++)
16161620   {
r245223r245224
16211625   // R6-R9: direction leds (-> lamp60-63)
16221626   m_display_state[6] = data >> 6 & 0xf;
16231627
1624   set_display_size(8, 7);
16251628   display_update();
16261629}
16271630
r245223r245224
18111814
18121815WRITE16_MEMBER(hh_tms1k_state::stopthief_write_r)
18131816{
1817   m_display_maxx = 7;
1818   m_display_maxy = 3;
1819
18141820   // R0-R2: select digit
18151821   UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f;
1816   for (int y = 0; y < 3; y++)
1822   for (int y = 0; y < m_display_maxy; y++)
18171823   {
18181824      m_display_segmask[y] = 0x7f;
18191825      m_display_state[y] = (data >> y & 1) ? o : 0;
18201826   }
18211827
1822   set_display_size(7, 3);
18231828   display_update();
18241829
18251830   // R3-R8: speaker on
trunk/src/mess/drivers/hh_ucom4.c
r245223r245224
7676
7777   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
7878   void display_update();
79   void set_display_size(int maxx, int maxy);
8079   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
8180
8281   // game-specific handlers
r245223r245224
208207   display_update();
209208}
210209
211void hh_ucom4_state::set_display_size(int maxx, int maxy)
210void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
212211{
213212   m_display_maxx = maxx;
214213   m_display_maxy = maxy;
215}
216214
217void hh_ucom4_state::display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety)
218{
219   set_display_size(maxx, maxy);
220
221215   // update current state
222216   UINT32 mask = (1 << maxx) - 1;
223217   for (int y = 0; y < maxy; y++)
trunk/src/mess/drivers/mbdtower.c
r245223r245224
6161void mbdtower_state::mbdtower_display()
6262{
6363   // declare display matrix size and the 2 7segs
64   set_display_size(7, 3);
64   m_display_maxx = 7;
65   m_display_maxy = 3;
6566   m_display_segmask[1] = m_display_segmask[2] = 0x7f;
6667
6768   // update current state
trunk/src/mess/drivers/ticalc1x.c
r245223r245224
22// copyright-holders:hap, Sean Riddle
33/***************************************************************************
44
5  ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) **
6
75  Texas Instruments TMS1xxx/0970/0980 handheld calculators (mostly single-chip)
86
97  Refer to their official manuals on how to use them.
r245223r245224
1513
1614***************************************************************************/
1715
18#include "includes/hh_tms1k.h"
16#include "emu.h"
17#include "cpu/tms0980/tms0980.h"
18#include "sound/speaker.h"
1919
2020// internal artwork
2121#include "ti1270.lh"
r245223r245224
2424#include "wizatron.lh"
2525
2626
27class ticalc1x_state : public hh_tms1k_state
27class ticalc1x_state : public driver_device
2828{
2929public:
3030   ticalc1x_state(const machine_config &mconfig, device_type type, const char *tag)
31      : hh_tms1k_state(mconfig, type, tag)
31      : driver_device(mconfig, type, tag),
32      m_maincpu(*this, "maincpu"),
33      m_inp_matrix(*this, "IN"),
34      m_speaker(*this, "speaker"),
35      m_display_wait(33),
36      m_display_maxy(1),
37      m_display_maxx(0)
3238   { }
3339
40   // devices
41   required_device<cpu_device> m_maincpu;
42   optional_ioport_array<11> m_inp_matrix; // max 11
43   optional_device<speaker_sound_device> m_speaker;
44
45   // misc common
46   UINT16 m_r;                         // MCU R-pins data
47   UINT16 m_o;                         // MCU O-pins data
48   UINT16 m_inp_mux;                   // multiplexed inputs mask
49   bool m_power_on;
50
51   UINT8 read_inputs(int columns);
52   DECLARE_INPUT_CHANGED_MEMBER(power_button);
53   DECLARE_WRITE_LINE_MEMBER(auto_power_off);
54
55   virtual void machine_reset();
56   virtual void machine_start();
57
58   // display common
59   int m_display_wait;                 // led/lamp off-delay in microseconds (default 33ms)
60   int m_display_maxy;                 // display matrix number of rows
61   int m_display_maxx;                 // display matrix number of columns
62
63   UINT32 m_display_state[0x20];       // display matrix rows data
64   UINT16 m_display_segmask[0x20];     // if not 0, display matrix row is a digit, mask indicates connected segments
65   UINT32 m_display_cache[0x20];       // (internal use)
66   UINT8 m_display_decay[0x20][0x20];  // (internal use)
67
68   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
69   void display_update();
3470   void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask);
3571
3672   // calculator-specific handlers
r245223r245224
5793   DECLARE_WRITE16_MEMBER(ti30_write_o);
5894   DECLARE_WRITE16_MEMBER(ti30_write_r);
5995   DECLARE_READ8_MEMBER(ti30_read_k);
60
61protected:
62   virtual void machine_start();
6396};
6497
6598
99// machine_start/reset
100
66101void ticalc1x_state::machine_start()
67102{
68   hh_tms1k_state::machine_start();
103   // zerofill
104   memset(m_display_state, 0, sizeof(m_display_state));
105   memset(m_display_cache, ~0, sizeof(m_display_cache));
106   memset(m_display_decay, 0, sizeof(m_display_decay));
69107   memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // !
108
109   m_o = 0;
110   m_r = 0;
111   m_inp_mux = 0;
112   m_power_on = false;
113
114   // register for savestates
115   save_item(NAME(m_display_maxy));
116   save_item(NAME(m_display_maxx));
117   save_item(NAME(m_display_wait));
118
119   save_item(NAME(m_display_state));
120   /* save_item(NAME(m_display_cache)); */ // don't save!
121   save_item(NAME(m_display_decay));
122   save_item(NAME(m_display_segmask));
123
124   save_item(NAME(m_o));
125   save_item(NAME(m_r));
126   save_item(NAME(m_inp_mux));
127   save_item(NAME(m_power_on));
70128}
71129
130void ticalc1x_state::machine_reset()
131{
132   m_power_on = true;
133}
134
135
136
137/***************************************************************************
138
139  Helper Functions
140
141***************************************************************************/
142
143// The device may strobe the outputs very fast, it is unnoticeable to the user.
144// To prevent flickering here, we need to simulate a decay.
145
146void ticalc1x_state::display_update()
147{
148   UINT32 active_state[0x20];
149
150   for (int y = 0; y < m_display_maxy; y++)
151   {
152      active_state[y] = 0;
153
154      for (int x = 0; x < m_display_maxx; x++)
155      {
156         // turn on powered segments
157         if (m_power_on && m_display_state[y] >> x & 1)
158            m_display_decay[y][x] = m_display_wait;
159
160         // determine active state
161         int ds = (m_display_decay[y][x] != 0) ? 1 : 0;
162         active_state[y] |= (ds << x);
163      }
164   }
165
166   // on difference, send to output
167   for (int y = 0; y < m_display_maxy; y++)
168      if (m_display_cache[y] != active_state[y])
169      {
170         if (m_display_segmask[y] != 0)
171            output_set_digit_value(y, active_state[y] & m_display_segmask[y]);
172
173         const int mul = (m_display_maxx <= 10) ? 10 : 100;
174         for (int x = 0; x < m_display_maxx; x++)
175         {
176            int state = active_state[y] >> x & 1;
177            output_set_lamp_value(y * mul + x, state);
178
179            // bit coords for svg2lay
180            char buf[10];
181            sprintf(buf, "%d.%d", y, x);
182            output_set_value(buf, state);
183         }
184      }
185
186   memcpy(m_display_cache, active_state, sizeof(m_display_cache));
187}
188
189TIMER_DEVICE_CALLBACK_MEMBER(ticalc1x_state::display_decay_tick)
190{
191   // slowly turn off unpowered segments
192   for (int y = 0; y < m_display_maxy; y++)
193      for (int x = 0; x < m_display_maxx; x++)
194         if (m_display_decay[y][x] != 0)
195            m_display_decay[y][x]--;
196
197   display_update();
198}
199
72200void ticalc1x_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask)
73201{
202   m_display_maxx = maxx;
203   m_display_maxy = maxy;
204
205   // update current state
206   UINT32 colmask = (1 << maxx) - 1;
74207   for (int y = 0; y < maxy; y++)
208   {
75209      m_display_segmask[y] &= segmask;
210      m_display_state[y] = (sety >> y & 1) ? (setx & colmask) : 0;
211   }
76212
77   display_matrix(maxx, maxy, setx, sety);
213   display_update();
78214}
79215
80216
217UINT8 ticalc1x_state::read_inputs(int columns)
218{
219   UINT8 ret = 0;
81220
221   // read selected input rows
222   for (int i = 0; i < columns; i++)
223      if (m_inp_mux >> i & 1)
224         ret |= m_inp_matrix[i]->read();
225
226   return ret;
227}
228
229
230// devices with a TMS0980 can auto power-off
231
232WRITE_LINE_MEMBER(ticalc1x_state::auto_power_off)
233{
234   if (state)
235   {
236      m_power_on = false;
237      m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
238   }
239}
240
241INPUT_CHANGED_MEMBER(ticalc1x_state::power_button)
242{
243   m_power_on = (bool)(FPTR)param;
244   m_maincpu->set_input_line(INPUT_LINE_RESET, m_power_on ? CLEAR_LINE : ASSERT_LINE);
245}
246
247
248
82249/***************************************************************************
83250
84251  Minidrivers (I/O, Inputs, Machine Config)
r245223r245224
102269   m_display_state[11] = m_display_state[10] << 5 & 0x40;
103270   m_display_state[10] &= 0x40;
104271   
105   set_display_size(8, 12);
272   m_display_maxx = 8;
273   m_display_maxy = 12;
106274   display_update();
107275}
108276
r245223r245224
204372   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, tisr16_write_o))
205373   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, tisr16_write_r))
206374
207   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
375   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
208376   MCFG_DEFAULT_LAYOUT(layout_tisr16)
209377
210378   /* no video! */
r245223r245224
380548   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti1270_write_o))
381549   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti1270_write_r))
382550
383   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
551   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
384552   MCFG_DEFAULT_LAYOUT(layout_ti1270)
385553
386554   /* no video! */
r245223r245224
464632   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, wizatron_write_o))
465633   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r))
466634
467   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
635   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
468636   MCFG_DEFAULT_LAYOUT(layout_wizatron)
469637
470638   /* no video! */
r245223r245224
524692   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof_write_o))
525693   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r))
526694
527   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
695   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
528696   MCFG_DEFAULT_LAYOUT(layout_wizatron)
529697
530698   /* no video! */
r245223r245224
538706
539707/***************************************************************************
540708
541  TI Little Professor (1978 version)
709  TI Little Professor (1978 version, same as 1980 version)
542710  * TMS1990 MCU labeled TMC1993NL. die labeled 1990C-c3C
543 
544  1978 re-release, with on/off and level select on buttons instead of
545  switches. The casing was slightly revised in 1980 again, but same rom.
546711
547712***************************************************************************/
548713
r245223r245224
561726   // 6th digit is a custom 7seg for math symbols (see wizatron_write_r)
562727   m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0);
563728
564   set_display_size(7, 9);
729   m_display_maxx = 7;
730   m_display_maxy = 9;
565731   display_update();
566732}
567733
r245223r245224
622788   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof78_write_o))
623789   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, lilprof78_write_r))
624790
625   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
791   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
626792   MCFG_DEFAULT_LAYOUT(layout_wizatron)
627793
628794   /* no video! */
r245223r245224
8571023   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti30_write_r))
8581024   MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(ticalc1x_state, auto_power_off))
8591025
860   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
1026   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", ticalc1x_state, display_decay_tick, attotime::from_msec(1))
8611027   MCFG_DEFAULT_LAYOUT(layout_ti30)
8621028
8631029   /* no video! */
trunk/src/mess/drivers/tispeak.c
r245223r245224
22// copyright-holders:hap, Lord Nightmare
33/***************************************************************************
44
5  ** subclass of hh_tms1k_state (includes/hh_tms1k.h, drivers/hh_tms1k.c) **
6
75  Texas Instruments 1st-gen. handheld speech devices,
86
97  These devices, mostly edu-toys, are based around an MCU(TMS0270/TMS1100),
r245223r245224
277275
278276***************************************************************************/
279277
280#include "includes/hh_tms1k.h"
278#include "emu.h"
279#include "cpu/tms0980/tms0980.h"
281280#include "sound/tms5110.h"
282281#include "machine/tms6100.h"
283282#include "bus/generic/slot.h"
284283#include "bus/generic/carts.h"
285284
286// internal artwork
287285#include "lantutor.lh"
288286#include "snspell.lh"
289287
r245223r245224
296294#define MASTER_CLOCK (640000)
297295
298296
299class tispeak_state : public hh_tms1k_state
297class tispeak_state : public driver_device
300298{
301299public:
302300   tispeak_state(const machine_config &mconfig, device_type type, const char *tag)
303      : hh_tms1k_state(mconfig, type, tag),
301      : driver_device(mconfig, type, tag),
302      m_maincpu(*this, "maincpu"),
304303      m_tms5100(*this, "tms5100"),
305304      m_tms6100(*this, "tms6100"),
306      m_cart(*this, "cartslot")
305      m_cart(*this, "cartslot"),
306      m_button_matrix(*this, "IN"),
307      m_display_wait(33),
308      m_display_maxy(1),
309      m_display_maxx(0)
307310   { }
308311
309312   // devices
313   required_device<tms0270_cpu_device> m_maincpu;
310314   required_device<tms5100_device> m_tms5100;
311315   required_device<tms6100_device> m_tms6100;
312316   optional_device<generic_slot_device> m_cart;
317   required_ioport_array<9> m_button_matrix;
313318
319   // misc common
320   UINT16 m_r;                         // MCU R-pins data
321   UINT16 m_o;                         // MCU O-pins data
322   int m_power_on;
323   int m_filament_on;
324
325   // display common
326   int m_display_wait;                 // led/lamp off-delay in microseconds (default 33ms)
327   int m_display_maxy;                 // display matrix number of rows
328   int m_display_maxx;                 // display matrix number of columns
329
330   UINT32 m_display_state[0x20];       // display matrix rows data
331   UINT16 m_display_segmask[0x20];     // if not 0, display matrix row is a digit, mask indicates connected segments
332   UINT32 m_display_cache[0x20];       // (internal use)
333   UINT8 m_display_decay[0x20][0x20];  // (internal use)
334
335   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
336   void display_update();
337   void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask);
338
314339   // cartridge
315340   UINT32 m_cart_max_size;
316341   UINT8* m_cart_base;
r245223r245224
324349   DECLARE_WRITE16_MEMBER(snspell_write_r);
325350   DECLARE_WRITE16_MEMBER(lantutor_write_r);
326351
327   DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button);
328   void snspell_power_off();
329   void snspell_display();
352   DECLARE_INPUT_CHANGED_MEMBER(power_button);
353   void power_off();
330354
331protected:
355   virtual void machine_reset();
332356   virtual void machine_start();
333357};
334358
r245223r245224
373397
374398/***************************************************************************
375399
376  I/O
400  VFD Display
377401
378402***************************************************************************/
379403
380// common/snspell
404// The device may strobe the outputs very fast, it is unnoticeable to the user.
405// To prevent flickering here, we need to simulate a decay.
381406
382void tispeak_state::snspell_display()
407void tispeak_state::display_update()
383408{
384   for (int y = 0; y < 16; y++)
385      m_display_segmask[y] = 0x3fff;
409   UINT32 active_state[0x20];
386410
387   display_matrix(16, 16, m_o, (m_r & 0x8000) ? (m_r & 0x21ff) : 0);
411   for (int y = 0; y < m_display_maxy; y++)
412   {
413      active_state[y] = 0;
414
415      for (int x = 0; x < m_display_maxx; x++)
416      {
417         // turn on powered segments
418         if (m_power_on && m_filament_on && m_display_state[y] >> x & 1)
419            m_display_decay[y][x] = m_display_wait;
420
421         // determine active state
422         int ds = (m_display_decay[y][x] != 0) ? 1 : 0;
423         active_state[y] |= (ds << x);
424      }
425   }
426
427   // on difference, send to output
428   for (int y = 0; y < m_display_maxy; y++)
429      if (m_display_cache[y] != active_state[y])
430      {
431         if (m_display_segmask[y] != 0)
432            output_set_digit_value(y, active_state[y] & m_display_segmask[y]);
433
434         const int mul = (m_display_maxx <= 10) ? 10 : 100;
435         for (int x = 0; x < m_display_maxx; x++)
436         {
437            int state = active_state[y] >> x & 1;
438            output_set_lamp_value(y * mul + x, state);
439
440            // bit coords for svg2lay
441            char buf[10];
442            sprintf(buf, "%d.%d", y, x);
443            output_set_value(buf, state);
444         }
445      }
446
447   memcpy(m_display_cache, active_state, sizeof(m_display_cache));
388448}
389449
450TIMER_DEVICE_CALLBACK_MEMBER(tispeak_state::display_decay_tick)
451{
452   // slowly turn off unpowered segments
453   for (int y = 0; y < m_display_maxy; y++)
454      for (int x = 0; x < m_display_maxx; x++)
455         if (m_display_decay[y][x] != 0)
456            m_display_decay[y][x]--;
457
458   display_update();
459}
460
461void tispeak_state::display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask)
462{
463   m_display_maxx = maxx;
464   m_display_maxy = maxy;
465
466   // update current state
467   UINT32 colmask = (1 << maxx) - 1;
468   for (int y = 0; y < maxy; y++)
469   {
470      m_display_segmask[y] &= segmask;
471      m_display_state[y] = (sety >> y & 1) ? (setx & colmask) : 0;
472   }
473
474   display_update();
475}
476
477
478
479/***************************************************************************
480
481  I/O
482
483***************************************************************************/
484
485// common/snspell
486
390487READ8_MEMBER(tispeak_state::snspell_read_k)
391488{
392   // note: the Vss row is always on
393   return m_inp_matrix[8]->read() | read_inputs(8);
489   // the Vss row is always on
490   UINT8 k = m_button_matrix[8]->read();
491
492   // read selected button rows
493   for (int i = 0; i < 8; i++)
494      if (m_r >> i & 1)
495         k |= m_button_matrix[i]->read();
496
497   return k;
394498}
395499
396500WRITE16_MEMBER(tispeak_state::snspell_write_r)
397501{
502   // R15: filament on
503   m_filament_on = data & 0x8000;
504
398505   // R13: power-off request, on falling edge
399506   if ((m_r >> 13 & 1) && !(data >> 13 & 1))
400      snspell_power_off();
507      power_off();
401508
402509   // R0-R7: input mux and select digit (+R8 if the device has 9 digits)
403   // R15: filament on
404510   // other bits: MCU internal use
405   m_r = m_inp_mux = data;
406   snspell_display();
511   m_r = data & 0x21ff;
512   display_matrix_seg(16, 16, m_o, m_r, 0x3fff);
407513}
408514
409515WRITE16_MEMBER(tispeak_state::snspell_write_o)
r245223r245224
411517   // reorder opla to led14seg, plus DP as d14 and AP as d15:
412518   // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK)
413519   m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
414   snspell_display();
520   display_matrix_seg(16, 16, m_o, m_r, 0x3fff);
415521}
416522
417523
418void tispeak_state::snspell_power_off()
524void tispeak_state::power_off()
419525{
420526   m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
421527   m_tms5100->reset();
422528   m_tms6100->reset();
423529
424   m_power_on = false;
530   m_power_on = 0;
425531}
426532
427533
r245223r245224
432538   // reorder opla to led14seg, plus DP as d14 and AP as d15:
433539   // [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK)
434540   m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15);
435   snspell_display();
541   display_matrix_seg(16, 16, m_o, m_r, 0x3fff);
436542}
437543
438544
r245223r245224
441547WRITE16_MEMBER(tispeak_state::lantutor_write_r)
442548{
443549   // same as default, except R13 is used for an extra digit
444   m_r = m_inp_mux = data;
445   snspell_display();
550   m_filament_on = data & 0x8000;
551   m_r = data & 0x21ff;
552   display_matrix_seg(16, 16, m_o, m_r, 0x3fff);
446553}
447554
448555
r245223r245224
453560
454561***************************************************************************/
455562
456INPUT_CHANGED_MEMBER(tispeak_state::snspell_power_button)
563INPUT_CHANGED_MEMBER(tispeak_state::power_button)
457564{
458565   int on = (int)(FPTR)param;
459566
460567   if (on && !m_power_on)
461568   {
462      m_power_on = true;
569      m_power_on = 1;
463570      m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
464571   }
465572   else if (!on && m_power_on)
466      snspell_power_off();
573      power_off();
467574}
468575
469576static INPUT_PORTS_START( snspell )
r245223r245224
524631   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Secret Code")
525632   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter")
526633   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Say It")
527   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Spell/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true)
634   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Spell/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, power_button, (void *)1)
528635INPUT_PORTS_END
529636
530637
r245223r245224
576683   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_NAME("Write It")
577684   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("Greater/Less")
578685   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_NAME("Word Problems")
579   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true)
686   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Solve It/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, power_button, (void *)1)
580687
581688   PORT_START("IN.7")
582689   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED )
r245223r245224
598705   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_NAME("Picture Read")
599706   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_NAME("Letter Stumper")
600707   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_NAME("Hear It")
601   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Word Zap/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, snspell_power_button, (void *)true)
708   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_PGUP) PORT_NAME("Word Zap/On") PORT_CHANGED_MEMBER(DEVICE_SELF, tispeak_state, power_button, (void *)1)
602709INPUT_PORTS_END
603710
604711
r245223r245224
639746
640747***************************************************************************/
641748
749void tispeak_state::machine_reset()
750{
751   m_power_on = 1;
752}
753
642754void tispeak_state::machine_start()
643755{
644   hh_tms1k_state::machine_start();
756   // zerofill
757   memset(m_display_state, 0, sizeof(m_display_state));
758   memset(m_display_cache, ~0, sizeof(m_display_cache));
759   memset(m_display_decay, 0, sizeof(m_display_decay));
760   memset(m_display_segmask, ~0, sizeof(m_display_segmask)); // !
645761
762   m_r = 0;
763   m_o = 0;
764   m_power_on = 0;
765   m_filament_on = 0;
766
767   // register for savestates
768   save_item(NAME(m_display_maxy));
769   save_item(NAME(m_display_maxx));
770   save_item(NAME(m_display_wait));
771
772   save_item(NAME(m_display_state));
773   /* save_item(NAME(m_display_cache)); */ // don't save!
774   save_item(NAME(m_display_decay));
775   save_item(NAME(m_display_segmask));
776
777   save_item(NAME(m_r));
778   save_item(NAME(m_o));
779   save_item(NAME(m_power_on));
780   save_item(NAME(m_filament_on));
781
646782   // init cartridge
647783   if (m_cart != NULL && m_cart->exists())
648784   {
r245223r245224
666802   MCFG_TMS0270_WRITE_CTL_CB(DEVWRITE8("tms5100", tms5100_device, ctl_w))
667803   MCFG_TMS0270_WRITE_PDC_CB(DEVWRITELINE("tms5100", tms5100_device, pdc_w))
668804
669   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1))
805   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", tispeak_state, display_decay_tick, attotime::from_msec(1))
670806   MCFG_DEFAULT_LAYOUT(layout_snspell) // max 9 digits
671807
672808   /* no video! */
trunk/src/mess/includes/hh_tms1k.h
r245223r245224
3030
3131   // devices
3232   required_device<cpu_device> m_maincpu;
33   optional_ioport_array<11> m_inp_matrix; // max 11
33   optional_ioport_array<7> m_inp_matrix; // max 7
3434   optional_device<speaker_sound_device> m_speaker;
3535
3636   // misc common
r245223r245224
5555
5656   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
5757   void display_update();
58   void set_display_size(int maxx, int maxy);
5958   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
6059
6160   // game-specific handlers


Previous 199869 Revisions Next


© 1997-2024 The MAME Team