Previous 15994 Revisions Next

r14637 Sunday 26th February, 2012 at 10:58:31 UTC by Sandro Ronco
z88: moved uPD65031 emulation into a device and fixed keyboard input. [Sandro Ronco]
[src/mess]mess.mak
[src/mess/drivers]z88.c
[src/mess/includes]z88.h
[src/mess/machine]upd65031.c* upd65031.h*
[src/mess/video]z88.c

src/mess/machine/upd65031.c
r0r14637
1/**********************************************************************
2
3    NEC uPD65031 'BLINK' emulation
4
5    the uPD65031 manages almost everything in the Z88:
6    - memory bankswitch
7    - interrupts
8    - RTC
9    - LCD
10    - keyboard
11    - serial
12    - speaker
13
14    TODO:
15    - coma and snooze mode
16    - speaker controlled by constant tone or txd
17    - EPROM programming
18    - UART
19
20*********************************************************************/
21
22
23#include "upd65031.h"
24
25
26// device type definition
27const device_type UPD65031 = &device_creator<upd65031_device>;
28
29
30//**************************************************************************
31//  MACROS / CONSTANTS
32//**************************************************************************
33
34#define LOG 1
35
36// internal registers
37enum
38{
39   // write registers
40   REG_PB0  = 0x70,      // pixel base 0
41   REG_PB1  = 0x71,      // pixel base 1
42   REG_PB2  = 0x72,      // pixel base 2
43   REG_PB3  = 0x73,      // pixel base 3
44   REG_SBR  = 0x74,      // screen base register
45
46   REG_COM  = 0xb0,      // command register
47   REG_INT  = 0xb1,      // interrupt control
48   REG_EPR  = 0xb3,      // EPROM programming
49   REG_TACK = 0xb4,      // RTC acknowledge
50   REG_TMK  = 0xb5,      // RTC interrupt mask
51   REG_ACK  = 0xb6,      // interrupt acknowledge
52
53   REG_SR0  = 0xd0,      // segment register 0
54   REG_SR1  = 0xd1,      // segment register 1
55   REG_SR2  = 0xd2,      // segment register 2
56   REG_SR3  = 0xd3,      // segment register 3
57
58   REG_RXC  = 0xe2,      // UART receiver control
59   REG_TXD  = 0xe3,      // UART transmit data
60   REG_TXC  = 0xe4,      // UART transmit control
61   REG_UMK  = 0xe5,      // UART interrupt mask
62   REG_UAK  = 0xe6,      // UART interrupt acknowledge
63
64
65   // read registers
66   REG_STA  = 0xb1,      // interrupt status
67   REG_KBD  = 0xb2,      // keyboard read
68   REG_TSTA = 0xb5,      // RTC interrupt status
69
70   REG_TIM0 = 0xd0,      // RTC 5ms counter
71   REG_TIM1 = 0xd1,      // RTC seconds counter (6 bits)
72   REG_TIM2 = 0xd2,      // RTC minutes counter
73   REG_TIM3 = 0xd3,      // RTC minutes/256 counter
74   REG_TIM4 = 0xd4,      // RTC minutes/65536 counter (5 bits)
75
76   REG_RXD  = 0xe0,      // UART receive data register
77   REG_RXE  = 0xe1,      // UART extended receiver data
78   REG_UIT  = 0xe5,      // UART interrupt status
79};
80
81//mode
82enum
83{
84   STATE_AWAKE = 0,
85   STATE_SNOOZE,
86   STATE_COMA
87};
88
89// interrupt status
90#define STA_FLAPOPEN      0x80
91#define STA_A19            0x40
92#define STA_FLAP         0x20
93#define STA_UART         0x10
94#define STA_BTL            0x08
95#define STA_KEY            0x04
96#define STA_TIME         0x01
97
98// interrupt control
99#define INT_KWAIT         0x80
100#define INT_A19            0x40
101#define INT_FLAP         0x20
102#define INT_UART         0x10
103#define INT_BTL            0x08
104#define INT_KEY            0x04
105#define INT_TIME         0x02
106#define INT_GINT         0x01
107
108// command register
109#define COM_SRUN         0x80
110#define COM_SBIT         0x40
111#define COM_OVERP         0x20
112#define COM_RESTIM         0x10
113#define COM_PROGRAM         0x08
114#define COM_RAMS         0x04
115#define COM_VPPON         0x02
116#define COM_LCDON         0x01
117
118// EPROM programming register
119#define EPR_PD1            0x80
120#define EPR_PD0            0x40
121#define EPR_PGMD         0x20
122#define EPR_EOED         0x10
123#define EPR_SE3D         0x08
124#define EPR_PGMP         0x04
125#define EPR_EOEP         0x02
126#define EPR_SE3P         0x01
127
128// RTC interrupt status
129#define TSTA_MIN         0x04
130#define TSTA_SEC         0x02
131#define TSTA_TICK         0x01
132
133//**************************************************************************
134//  INLINE HELPERS
135//**************************************************************************
136
137inline void upd65031_device::interrupt_refresh()
138{
139   if ((m_int & INT_GINT) && ((m_int & m_sta & 0x7c) || ((m_int & INT_TIME) && (m_sta & STA_TIME))))
140   {
141      if (LOG) logerror("uPD65031 '%s': set int\n", tag());
142
143      m_out_int_func(ASSERT_LINE);
144   }
145   else
146   {
147      if (LOG) logerror("uPD65031 '%s': clear int\n", tag());
148
149      m_out_int_func(CLEAR_LINE);
150   }
151}
152
153
154inline void upd65031_device::update_rtc_interrupt()
155{
156   // any ints occurred?
157   if ((m_int & INT_TIME) && (m_tsta & (TSTA_MIN | TSTA_SEC | TSTA_TICK)))
158      m_sta |= STA_TIME;
159   else
160      m_sta &= ~STA_TIME;
161}
162
163
164inline void upd65031_device::set_mode(int mode)
165{
166   if (m_mode != mode)
167   {
168      m_mode = mode;
169
170      switch(mode)
171      {
172      case STATE_AWAKE:
173         //TODO
174         break;
175      case STATE_SNOOZE:
176         //TODO
177         break;
178      case STATE_COMA:
179         //TODO
180         break;
181      }
182   }
183}
184
185
186//**************************************************************************
187//  LIVE DEVICE
188//**************************************************************************
189
190//-------------------------------------------------
191//  upd65031_device - constructor
192//-------------------------------------------------
193
194upd65031_device::upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
195   : device_t(mconfig, UPD65031, "NEC uPD65031", tag, owner, clock)
196{
197}
198
199
200//-------------------------------------------------
201//  device_config_complete - perform any
202//  operations now that the configuration is
203//  complete
204//-------------------------------------------------
205
206void upd65031_device::device_config_complete()
207{
208   // inherit a copy of the static data
209   const upd65031_interface *intf = reinterpret_cast<const upd65031_interface *>(static_config());
210   if (intf != NULL)
211   {
212      *static_cast<upd65031_interface *>(this) = *intf;
213   }
214   // or initialize to defaults if none provided
215   else
216   {
217      m_screen_update_cb = NULL;
218      m_out_mem_cb = NULL;
219      memset(&m_in_kb_cb, 0, sizeof(m_in_kb_cb));
220      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
221      memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
222      memset(&m_out_spkr_cb, 0, sizeof(m_out_spkr_cb));
223   }
224}
225
226
227//-------------------------------------------------
228//  device_start - device-specific startup
229//-------------------------------------------------
230
231void upd65031_device::device_start()
232{
233   // resolve callbacks
234   m_out_int_func.resolve(m_out_int_cb, *this);
235   m_out_nmi_func.resolve(m_out_nmi_cb, *this);
236   m_out_spkr_func.resolve(m_out_spkr_cb, *this);
237   m_int_kb_func.resolve(m_in_kb_cb, *this);
238
239   // allocate timers
240   m_rtc_timer = timer_alloc(TIMER_RTC);
241   m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5));
242
243   // state saving
244   save_item(NAME(m_mode));
245   save_item(NAME(m_lcd_regs));
246   save_item(NAME(m_tim));
247   save_item(NAME(m_sr));
248   save_item(NAME(m_sta));
249   save_item(NAME(m_int));
250   save_item(NAME(m_ack));
251   save_item(NAME(m_tsta));
252   save_item(NAME(m_tmk));
253   save_item(NAME(m_tack));
254   save_item(NAME(m_com));
255}
256
257
258//-------------------------------------------------
259//  device_reset - device-specific reset
260//-------------------------------------------------
261
262void upd65031_device::device_reset()
263{
264   memset(m_lcd_regs, 0, sizeof(m_lcd_regs));
265   memset(m_tim, 0, sizeof(m_tim));
266   memset(m_sr, 0, sizeof(m_sr));
267   m_sta = 0;
268   m_int = 0;
269   m_ack = 0;
270   m_tsta = 0;
271   m_tmk = TSTA_TICK | TSTA_SEC | TSTA_MIN;
272   m_tack = 0;
273   m_com = 0;
274   set_mode(STATE_AWAKE);
275
276   if (m_out_mem_cb)
277   {
278      // reset bankswitch
279      (m_out_mem_cb)(*this, 0, 0, 0);
280      (m_out_mem_cb)(*this, 1, 0, 0);
281      (m_out_mem_cb)(*this, 2, 0, 0);
282      (m_out_mem_cb)(*this, 3, 0, 0);
283   }
284}
285
286
287//-------------------------------------------------
288//  device_timer - handler timer events
289//-------------------------------------------------
290
291void upd65031_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
292{
293   switch (id)
294   {
295   case TIMER_RTC:
296
297      // if a key is pressed sets the interrupt
298      if ((m_int & INT_GINT) && (m_int & INT_KEY) && m_int_kb_func(0) != 0xff)
299      {
300         if (LOG) logerror("uPD65031 '%s': Keyboard interrupt!\n", tag());
301
302         // awakes CPU from snooze on key down
303         if (m_mode == STATE_SNOOZE)
304            set_mode(STATE_AWAKE);
305
306         m_sta |= STA_KEY;
307      }
308      else
309      {
310         m_sta &= ~STA_KEY;
311      }
312
313      // hold clock at reset? - in this mode it doesn't update
314      if (!(m_com & COM_RESTIM))
315      {
316         bool irq_change = false;
317
318         // update 5 millisecond counter
319         m_tim[0]++;
320
321         // tick
322         if (m_tim[0] & 1)
323         {
324            // set tick int has occurred
325            if (m_tmk & TSTA_TICK)
326            {
327               m_tsta |= TSTA_TICK;
328               irq_change = true;
329            }
330         }
331
332         if (m_tim[0] == 200)
333         {
334            m_tim[0] = 0;
335
336            // set seconds int has occurred
337            if (m_tmk & TSTA_SEC)
338            {
339               m_tsta |= TSTA_SEC;
340               irq_change = true;
341            }
342
343            m_tim[1]++;
344
345            if (m_tim[1] == 60)
346            {
347               // set minutes int has occurred
348               if (m_tmk & TSTA_MIN)
349               {
350                  m_tsta |= TSTA_MIN;
351                  irq_change = true;
352               }
353               m_tim[1] = 0;
354               m_tim[2]++;
355
356               if (m_tim[2] == 0) // overflowed from 255
357               {
358                  m_tim[3]++;
359
360                  if (m_tim[3] == 0) // overflowed from 255
361                  {
362                     m_tim[4]++;
363
364                     if (m_tim[4] == 32)
365                        m_tim[4] = 0;
366                  }
367               }
368            }
369         }
370
371         if (irq_change && !(m_sta & STA_FLAPOPEN))
372         {
373            set_mode(STATE_AWAKE);
374
375            update_rtc_interrupt();
376         }
377
378         // refresh interrupt
379         interrupt_refresh();
380      }
381      break;
382   }
383}
384
385
386//-------------------------------------------------
387//  screen_update
388//-------------------------------------------------
389
390UINT32 upd65031_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
391{
392   if (m_screen_update_cb)
393      (m_screen_update_cb)(*this, bitmap, m_lcd_regs[4], m_lcd_regs[2], m_lcd_regs[3], m_lcd_regs[0], m_lcd_regs[1]);
394
395   return 0;
396}
397
398//-------------------------------------------------
399//  read -
400//-------------------------------------------------
401
402READ8_MEMBER( upd65031_device::read )
403{
404   UINT8 port = offset & 0xff;
405
406   switch (port)
407   {
408      case REG_STA:   // read interrupt status
409         return m_sta;
410
411      case REG_KBD:
412      {
413         // if set, reading the keyboard will put into snooze
414         if (m_int & INT_KWAIT)
415         {
416            set_mode(STATE_SNOOZE);
417
418            if (LOG) logerror("uPD65031 '%s': entering snooze!\n", tag());
419         }
420
421         UINT8 data = m_int_kb_func(offset>>8);
422
423         if (LOG) logerror("uPD65031 '%s': key r %02x: %02x\n", tag(), offset>>8, data);
424
425         return data;
426      }
427
428      // read real time clock status
429      case REG_TSTA:
430         if (LOG) logerror("uPD65031 '%s': tsta r: %02x\n", tag(), m_tsta);
431         return m_tsta & 0x07;
432
433      // read real time clock counters
434      case REG_TIM0:
435         if (LOG) logerror("uPD65031 '%s': TIM0 r: %02x\n", tag(), m_tim[0]);
436         return m_tim[0];
437      case REG_TIM1:
438         if (LOG) logerror("uPD65031 '%s': TIM1 r: %02x\n", tag(), m_tim[1]);
439         return m_tim[1];
440      case REG_TIM2:
441         if (LOG) logerror("uPD65031 '%s': TIM2 r: %02x\n", tag(), m_tim[2]);
442         return m_tim[2];
443      case REG_TIM3:
444         if (LOG) logerror("uPD65031 '%s': TIM3 r: %02x\n", tag(), m_tim[3]);
445         return m_tim[3];
446      case REG_TIM4:
447         if (LOG) logerror("uPD65031 '%s': TIM4 r: %02x\n", tag(), m_tim[4]);
448         return m_tim[4];
449
450      // UART
451      case REG_RXD:
452      case REG_RXE:
453      case REG_UIT:
454         // TODO
455         return 0;
456
457      default:
458         logerror("uPD65031 '%s': blink r: %04x\n", tag(), offset);
459         return 0;
460   }
461}
462
463
464//-------------------------------------------------
465//  write -
466//-------------------------------------------------
467
468WRITE8_MEMBER( upd65031_device::write )
469{
470   UINT8 port = offset & 0xff;
471
472   switch (port)
473   {
474      // gfx registers
475      case REG_PB0:
476      case REG_PB1:
477      case REG_PB2:
478      case REG_PB3:
479      case REG_SBR:
480         m_lcd_regs[port - REG_PB0] = ((offset & 0xff00) | data);
481         break;
482
483      case REG_COM:   // command register
484         if (LOG) logerror("uPD65031 '%s': com w: %02x\n", tag(), data);
485
486         // reset clock?
487         if (data & COM_RESTIM)
488            m_tim[0] = m_tim[1] = m_tim[2] = m_tim[3] = m_tim[4] = 0;
489
490         // SBIT controls speaker direct?
491         if (!(data & COM_SRUN))
492         {
493            // speaker controlled by SBIT
494            m_out_spkr_func(BIT(data, 6));
495         }
496         else
497         {
498            // speaker under control of continuous tone, or txd
499            // TODO
500         }
501
502         // bit 2 controls the lower 8kb of memory
503         if (BIT(m_com^data, 2) && m_out_mem_cb)
504            (m_out_mem_cb)(*this, 0, m_sr[0], BIT(data, 2));
505
506         m_com = data;
507         break;
508
509      case REG_INT:   // interrupt control
510         if (LOG) logerror("uPD65031 '%s': int w: %02x\n", tag(), data);
511
512         m_int = data;
513
514         // refresh ints
515         update_rtc_interrupt();
516         interrupt_refresh();
517         break;
518
519      case REG_EPR:   // EPROM programming register
520         if (LOG) logerror("uPD65031 '%s': epr w: %02x\n", tag(), data);
521         // TODO
522         break;
523
524      case REG_TACK:   // rtc interrupt acknowledge
525         if (LOG) logerror("uPD65031 '%s': tack w: %02x\n", tag(), data);
526
527         // clear ints that have occurred
528         m_tsta &= ~(data & 0x07);
529         m_tack = data;
530
531         // refresh ints
532         update_rtc_interrupt();
533         interrupt_refresh();
534         break;
535
536      case REG_TMK:   // write rtc interrupt mask
537         if (LOG) logerror("uPD65031 '%s': tmk w: %02x\n", tag(), data);
538
539         m_tmk = data & 0x07;
540         break;
541
542      case REG_ACK:   // acknowledge ints
543         if (LOG) logerror("uPD65031 '%s': ack w: %02x\n", tag(), data);
544
545         m_ack = data;
546         m_sta &= ~(data & 0x7c);
547
548         // refresh ints
549         interrupt_refresh();
550         break;
551
552      // Segment registers
553      case REG_SR0:
554      case REG_SR1:
555      case REG_SR2:
556      case REG_SR3:
557         if (m_out_mem_cb && m_sr[port & 3] != data)
558            (m_out_mem_cb)(*this, port & 3, data, BIT(m_com, 2));
559
560         m_sr[port & 3] = data;
561         break;
562
563      // UART
564      case REG_RXC:
565      case REG_TXD:
566      case REG_TXC:
567      case REG_UMK:
568      case REG_UAK:
569         if (LOG) logerror("uPD65031 '%s': UART w: %02x %02x\n", tag(), port & 7 , data);
570         // TODO
571         break;
572
573      default:
574         logerror("uPD65031 '%s': blink w: %04x %02x\n", tag(), offset, data);
575         break;
576   }
577}
src/mess/machine/upd65031.h
r0r14637
1/**********************************************************************
2
3    NEC uPD65031 'BLINK' emulation
4
5**********************************************************************/
6
7#pragma once
8
9#ifndef __UPD65031__
10#define __UPD65031__
11
12#include "emu.h"
13
14
15
16//**************************************************************************
17//  INTERFACE CONFIGURATION MACROS
18//**************************************************************************
19
20#define MCFG_UPD65031_ADD(_tag, _clock, _config) \
21   MCFG_DEVICE_ADD((_tag), UPD65031, _clock)   \
22   MCFG_DEVICE_CONFIG(_config)
23
24#define UPD65031_INTERFACE(name) \
25   const upd65031_interface (name) =
26
27
28//**************************************************************************
29//  TYPE DEFINITIONS
30//**************************************************************************
31
32typedef void (*upd65031_screen_update_func)(device_t &device, bitmap_ind16 &bitmap, UINT16 sbf, UINT16 hires0, UINT16 hires1, UINT16 lores0, UINT16 lores1);
33#define UPD65031_SCREEN_UPDATE(name) void name(device_t &device, bitmap_ind16 &bitmap, UINT16 sbf, UINT16 hires0, UINT16 hires1, UINT16 lores0, UINT16 lores1)
34
35typedef void (*upd65031_memory_update_func)(device_t &device, int bank, UINT16 page, int rams);
36#define UPD65031_MEMORY_UPDATE(name) void name(device_t &device, int bank, UINT16 page, int rams)
37
38
39// ======================> upd65031_interface
40
41struct upd65031_interface
42{
43   upd65031_screen_update_func   m_screen_update_cb;  // callback for update the LCD
44   upd65031_memory_update_func   m_out_mem_cb;       // callback for update bankswitch
45   devcb_read8               m_in_kb_cb;          // kb read input
46   devcb_write_line         m_out_int_cb;       // INT line out
47   devcb_write_line         m_out_nmi_cb;       // NMI line out
48   devcb_write_line         m_out_spkr_cb;       // Speaker line out
49};
50
51
52// ======================> upd65031_device
53
54class upd65031_device :   public device_t,
55                  public upd65031_interface
56{
57public:
58    // construction/destruction
59   upd65031_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
60
61   DECLARE_READ8_MEMBER( read );
62   DECLARE_WRITE8_MEMBER( write );
63   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
64
65protected:
66   // device-level overrides
67   virtual void device_config_complete();
68   virtual void device_start();
69   virtual void device_reset();
70   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
71
72private:
73   inline void interrupt_refresh();
74   inline void update_rtc_interrupt();
75   inline void set_mode(int mode);
76   static const device_timer_id TIMER_RTC = 0;
77
78   devcb_resolved_write_line   m_out_int_func;
79   devcb_resolved_write_line   m_out_nmi_func;
80   devcb_resolved_write_line   m_out_spkr_func;
81   devcb_resolved_read8      m_int_kb_func;
82
83   int      m_mode;
84   UINT16   m_lcd_regs[5];      // LCD registers
85   UINT8   m_tim[5];         // RTC registers
86   UINT8   m_sr[4];         // segment registers
87   UINT8   m_sta;            // interrupt status
88   UINT8   m_int;            // interrupts mask
89   UINT8   m_ack;            // interrupts acknowledge
90   UINT8   m_tsta;            // timer interrupt status
91   UINT8   m_tmk;            // timer interrupt mask
92   UINT8   m_tack;            // timer interrupts acknowledge
93   UINT8   m_com;            // command register
94
95   // timers
96   emu_timer *m_rtc_timer;
97};
98
99
100// device type definition
101extern const device_type UPD65031;
102
103
104#endif
src/mess/includes/z88.h
r14636r14637
77#ifndef Z88_H_
88#define Z88_H_
99
10#include "emu.h"
11#include "cpu/z80/z80.h"
12#include "machine/upd65031.h"
13#include "sound/speaker.h"
14#include "rendlay.h"
1015
1116#define Z88_NUM_COLOURS 3
1217
1318#define Z88_SCREEN_WIDTH        856
1419#define Z88_SCREEN_HEIGHT       64
1520
16#define RTC_MIN_INT (1<<2) /* once a minute */
17#define RTC_SEC_INT (1<<1) /* once a second */
18#define RTC_TICK_INT (1<<0) /* 100 times a second */
19
20/* sta bits */
21#define STA_TIME (1<<0)
22#define STA_KEY (1<<2)
23
24/* ints bits */
25#define INT_GINT (1<<0)
26#define INT_TIME (1<<1)
27#define INT_KEY (1<<2)
28#define INT_KWAIT (1<<7)
29
3021#define Z88_SCR_HW_REV  (1<<4)
3122#define Z88_SCR_HW_HRS  (1<<5)
3223#define Z88_SCR_HW_UND  (1<<1)
3324#define Z88_SCR_HW_FLS  (1<<3)
3425#define Z88_SCR_HW_GRY  (1<<2)
3526
36#define Z88_AWAKE   0
37#define Z88_SNOOZE   1
38#define Z88_COMA   2
39
40#define Z88_SNOOZE_TRIGGER 2
41#define MACHINE_RESET_MEMBER(name) void name::machine_reset()
42
43#include "emu.h"
44#include "cpu/z80/z80.h"
45#include "sound/speaker.h"
46
47
48typedef struct
49{
50   UINT8 z88_state;
51   UINT16 pb[4];
52   UINT16 sbr;
53
54   /* screen */
55   UINT32 sbf;
56   UINT32 lores0;
57   UINT32 lores1;
58   UINT32 hires0;
59   UINT32 hires1;
60
61   UINT8 com;
62   UINT8 ints;
63   UINT8 sta;
64   UINT8 ack;
65   UINT8 mem[4];
66
67   /* rtc acknowledge */
68   /* bit 2 = min */
69   /* bit 1 = sec */
70   /* bit 0 = tick */
71   UINT8 tack;
72   /* rtc interrupt mask */
73   UINT8 tmk;
74   /* rtc interrupt status */
75   UINT8 tsta;
76   /* real time clock registers */
77   /* tim0 = 5ms counter */
78   /* tim1 = second counter */
79   /* tim2 = minute counter */
80   /* tim3 = 256 minute counter */
81   /* tim4 = 64k minute counter */
82   UINT8 tim[5];
83} blink_hw_t;
84
85
8627class z88_state : public driver_device
8728{
8829public:
8930   z88_state(const machine_config &mconfig, device_type type, const char *tag)
9031      : driver_device(mconfig, type, tag),
91   m_maincpu(*this, "maincpu"),
92   m_speaker(*this, SPEAKER_TAG)
32        m_maincpu(*this, "maincpu"),
33        m_speaker(*this, SPEAKER_TAG)
9334   { }
9435
9536   required_device<cpu_device> m_maincpu;
9637   required_device<device_t> m_speaker;
97   DECLARE_READ8_MEMBER(z88_port_r);
98   DECLARE_WRITE8_MEMBER(z88_port_w);
38
9939   UINT8 m_frame_number;
10040   bool m_flash_invert;
101   blink_hw_t m_blink;
102   void z88_refresh_memory_bank(UINT8 bank);
103   void z88_install_memory_handler_pair(offs_t start, offs_t size, UINT8 bank_base, UINT8 *read_addr, UINT8 *write_addr);
104   virtual void machine_reset();
41
42   virtual void machine_start();
43   void bankswitch_update(int bank, UINT16 page, int rams);
44   DECLARE_READ8_MEMBER(kb_r);
10545};
10646
10747
10848/*----------- defined in video/z88.c -----------*/
10949
11050extern PALETTE_INIT( z88 );
111extern SCREEN_UPDATE_IND16( z88 );
51extern UPD65031_SCREEN_UPDATE(z88_screen_update);
11252extern SCREEN_VBLANK( z88 );
11353
11454
src/mess/video/z88.c
r14636r14637
117117/* convert absolute offset into correct address to get data from */
118118static unsigned char *z88_convert_address(running_machine &machine, unsigned long offset)
119119{
120   return machine.region("maincpu")->base() + 0x010000 + offset;
120   return machine.region("maincpu")->base() + offset;
121121}
122122
123123
r14636r14637
137137}
138138
139139
140
141/***************************************************************************
142  Draw the game screen in the given bitmap_ind16.
143  Do NOT call osd_update_display() from this fuz88tion,
144  it will be called by the main emulation engine.
145***************************************************************************/
146SCREEN_UPDATE_IND16( z88 )
140UPD65031_SCREEN_UPDATE(z88_screen_update)
147141{
148   z88_state *state = screen.machine().driver_data<z88_state>();
149142   int x,y;
150   unsigned char *ptr = z88_convert_address(screen.machine(), state->m_blink.sbf);
143   unsigned char *ptr = z88_convert_address(device.machine(), sbf<<11);
151144   unsigned char *stored_ptr = ptr;
152145   int pen0, pen1;
153146
r14636r14637
212205               if (ch & 0x0100)
213206               {
214207                  ch_index =ch & 0x0ff;   //(~0x0100);
215                  pCharGfx = z88_convert_address(screen.machine(), state->m_blink.hires1);
208                  pCharGfx = z88_convert_address(device.machine(), hires1<<11);
216209               }
217210               else
218211               {
219212                  ch_index = ch & 0x0ff;
220                  pCharGfx = z88_convert_address(screen.machine(), state->m_blink.hires0);
213                  pCharGfx = z88_convert_address(device.machine(), hires0<<13);
221214               }
222215
223216               pCharGfx += (ch_index<<3);
r14636r14637
235228            {
236229               ch_index = ch & (~0x01c0);
237230
238               pCharGfx = z88_convert_address(screen.machine(), state->m_blink.lores0);
231               pCharGfx = z88_convert_address(device.machine(), lores0<<9);
239232            }
240233            else
241234            {
242235               ch_index = ch;
243236
244               pCharGfx = z88_convert_address(screen.machine(), state->m_blink.lores1);
237               pCharGfx = z88_convert_address(device.machine(), lores1<<12);
245238            }
246239
247240            pCharGfx += (ch_index<<3);
r14636r14637
261254
262255      stored_ptr+=256;
263256   }
264   return 0;
265257}
src/mess/drivers/z88.c
r14636r14637
77        system driver
88
99        TODO:
10        - screen should be 640x64
1011        - speaker controlled by constant tone or txd
11        - Keyboard to make work
1212        - Facility to load games
13        - expansion interface
1314
1415        Kevin Thacker [MESS driver]
1516
r14636r14637
1920#include "includes/z88.h"
2021
2122
22static void z88_interrupt_refresh(running_machine &machine)
23{
24   z88_state *state = machine.driver_data<z88_state>();
25   /* ints enabled? */
26   if (state->m_blink.ints & INT_GINT)
27   {
28      /* yes */
29
30      /* other ints - except timer */
31      if (
32         (state->m_blink.ints & state->m_blink.sta & 0x7c) ||
33         ((state->m_blink.ints & INT_TIME) && (state->m_blink.sta & STA_TIME))
34         )
35      {
36         logerror("set int\n");
37         cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
38         return;
39      }
40   }
41
42   logerror("clear int\n");
43   cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
44}
45
46static void z88_update_rtc_interrupt(running_machine &machine)
47{
48   z88_state *state = machine.driver_data<z88_state>();
49   state->m_blink.sta &=~STA_TIME;
50
51   /* time interrupt enabled? */
52   if (state->m_blink.ints & INT_TIME)
53   {
54      /* yes */
55
56      /* any ints occurred? */
57      if (state->m_blink.tsta & 0x07)
58      {
59         /* yes, set time int */
60         state->m_blink.sta |= STA_TIME;
61      }
62   }
63}
64
65
66
67static TIMER_DEVICE_CALLBACK(z88_rtc_timer_callback)
68{
69   z88_state *state = timer.machine().driver_data<z88_state>();
70   bool refresh_ints = FALSE;
71   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" };
72
73   /* is z88 in snooze state? */
74   //if (state->m_blink.z88_state == Z88_SNOOZE)
75   //{
76      UINT8 data = 0xff, i;
77
78      /* any key pressed will wake up z88 */
79      for (i=0; i<8; i++)
80      {
81         data &= input_port_read(timer.machine(), keynames[i]);
82      }
83
84      /* if any key is pressed, then one or more bits will be 0 */
85      if (data < 0xff)
86      {
87         logerror("Z88 wake up from snooze!\n");
88
89         /* wake up z88 */
90         state->m_blink.z88_state = Z88_AWAKE;
91         /* column has gone low in snooze/coma */
92         state->m_blink.sta |= STA_KEY;
93
94         timer.machine().scheduler().trigger(Z88_SNOOZE_TRIGGER);
95
96         z88_interrupt_refresh(timer.machine());
97      }
98   //}
99
100
101
102   /* hold clock at reset? - in this mode it doesn't update */
103   if (!BIT(state->m_blink.com, 4))
104   {
105      /* update 5 millisecond counter */
106      state->m_blink.tim[0]++;
107
108      /* tick */
109      if ((state->m_blink.tim[0]%10)==0)
110      {
111         /* set tick int has occurred */
112         state->m_blink.tsta |= RTC_TICK_INT;
113         refresh_ints = TRUE;
114      }
115
116      if (state->m_blink.tim[0]==200)
117      {
118         state->m_blink.tim[0] = 0;
119
120         /* set seconds int has occurred */
121         state->m_blink.tsta |= RTC_SEC_INT;
122         refresh_ints = TRUE;
123
124         state->m_blink.tim[1]++;
125
126         if (state->m_blink.tim[1]==60)
127         {
128            /* set minutes int has occurred */
129            state->m_blink.tsta |=RTC_MIN_INT;
130            state->m_blink.tim[1]=0;
131            state->m_blink.tim[2]++;
132
133            if (state->m_blink.tim[2]==0) // overflowed from 255
134            {
135               state->m_blink.tim[3]++;
136
137               if (state->m_blink.tim[3]==0) // overflowed from 255
138               {
139                  state->m_blink.tim[4]++;
140
141                  if (state->m_blink.tim[4]==32)
142                     state->m_blink.tim[4] = 0;
143               }
144            }
145         }
146      }
147   }
148
149   if (refresh_ints)
150   {
151      z88_update_rtc_interrupt(timer.machine());
152
153      /* refresh */
154      z88_interrupt_refresh(timer.machine());
155   }
156}
157
158
159
160void z88_state::z88_install_memory_handler_pair(offs_t start, offs_t size, UINT8 bank_base, UINT8 *read_addr, UINT8 *write_addr)
161{
162   char bank_r[10];
163   char bank_w[10];
164
165   sprintf(bank_r,"bank%d",bank_base);
166   sprintf(bank_w,"bank%d",bank_base + 5);
167
168   /* special case */
169   if (read_addr == NULL) printf("Read Bank is NULL\n");
170   //  read_addr = &machine.region("maincpu")->base()[start];
171
172   /* install the handlers */
173   machine().device("maincpu")->memory().space(AS_PROGRAM )->install_read_bank(start, start + size - 1, bank_r);
174
175   if (write_addr == NULL)
176      machine().device("maincpu")->memory().space(AS_PROGRAM )->unmap_write(start, start + size - 1);
177   else
178      machine().device("maincpu")->memory().space(AS_PROGRAM )->install_write_bank(start, start + size - 1, bank_w);
179
180   /* and set the banks */
181   memory_set_bankptr(machine(), bank_r, read_addr);
182
183   if (write_addr != NULL)
184      memory_set_bankptr(machine(), bank_w, write_addr);
185}
186
187
18823/* Assumption:
18924
19025all banks can access the same memory blocks in the same way.
r14636r14637
19934    bank 1      0x4000-0x7FFF
20035    bank 2      0x8000-0xBFFF
20136    bank 3      0xC000-0xFFFF
37
38    pages 0x00 - 0x1f   internal ROM (mirrored?)
39    pages 0x20 - 0x3f   512KB internal RAM
40    pages 0x40 - 0x7f   Slot 1
41    pages 0x80 - 0xbf   Slot 2
42    pages 0xc0 - 0xff   Slot 3
43
20244*/
20345
204void z88_state::z88_refresh_memory_bank(UINT8 bank)
46void z88_state::bankswitch_update(int bank, UINT16 page, int rams)
20547{
206   UINT8 *read_addr;
207   UINT8 *write_addr;
208   UINT8 block;
48   char bank_tag[6];
49   sprintf(bank_tag, "bank%d", bank + 2);
20950
210   block = m_blink.mem[bank];
211   read_addr = machine().region("maincpu")->base() + 0x10000 + (block << 14);
212
213   if (m_blink.mem[bank] > 63) // do not exceed segment 0
51   if (page < 0x40)   // internal memory
21452   {
215      write_addr = NULL;
216   }
217   else
218   if (m_blink.mem[bank] > 31) // internal ram
219   {
220      write_addr = read_addr;
221   }
222   else // internal rom
223   {
224      block &= 7; // possibly not necessary
225      read_addr = machine().region("maincpu")->base() + 0x10000 + (block << 14);
226      write_addr = NULL;
227   }
53      // install read bank
54      m_maincpu->memory().space(AS_PROGRAM)->install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
22855
229   /* install the banks */
230   z88_install_memory_handler_pair(bank * 0x4000, 0x4000, bank + 2, read_addr, write_addr);
231
232   if (bank == 0)
233   {
234      /* override setting for lower 8k of bank 0 */
235
236      /* enable rom? */
237      if (!BIT(m_blink.com, 2))
56      // install write bank
57      if (page > 0x1f)
23858      {
239         /* yes */
240         read_addr = machine().region("maincpu")->base() + 0x10000;
241         write_addr = NULL;
59          // 512KB internal RAM
60         m_maincpu->memory().space(AS_PROGRAM)->install_write_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
24261      }
24362      else
24463      {
245         /* ram bank 20 */
246         read_addr = write_addr = machine().region("maincpu")->base() + 0x10000 + (0x20 << 14);
64         // internal ROM
65         page &= 7;
66         m_maincpu->memory().space(AS_PROGRAM)->unmap_write(bank<<14, (bank<<14) + 0x3fff);
24767      }
24868
249      z88_install_memory_handler_pair(0x0000, 0x2000, 1, read_addr, write_addr);
69      // set the bank
70      memory_set_bank(machine(), bank_tag, page);
25071   }
251}
252
253static MACHINE_START( z88 )
254{
255}
256
257MACHINE_RESET_MEMBER( z88_state )
258{
259   memset(&m_blink, 0, sizeof(m_blink));
260
261   z88_refresh_memory_bank(0);
262   z88_refresh_memory_bank(1);
263   z88_refresh_memory_bank(2);
264   z88_refresh_memory_bank(3);
265}
266
267static ADDRESS_MAP_START(z88_mem, AS_PROGRAM, 8, z88_state )
268   AM_RANGE(0x0000, 0x1fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank6")
269   AM_RANGE(0x2000, 0x3fff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank7")
270   AM_RANGE(0x4000, 0x7fff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank8")
271   AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank9")
272   AM_RANGE(0xc000, 0xffff) AM_READ_BANK("bank5") AM_WRITE_BANK("bank10")
273ADDRESS_MAP_END
274
275
276
277/*
278 00b0 00
279blink w: 00d0 00
280blink w: 00d1 00
281blink w: 00d2 00
282blink w: 00d3 00
283blink w: 01b5 01
284blink w: 01b4 01
285blink w: 03b1 03
286blink w: 03b6 03
287*/
288
289WRITE8_MEMBER( z88_state::z88_port_w )
290{
291   UINT8 port = offset & 0xff;
292   UINT8 changed_bits = m_blink.com^data;
293   UINT16 addr_written = (offset & 0xff00) | data;
294
295   switch (port)
72   else
29673   {
297      /* gfx registers */
298      case 0x70:
299         m_blink.pb[0] = addr_written;
300         m_blink.lores0 = (addr_written & 0x1fff)<<9;
301         return;
302      case 0x71:
303         m_blink.pb[2] = addr_written;
304         m_blink.lores1 = (addr_written & 0x1fff)<<12;
305         return;
306      case 0x72:
307         m_blink.pb[2] = addr_written;
308         m_blink.hires0 = (addr_written & 0x1fff)<<13;
309         return;
310      case 0x73:
311         m_blink.pb[3] = addr_written;
312         m_blink.hires1 = (addr_written & 0x1fff)<<11;
313         return;
314      case 0x74:
315         m_blink.sbr = addr_written;
316         m_blink.sbf = (addr_written & 0x1fff)<<11;
317         return;
318
319
320      /* write rtc interrupt acknowledge */
321      case 0xb4:
322         logerror("tack w: %02x\n", data);
323
324         /* set acknowledge */
325         m_blink.tack = data & 0x07;
326         /* clear ints that have occurred */
327         m_blink.tsta &= ~m_blink.tack;
328
329         /* refresh ints */
330         z88_update_rtc_interrupt(machine());
331         z88_interrupt_refresh(machine());
332         return;
333
334      /* write rtc interrupt mask */
335      case 0xb5:
336         logerror("tmk w: %02x\n", data);
337
338         /* set new int mask */
339         m_blink.tmk = data & 0x07;
340
341         /* refresh ints */
342         z88_update_rtc_interrupt(machine());
343         z88_interrupt_refresh(machine());
344      return;
345
346      case 0xb0:
347         logerror("com w: %02x\n", data);
348
349         m_blink.com = data;
350
351         /* reset clock? */
352         if (BIT(data, 4))
353         {
354            m_blink.tim[0] = (m_blink.tim[1] = (m_blink.tim[2] = (m_blink.tim[3] = (m_blink.tim[4] = 0))));
355         }
356
357         /* SBIT controls speaker direct? */
358         if (!BIT(data, 7))
359         {
360            /* yes */
361
362            /* speaker controlled by SBIT */
363            speaker_level_w(m_speaker, BIT(data, 6));
364         }
365         else
366         {
367         // speaker under control of continuous tone, or txd
368
369
370         }
371
372         if (BIT(changed_bits, 2))
373         {
374            z88_refresh_memory_bank(0);
375         }
376         return;
377
378      case 0xb1:
379         /* set int enables */
380         logerror("int w: %02x\n", data);
381
382         m_blink.ints = data;
383         z88_update_rtc_interrupt(machine());
384         z88_interrupt_refresh(machine());
385         return;
386
387      case 0xb6:
388         logerror("ack w: %02x\n", data);
389         cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
390
391         /* acknowledge ints */
392         m_blink.ack = data & 0x6c;
393
394         m_blink.ints &= ~m_blink.ack;
395         z88_update_rtc_interrupt(machine());
396         z88_interrupt_refresh(machine());
397         return;
398
399
400      case 0xd0:
401      case 0xd1:
402      case 0xd2:
403      case 0xd3:
404         m_blink.mem[port&3] = data;
405         z88_refresh_memory_bank(port&3);
406         return;
74      // TODO: expansion slots
75      m_maincpu->memory().space(AS_PROGRAM)->unmap_readwrite(bank<<14, (bank<<14) + 0x3fff);
40776   }
40877
409   logerror("blink w: %04x %02x\n", offset, data);
41078
411}
412
413READ8_MEMBER( z88_state::z88_port_r )
414{
415   UINT8 port = offset & 0xff;
416
417   switch (port)
79   // override setting for lower 8k of bank 0
80   if (bank == 0)
41881   {
419      case 0xb1:
420         m_blink.sta &=~(1<<1);
421         //logerror("sta r: %02x\n",m_blink.sta);
422         return m_blink.sta;
82      m_maincpu->memory().space(AS_PROGRAM)->install_read_bank(0, 0x1fff, "bank1");
42383
84      // enable RAM
85      if (rams)
86         m_maincpu->memory().space(AS_PROGRAM)->install_write_bank(0, 0x1fff, "bank1");
87      else
88         m_maincpu->memory().space(AS_PROGRAM)->unmap_write(0, 0x1fff);
42489
425      case 0xb2:
426      {
427         UINT8 data = 0xff;
428         UINT8 lines = offset>>8;
429
430         /* if set, reading the keyboard will put z88 into snooze */
431         if (m_blink.ints & INT_KWAIT)
432         {
433            m_blink.z88_state = Z88_SNOOZE;
434            /* spin cycles until rtc timer */
435            // commented out because sometimes it happens while interrupts are disabled,
436            // causing the emulation to freeze.
437            //device_spin_until_trigger( m_maincpu, Z88_SNOOZE_TRIGGER);
438
439            logerror("z88 entering snooze!\n");
440         }
441
442
443         if ((lines & 0x80)==0)
444            data &=input_port_read(machine(), "LINE7");
445
446         if ((lines & 0x40)==0)
447            data &=input_port_read(machine(), "LINE6");
448
449         if ((lines & 0x20)==0)
450            data &=input_port_read(machine(), "LINE5");
451
452         if ((lines & 0x10)==0)
453            data &=input_port_read(machine(), "LINE4");
454
455         if ((lines & 0x08)==0)
456            data &=input_port_read(machine(), "LINE3");
457
458         if ((lines & 0x04)==0)
459            data &=input_port_read(machine(), "LINE2");
460
461         if ((lines & 0x02)==0)
462            data &=input_port_read(machine(), "LINE1");
463
464         if ((lines & 0x01)==0)
465            data &=input_port_read(machine(), "LINE0");
466
467         logerror("lines: %02x\n",lines);
468         logerror("key r: %02x\n",data);
469         return data;
470      }
471
472      /* read real time clock status */
473      case 0xb5:
474         m_blink.tsta &=~0x07;
475         logerror("tsta r: %02x\n",m_blink.tsta);
476         return m_blink.tsta;
477
478      /* read real time clock counters */
479      case 0xd0:
480         logerror("tim0 r: %02x\n", m_blink.tim[0]);
481         return m_blink.tim[0] & 0xff;
482      case 0xd1:
483         logerror("tim1 r: %02x\n", m_blink.tim[1]);
484         return m_blink.tim[1] & 0x3f;
485      case 0xd2:
486         logerror("tim2 r: %02x\n", m_blink.tim[2]);
487         return m_blink.tim[2] & 0xff;
488      case 0xd3:
489         logerror("tim3 r: %02x\n", m_blink.tim[3]);
490         return m_blink.tim[3] & 0xff;
491      case 0xd4:
492         logerror("tim4 r: %02x\n", m_blink.tim[4]);
493         return m_blink.tim[4] & 0x1f;
494
495      default:
496         break;
497
90      memory_set_bank(machine(), "bank1", rams & 1);
49891   }
499
500   logerror("blink r: %04x \n", offset);
501
502   return 0;
50392}
50493
50594
95static ADDRESS_MAP_START(z88_mem, AS_PROGRAM, 8, z88_state )
96   AM_RANGE(0x0000, 0x1fff) AM_READWRITE_BANK("bank1")
97   AM_RANGE(0x2000, 0x3fff) AM_READWRITE_BANK("bank2")
98   AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank3")
99   AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank4")
100   AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank5")
101ADDRESS_MAP_END
102
506103static ADDRESS_MAP_START( z88_io, AS_IO, 8, z88_state )
507   AM_RANGE(0x0000, 0xffff) AM_READWRITE(z88_port_r, z88_port_w)
104   AM_RANGE(0x0000, 0xffff)   AM_DEVREADWRITE("blink", upd65031_device, read, write)
508105ADDRESS_MAP_END
509106
510107
r14636r14637
614211   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)                     PORT_CHAR('\xA3') PORT_CHAR('~')
615212INPUT_PORTS_END
616213
214void z88_state::machine_start()
215{
216   // configure the memory banks
217   memory_configure_bank(machine(), "bank1", 0, 1, machine().region("maincpu")->base(), 0);
218   memory_configure_bank(machine(), "bank1", 1, 1, machine().region("maincpu")->base() + (32<<14), 0);
219   memory_configure_bank(machine(), "bank2", 0, 64, machine().region("maincpu")->base(), 0x4000);
220   memory_configure_bank(machine(), "bank3", 0, 64, machine().region("maincpu")->base(), 0x4000);
221   memory_configure_bank(machine(), "bank4", 0, 64, machine().region("maincpu")->base(), 0x4000);
222   memory_configure_bank(machine(), "bank5", 0, 64, machine().region("maincpu")->base(), 0x4000);
223}
224
225READ8_MEMBER(z88_state::kb_r)
226{
227   UINT8 data = 0xff;
228
229   if (!(offset & 0x80))
230      data &= input_port_read(machine(), "LINE7");
231
232   if (!(offset & 0x40))
233      data &= input_port_read(machine(), "LINE6");
234
235   if (!(offset & 0x20))
236      data &= input_port_read(machine(), "LINE5");
237
238   if (!(offset & 0x10))
239      data &= input_port_read(machine(), "LINE4");
240
241   if (!(offset & 0x08))
242      data &= input_port_read(machine(), "LINE3");
243
244   if (!(offset & 0x04))
245      data &= input_port_read(machine(), "LINE2");
246
247   if (!(offset & 0x02))
248      data &= input_port_read(machine(), "LINE1");
249
250   if (!(offset & 0x01))
251      data &= input_port_read(machine(), "LINE0");
252
253   return data;
254}
255
256static UPD65031_MEMORY_UPDATE(z88_bankswitch_update)
257{
258   z88_state *state = device.machine().driver_data<z88_state>();
259   state->bankswitch_update(bank, page, rams);
260}
261
262
263static UPD65031_INTERFACE( z88_blink_intf )
264{
265   z88_screen_update,                              // callback for update the LCD
266   z88_bankswitch_update,                           // callback for update the bankswitch
267   DEVCB_DRIVER_MEMBER(z88_state, kb_r),                // kb read input
268   DEVCB_CPU_INPUT_LINE("maincpu", 0),                  // INT line out
269   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),        // NMI line out
270   DEVCB_NULL                                    // Speaker line out
271};
272
273
617274static MACHINE_CONFIG_START( z88, z88_state )
618275   /* basic machine hardware */
619   MCFG_CPU_ADD("maincpu", Z80, 3276800)
276   MCFG_CPU_ADD("maincpu", Z80, XTAL_9_8304MHz/3)   // divided by 3 through the uPD65031
620277   MCFG_CPU_PROGRAM_MAP(z88_mem)
621278   MCFG_CPU_IO_MAP(z88_io)
622279   //MCFG_QUANTUM_TIME(attotime::from_hz(60))
623280
624   MCFG_MACHINE_START( z88 )
625
626281   /* video hardware */
627282   MCFG_SCREEN_ADD("screen", LCD)
628283   MCFG_SCREEN_REFRESH_RATE(50)
629284   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
630   MCFG_SCREEN_SIZE(Z88_SCREEN_WIDTH, 480)
631   MCFG_SCREEN_VISIBLE_AREA(0, (Z88_SCREEN_WIDTH - 1), 0, (480 - 1))
632   MCFG_SCREEN_UPDATE_STATIC( z88 )
285   MCFG_SCREEN_SIZE(Z88_SCREEN_WIDTH, Z88_SCREEN_HEIGHT)
286   MCFG_SCREEN_VISIBLE_AREA(0, (Z88_SCREEN_WIDTH - 1), 0, (Z88_SCREEN_HEIGHT - 1))
287   MCFG_SCREEN_UPDATE_DEVICE("blink", upd65031_device, screen_update)
633288   MCFG_SCREEN_VBLANK_STATIC( z88 )
634289
635290   MCFG_PALETTE_LENGTH(Z88_NUM_COLOURS)
636291   MCFG_PALETTE_INIT( z88 )
637292
293   MCFG_DEFAULT_LAYOUT(layout_lcd)
294
295   MCFG_UPD65031_ADD("blink", XTAL_9_8304MHz, z88_blink_intf)
296
638297   /* sound hardware */
639298   MCFG_SPEAKER_STANDARD_MONO("mono")
640299   MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
641300   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
642
643   MCFG_TIMER_ADD_PERIODIC("rtc_timer", z88_rtc_timer_callback, attotime::from_msec(5))
644301MACHINE_CONFIG_END
645302
646303
r14636r14637
651308***************************************************************************/
652309
653310ROM_START(z88)
654   ROM_REGION(0x410000, "maincpu", ROMREGION_ERASE00)
311   ROM_REGION(0x400000, "maincpu", ROMREGION_ERASE00)
312   ROM_DEFAULT_BIOS("ver4")
655313   ROM_SYSTEM_BIOS( 0, "ver3", "Version 3.0 UK")
656   ROMX_LOAD("z88v300.rom" ,  0x10000, 0x20000, CRC(802cb9aa) SHA1(ceb688025b79454cf229cae4dbd0449df2747f79), ROM_BIOS(1) )
314   ROMX_LOAD("z88v300.rom" ,  0x00000, 0x20000, CRC(802cb9aa) SHA1(ceb688025b79454cf229cae4dbd0449df2747f79), ROM_BIOS(1) )
657315   ROM_SYSTEM_BIOS( 1, "ver4", "Version 4.0 UK")
658   ROMX_LOAD("z88v400.rom",   0x10000, 0x20000, CRC(1356d440) SHA1(23c63ceced72d0a9031cba08d2ebc72ca336921d), ROM_BIOS(2) )
316   ROMX_LOAD("z88v400.rom",   0x00000, 0x20000, CRC(1356d440) SHA1(23c63ceced72d0a9031cba08d2ebc72ca336921d), ROM_BIOS(2) )
659317   ROM_SYSTEM_BIOS( 2, "ver41fi", "Version 4.1 Finnish")
660   ROMX_LOAD("z88v401fi.rom", 0x10000, 0x20000, CRC(ecd7f3f6) SHA1(bf8d3e083f1959e5a0d7e9c8d2ad0c14abd46381), ROM_BIOS(3) )
318   ROMX_LOAD("z88v401fi.rom", 0x00000, 0x20000, CRC(ecd7f3f6) SHA1(bf8d3e083f1959e5a0d7e9c8d2ad0c14abd46381), ROM_BIOS(3) )
661319ROM_END
662320
663321/*    YEAR     NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     COMPANY         FULLNAME */
src/mess/mess.mak
r14636r14637
570570   $(MESS_DRIVERS)/electron.o   \
571571   $(MESS_DRIVERS)/z88.o      \
572572   $(MESS_VIDEO)/z88.o         \
573   $(MESS_MACHINE)/upd65031.o   \
573574
574575$(MESSOBJ)/act.a:            \
575576   $(MESS_DRIVERS)/apricot.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team