Previous 15994 Revisions Next

r4518 Sunday 19th April, 2009 at 08:39:04 UTC by Robbbert
svn:eol-style
[src/mess]messdriv.c
[src/mess/drivers]kaypro.c kaypro2.c z80ne.c
[src/mess/includes]kaypro.h z80ne.h
[src/mess/layout]z80ne.lay z80net.lay z80netb.lay
[src/mess/machine]kay_kbd.c kay_kbd.h kaypro.c kr2376.c kr2376.h
[src/mess/video]kaypro.c z80ne.c

src/mess/video/z80ne.c
r4517r4518
1/***************************************************************************
2 
3   Video hardware for Z80NE
4 
5   driver by Roberto Lavarone
6 
7   See mess/machine/z80ne.c for references
8 
9***************************************************************************/
10 
11#include "driver.h"
12#include "video/m6847.h"
13#include "includes/z80ne.h"
14 
15 
16/*
17 * GM0 to GND
18 * GM1 to GND
19 * GM2 to GND
20 * AG  to GND
21 * CSS to GND
22 * DD6 to GND
23 * DD7 to GND
24 *
25 * D7 D6 PIN32 PIN31 PIN34
26 *        INV  INTEXT AS
27 * 0  0    0     0     0   Alphanumeric
28 * 0  1    0     0     0   Alphanumeric
29 * 1  0    0     1     1   Semigraphic 6
30 * 1  1    1     0     0   Inverted Alphanumeric
31 */
32static ATTR_CONST UINT8 lx388_get_attributes(running_machine *machine, UINT8 video_byte)
33{
34   UINT8 result = 0x00;
35   if (video_byte & 0x80)
36   {
37      if (video_byte & 0x40)
38         result |= M6847_INV;
39      else
40         result |= M6847_INTEXT | M6847_AS;
41   }
42   return result;
43}
44 
45static const UINT8 *lx388_get_video_ram(running_machine *machine, int scanline)
46{
47   return videoram + (scanline / 12) * 0x20;
48}
49 
50VIDEO_START(lx388)
51{
52   m6847_config cfg;
53 
54   memset(&cfg, 0, sizeof(cfg));
55   cfg.type = M6847_VERSION_ORIGINAL_PAL;
56   cfg.get_attributes = lx388_get_attributes;
57   cfg.get_video_ram = lx388_get_video_ram;
58   m6847_init(machine, &cfg);
59}
1/***************************************************************************
2
3   Video hardware for Z80NE
4
5   driver by Roberto Lavarone
6
7   See mess/machine/z80ne.c for references
8
9***************************************************************************/
10
11#include "driver.h"
12#include "video/m6847.h"
13#include "includes/z80ne.h"
14
15
16/*
17 * GM0 to GND
18 * GM1 to GND
19 * GM2 to GND
20 * AG  to GND
21 * CSS to GND
22 * DD6 to GND
23 * DD7 to GND
24 *
25 * D7 D6 PIN32 PIN31 PIN34
26 *        INV  INTEXT AS
27 * 0  0    0     0     0   Alphanumeric
28 * 0  1    0     0     0   Alphanumeric
29 * 1  0    0     1     1   Semigraphic 6
30 * 1  1    1     0     0   Inverted Alphanumeric
31 */
32static ATTR_CONST UINT8 lx388_get_attributes(running_machine *machine, UINT8 video_byte)
33{
34   UINT8 result = 0x00;
35   if (video_byte & 0x80)
36   {
37      if (video_byte & 0x40)
38         result |= M6847_INV;
39      else
40         result |= M6847_INTEXT | M6847_AS;
41   }
42   return result;
43}
44
45static const UINT8 *lx388_get_video_ram(running_machine *machine, int scanline)
46{
47   return videoram + (scanline / 12) * 0x20;
48}
49
50VIDEO_START(lx388)
51{
52   m6847_config cfg;
53
54   memset(&cfg, 0, sizeof(cfg));
55   cfg.type = M6847_VERSION_ORIGINAL_PAL;
56   cfg.get_attributes = lx388_get_attributes;
57   cfg.get_video_ram = lx388_get_video_ram;
58   m6847_init(machine, &cfg);
59}
src/mess/video/kaypro.c
r4517r4518
1 
2#include "driver.h"
3 
4 
5/***********************************************************
6 
7   Video
8 
9************************************************************/
10 
11PALETTE_INIT( kaypro )
12{
13   palette_set_color(machine,0,RGB_BLACK); /* black */
14   palette_set_color(machine,1,MAKE_RGB(0, 220, 0)); /* green */   
15}
16 
17VIDEO_UPDATE( kayproii )
18{
19/* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram,
20   but only the first 80 are used. The total video ram therefore is 0x0c00 bytes.
21   There is one video attribute: bit 7 causes blinking. The first half of the
22   character generator is blank, with the visible characters in the 2nd half.
23   During the "off" period of blanking, the first half is used. Only 5 pixels are
24   connected from the rom to the shift register, the remaining pixels are held high.
25   A high pixel is black and a low pixel is green. */
26 
27   static UINT8 framecnt=0;
28   UINT8 y,ra,chr,gfx;
29   UINT16 sy=0,ma=0,x;
30   UINT8 *FNT = memory_region(screen->machine, "gfx1");
31 
32   framecnt++;
33 
34   for (y = 0; y < 24; y++)
35   {
36      for (ra = 0; ra < 10; ra++)
37      {
38         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
39 
40         for (x = ma; x < ma + 80; x++)
41         {
42            if (ra < 8)
43            {
44               chr = videoram[x]^0x80;
45 
46               /* Take care of flashing characters */
47               if ((chr < 0x80) && (framecnt & 0x08))
48                  chr |= 0x80;
49 
50               /* get pattern of pixels for that character scanline */
51               gfx = FNT[(chr<<3) | ra ];
52            }
53            else
54               gfx = 0xff;
55 
56            /* Display a scanline of a character (7 pixels) */
57            *p = 0; p++;
58            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
59            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
60            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
61            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
62            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
63            *p = 0; p++;
64         }
65      }
66      ma+=128;
67   }
68   return 0;
69}
70 
71VIDEO_UPDATE( omni2 )
72{
73   static UINT8 framecnt=0;
74   UINT8 y,ra,chr,gfx;
75   UINT16 sy=0,ma=0,x;
76   UINT8 *FNT = memory_region(screen->machine, "gfx1");
77 
78   framecnt++;
79 
80   for (y = 0; y < 24; y++)
81   {
82      for (ra = 0; ra < 10; ra++)
83      {
84         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
85 
86         for (x = ma; x < ma + 80; x++)
87         {
88            if (ra < 8)
89            {
90               chr = videoram[x];
91 
92               /* Take care of flashing characters */
93               if ((chr > 0x7f) && (framecnt & 0x08))
94                  chr |= 0x80;
95 
96               /* get pattern of pixels for that character scanline */
97               gfx = FNT[(chr<<3) | ra ];
98            }
99            else
100               gfx = 0xff;
101 
102            /* Display a scanline of a character (7 pixels) */
103            *p = ( gfx & 0x40 ) ? 0 : 1; p++;
104            *p = ( gfx & 0x20 ) ? 0 : 1; p++;
105            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
106            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
107            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
108            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
109            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
110         }
111      }
112      ma+=128;
113   }
114   return 0;
115}
116 
117READ8_HANDLER( kaypro_videoram_r )
118{
119   return videoram[offset];
120}
121 
122WRITE8_HANDLER( kaypro_videoram_w )
123{
124   videoram[offset] = data;
125}
1
2#include "driver.h"
3
4
5/***********************************************************
6
7   Video
8
9************************************************************/
10
11PALETTE_INIT( kaypro )
12{
13   palette_set_color(machine,0,RGB_BLACK); /* black */
14   palette_set_color(machine,1,MAKE_RGB(0, 220, 0)); /* green */   
15}
16
17VIDEO_UPDATE( kayproii )
18{
19/* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram,
20   but only the first 80 are used. The total video ram therefore is 0x0c00 bytes.
21   There is one video attribute: bit 7 causes blinking. The first half of the
22   character generator is blank, with the visible characters in the 2nd half.
23   During the "off" period of blanking, the first half is used. Only 5 pixels are
24   connected from the rom to the shift register, the remaining pixels are held high.
25   A high pixel is black and a low pixel is green. */
26
27   static UINT8 framecnt=0;
28   UINT8 y,ra,chr,gfx;
29   UINT16 sy=0,ma=0,x;
30   UINT8 *FNT = memory_region(screen->machine, "gfx1");
31
32   framecnt++;
33
34   for (y = 0; y < 24; y++)
35   {
36      for (ra = 0; ra < 10; ra++)
37      {
38         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
39
40         for (x = ma; x < ma + 80; x++)
41         {
42            if (ra < 8)
43            {
44               chr = videoram[x]^0x80;
45
46               /* Take care of flashing characters */
47               if ((chr < 0x80) && (framecnt & 0x08))
48                  chr |= 0x80;
49
50               /* get pattern of pixels for that character scanline */
51               gfx = FNT[(chr<<3) | ra ];
52            }
53            else
54               gfx = 0xff;
55
56            /* Display a scanline of a character (7 pixels) */
57            *p = 0; p++;
58            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
59            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
60            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
61            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
62            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
63            *p = 0; p++;
64         }
65      }
66      ma+=128;
67   }
68   return 0;
69}
70
71VIDEO_UPDATE( omni2 )
72{
73   static UINT8 framecnt=0;
74   UINT8 y,ra,chr,gfx;
75   UINT16 sy=0,ma=0,x;
76   UINT8 *FNT = memory_region(screen->machine, "gfx1");
77
78   framecnt++;
79
80   for (y = 0; y < 24; y++)
81   {
82      for (ra = 0; ra < 10; ra++)
83      {
84         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
85
86         for (x = ma; x < ma + 80; x++)
87         {
88            if (ra < 8)
89            {
90               chr = videoram[x];
91
92               /* Take care of flashing characters */
93               if ((chr > 0x7f) && (framecnt & 0x08))
94                  chr |= 0x80;
95
96               /* get pattern of pixels for that character scanline */
97               gfx = FNT[(chr<<3) | ra ];
98            }
99            else
100               gfx = 0xff;
101
102            /* Display a scanline of a character (7 pixels) */
103            *p = ( gfx & 0x40 ) ? 0 : 1; p++;
104            *p = ( gfx & 0x20 ) ? 0 : 1; p++;
105            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
106            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
107            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
108            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
109            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
110         }
111      }
112      ma+=128;
113   }
114   return 0;
115}
116#if 0
117const mc6845_interface kaypro2x_crtc = {
118   "screen",         /* name of screen */
119   7,            /* number of dots per character */
120   NULL,
121   kaypro2x_update_row,      /* handler to display a scanline */
122   NULL,
123   NULL,
124   NULL,
125   NULL
126};
127#endif
128READ8_HANDLER( kaypro_videoram_r )
129{
130   return videoram[offset];
131}
132
133WRITE8_HANDLER( kaypro_videoram_w )
134{
135   videoram[offset] = data;
136}
src/mess/includes/z80ne.h
r4517r4518
1/*****************************************************************************
2 *
3 * includes/z80ne.h
4 *
5 * Nuova Elettronica Z80NE
6 *
7 * http://www.z80ne.com/
8 *
9 ****************************************************************************/
10 
11#ifndef Z80NE_H_
12#define Z80NE_H_
13 
14/***************************************************************************
15    CONSTANTS
16***************************************************************************/
17 
18#define Z80NE_CPU_SPEED_HZ      1920000   /* 1.92 MHz */
19 
20#define LX383_KEYS         16
21#define LX383_DOWNSAMPLING   16
22 
23#define LX385_TAPE_SAMPLE_FREQ 38400
24 
25 
26/*----------- defined in video/z80ne.c -----------*/
27 
28VIDEO_START(lx388);
29 
30READ8_HANDLER(lx383_r);
31WRITE8_HANDLER(lx383_w);
32READ8_HANDLER(lx385_data_r);
33WRITE8_HANDLER(lx385_data_w);
34READ8_HANDLER(lx385_ctrl_r);
35WRITE8_HANDLER(lx385_ctrl_w);
36READ8_HANDLER(lx388_data_r);
37READ8_HANDLER(lx388_read_field_sync);
38 
39DRIVER_INIT(z80ne);
40DRIVER_INIT(z80net);
41DRIVER_INIT(z80netb);
42MACHINE_RESET(z80ne);
43MACHINE_RESET(z80net);
44MACHINE_RESET(z80netb);
45MACHINE_START(z80ne);
46MACHINE_START(z80net);
47MACHINE_START(z80netb);
48 
49INPUT_CHANGED(z80ne_reset);
50INPUT_CHANGED(z80ne_nmi);
51 
52#endif /* Z80NE_H_ */
1/*****************************************************************************
2 *
3 * includes/z80ne.h
4 *
5 * Nuova Elettronica Z80NE
6 *
7 * http://www.z80ne.com/
8 *
9 ****************************************************************************/
10
11#ifndef Z80NE_H_
12#define Z80NE_H_
13
14/***************************************************************************
15    CONSTANTS
16***************************************************************************/
17
18#define Z80NE_CPU_SPEED_HZ      1920000   /* 1.92 MHz */
19
20#define LX383_KEYS         16
21#define LX383_DOWNSAMPLING   16
22
23#define LX385_TAPE_SAMPLE_FREQ 38400
24
25
26/*----------- defined in video/z80ne.c -----------*/
27
28VIDEO_START(lx388);
29
30READ8_HANDLER(lx383_r);
31WRITE8_HANDLER(lx383_w);
32READ8_HANDLER(lx385_data_r);
33WRITE8_HANDLER(lx385_data_w);
34READ8_HANDLER(lx385_ctrl_r);
35WRITE8_HANDLER(lx385_ctrl_w);
36READ8_HANDLER(lx388_data_r);
37READ8_HANDLER(lx388_read_field_sync);
38
39DRIVER_INIT(z80ne);
40DRIVER_INIT(z80net);
41DRIVER_INIT(z80netb);
42MACHINE_RESET(z80ne);
43MACHINE_RESET(z80net);
44MACHINE_RESET(z80netb);
45MACHINE_START(z80ne);
46MACHINE_START(z80net);
47MACHINE_START(z80netb);
48
49INPUT_CHANGED(z80ne_reset);
50INPUT_CHANGED(z80ne_nmi);
51
52#endif /* Z80NE_H_ */
src/mess/includes/kaypro.h
r4517r4518
1/* machine.c */
2 
3extern const z80pio_interface kaypro2_pio_g_intf;
4extern const z80pio_interface kaypro2_pio_s_intf;
5extern const z80sio_interface kaypro2_sio_intf;
6extern const wd17xx_interface kaypro2_wd1793_interface;
7 
8READ8_DEVICE_HANDLER( kaypro2_pio_r );
9READ8_DEVICE_HANDLER( kaypro2_sio_r );
10 
11WRITE8_DEVICE_HANDLER( kaypro2_pio_w );
12WRITE8_HANDLER( kaypro2_baud_a_w );
13WRITE8_HANDLER( kaypro2_baud_b_w );
14WRITE8_DEVICE_HANDLER( kaypro2_sio_w );
15 
16void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
17MACHINE_RESET( kayproii );
18 
19 
20/* video.c */
21 
22PALETTE_INIT( kaypro );
23VIDEO_UPDATE( kayproii );
24VIDEO_UPDATE( omni2 );
25READ8_HANDLER( kaypro_videoram_r );
26WRITE8_HANDLER( kaypro_videoram_w );
1/* machine.c */
2
3extern const z80pio_interface kaypro2_pio_g_intf;
4extern const z80pio_interface kaypro2_pio_s_intf;
5extern const z80sio_interface kaypro2_sio_intf;
6extern const wd17xx_interface kaypro2_wd1793_interface;
7
8READ8_DEVICE_HANDLER( kaypro2_pio_r );
9READ8_DEVICE_HANDLER( kaypro2_sio_r );
10
11WRITE8_DEVICE_HANDLER( kaypro2_pio_w );
12WRITE8_HANDLER( kaypro2_baud_a_w );
13WRITE8_HANDLER( kaypro2_baud_b_w );
14WRITE8_DEVICE_HANDLER( kaypro2_sio_w );
15
16void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
17MACHINE_RESET( kayproii );
18
19
20/* video.c */
21
22PALETTE_INIT( kaypro );
23VIDEO_UPDATE( kayproii );
24VIDEO_UPDATE( omni2 );
25READ8_HANDLER( kaypro_videoram_r );
26WRITE8_HANDLER( kaypro_videoram_w );
src/mess/messdriv.c
r4517r4518
598598   /* NON LINEAR SYSTEMS */
599599   DRIVER( kaypro2x )   /* Kaypro 2 - 2/84 */
600600   DRIVER( kayproii )   /* Kaypro II - 2/83 */
601   DRIVER( kaypro4 )   /* Kaypro 4 - 4/83 */
601602   DRIVER( kaypro10 )   /* Kaypro 10 */
602603   DRIVER( omni2 )      /* Omni II */
603604
src/mess/machine/kr2376.c
r4517r4518
1/**********************************************************************
2 
3    SMC KR2376 Keyboard Encoder emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************/
9 
10#include "driver.h"
11#include "kr2376.h"
12 
13static const UINT8 KR2376_KEY_CODES[3][8][11] =
14{
15   // normal
16   {
17      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
18      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x50, 0x30 }, // X0
19      { 0x10, 0x4b, 0x4c, 0x4e, 0x4d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
20      { 0x2d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2
21      { 0x30, 0x3a, 0x70, 0x5f, 0x40, 0x08, 0x5B, 0x5d, 0x0d, 0x0a, 0x7f }, // X3
22      { 0x3b, 0x2f, 0x2e, 0x2c, 0x6d, 0x6e, 0x62, 0x76, 0x63, 0x78, 0x7a }, // X4
23      { 0x6c, 0x6b, 0x6a, 0x68, 0x67, 0x66, 0x64, 0x73, 0x61, 0x0c, 0x1b }, // X5
24      { 0x6f, 0x69, 0x75, 0x79, 0x74, 0x72, 0x65, 0x77, 0x71, 0x09, 0x0b }, // X6
25      { 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x5e, 0x5c }  // X7
26   },
27 
28   // shift
29   {
30      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
31      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x40, 0x5f }, // X0
32      { 0x10, 0x5b, 0x60, 0x5e, 0x5d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
33      { 0x3d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2
34      { 0x00, 0x2a, 0x50, 0x7f, 0x60, 0x08, 0x7B, 0x7d, 0x0d, 0x0a, 0x7f }, // X3
35      { 0x2b, 0x3f, 0x3e, 0x3c, 0x4d, 0x4e, 0x42, 0x56, 0x43, 0x58, 0x5a }, // X4
36      { 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x46, 0x44, 0x53, 0x41, 0x0c, 0x1b }, // X5
37      { 0x4f, 0x49, 0x55, 0x59, 0x54, 0x52, 0x45, 0x57, 0x51, 0x09, 0x0b }, // X6
38      { 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x7e, 0x7c }  // X7
39   },
40 
41   // control
42   {
43      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
44      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x10, 0x0f }, // X0
45      { 0x10, 0x0b, 0x0c, 0x0e, 0x0d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
46      { 0x00, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x1f }, // X2
47      { 0x00, 0x00, 0x10, 0x1f, 0x00, 0x08, 0x1B, 0x1d, 0x0d, 0x0a, 0x7f }, // X3
48      { 0x00, 0x00, 0x00, 0x00, 0x1d, 0x0e, 0x02, 0x16, 0x03, 0x18, 0x1a }, // X4
49      { 0x0c, 0x0b, 0x0a, 0x08, 0x07, 0x06, 0x04, 0x13, 0x01, 0x0c, 0x1b }, // X5
50      { 0x1f, 0x09, 0x15, 0x19, 0x14, 0x12, 0x05, 0x17, 0x11, 0x09, 0x0b }, // X6
51      { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1c }  // X7
52   }
53};
54 
55typedef struct _kr2376_t kr2376_t;
56struct _kr2376_t
57{
58   const kr2376_interface *intf;
59   int   pins[41];
60 
61   int ring11;                  /* sense input scan counter */
62   int ring8;                  /* drive output scan counter */
63   int modifiers;               /* modifier inputs */
64 
65   int strobe;                  /* strobe output */
66   int strobe_old;
67   int parity;
68   int data;
69 
70   /* timers */
71   emu_timer *scan_timer;         /* keyboard scan timer */
72};
73 
74INLINE kr2376_t *get_safe_token(const device_config *device)
75{
76   assert(device != NULL);
77   assert(device->token != NULL);
78 
79   return (kr2376_t *)device->token;
80}
81 
82/*-------------------------------------------------
83    kr2376_set_input_pin - set an input pin
84-------------------------------------------------*/
85void kr2376_set_input_pin( const device_config *device, kr2376_input_pin_t pin, int data )
86{
87   kr2376_t *kr2376 = get_safe_token(device);
88 
89   data = data ? 1 : 0;
90   switch ( pin )
91   {
92   case KR2376_PII:
93   case KR2376_DSII:
94      kr2376->pins[pin] = data;
95      break;
96   }
97}
98 
99 
100/*-------------------------------------------------
101    kr2376_get_output_pin - get the status of an output pin
102-------------------------------------------------*/
103int kr2376_get_output_pin( const device_config *device, kr2376_output_pin_t pin )
104{
105   kr2376_t   *kr2376 = get_safe_token(device);
106 
107   return kr2376->pins[pin];
108}
109 
110 
111static void change_output_lines(const device_config *device)
112{
113   kr2376_t *kr2376 = get_safe_token(device);
114 
115   if (kr2376->strobe != kr2376->strobe_old)
116   {
117      kr2376->strobe_old = kr2376->strobe;
118 
119      if (kr2376->strobe) // strobe 0 --> 1 transition
120      {
121         /* update parity */
122         kr2376->pins[KR2376_PO] = kr2376->parity ^ kr2376->pins[KR2376_PII];
123      }
124      kr2376->pins[KR2376_SO] = kr2376->strobe ^ kr2376->pins[KR2376_DSII];
125      if (kr2376->intf->on_strobe_changed)
126         kr2376->intf->on_strobe_changed(device, 0, kr2376->strobe ^ kr2376->pins[KR2376_DSII]);
127   }
128}
129 
130static void clock_scan_counters(const device_config *device)
131{
132   kr2376_t *kr2376 = get_safe_token(device);
133 
134   /* ring counters inhibited while strobe active */
135   if (!kr2376->strobe)
136   {
137      kr2376->ring11++;
138      if (kr2376->ring11 == 11)
139      {
140         kr2376->ring11 = 0;
141         kr2376->ring8++;
142         if (kr2376->ring8 == 8)
143            kr2376->ring8 = 0;
144      }
145   }
146}
147 
148static void detect_keypress(const device_config *device)
149{
150   kr2376_t *kr2376= get_safe_token(device);
151 
152   static const char *const keynames[] = { "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7" };
153 
154   if (input_port_read(device->machine, keynames[kr2376->ring8]) == (1 << kr2376->ring11))
155   {
156      kr2376->modifiers = input_port_read(device->machine, "MODIFIERS");
157 
158      kr2376->strobe = 1;
159      /*  strobe 0->1 transition, encode char and update parity */
160      if (!kr2376->strobe_old)
161      {
162         int i;
163         int parbit;
164         int shift = BIT(kr2376->modifiers, 0);
165         int control = BIT(kr2376->modifiers, 1);
166         int alpha = BIT(kr2376->modifiers, 2);
167         int table = 0;
168 
169         if (shift || alpha)
170            table = 1;
171         else if (control)
172            table = 2;
173 
174         kr2376->data = KR2376_KEY_CODES[table][kr2376->ring8][kr2376->ring11];
175 
176         /* Compute ODD parity */
177         kr2376->parity = kr2376->data;
178         parbit = 0;
179         for (i=0; i<8; i++)
180            parbit ^= (kr2376->parity >> i) & 1;
181         kr2376->parity = parbit;
182      }
183   }
184   else
185   {
186      kr2376->strobe = 0;
187   }
188}
189 
190static TIMER_CALLBACK( kr2376_scan_tick )
191{
192   const device_config *device = ptr;
193 
194   change_output_lines(device);
195   clock_scan_counters(device);
196   detect_keypress(device);
197}
198 
199/* Keyboard Data */
200 
201READ8_DEVICE_HANDLER( kr2376_data_r )
202{
203   kr2376_t *kr2376 = get_safe_token(device);
204 
205   if (kr2376->pins[KR2376_DSII])
206      return kr2376->data ^ 0xff;
207   else
208      return kr2376->data;
209}
210 
211/* Input Ports */
212 
213INPUT_PORTS_START( kr2376 )
214   PORT_START("X0")
215   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
216   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
217   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
218   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
219   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
220   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
221   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
222   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
223   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
224   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
225   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
226 
227   PORT_START("X1")
228   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
229   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
230   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
232   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
233   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
234   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
235   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
236   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
237   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
238   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
239 
240 
241   PORT_START("X2")
242   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
243   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
244   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
245   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
246   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
247   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
248   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
249   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
250   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
251   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
252   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
253 
254   PORT_START("X3")
255   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
256   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
257   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
258   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- Delete") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_')
259   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`')
260   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
261   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
262   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
263   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Carriage Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
264   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10)
265   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL)
266 
267   PORT_START("X4")
268   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+')
269   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
270   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
271   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
272   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
273   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
274   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
275   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
276   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
277   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
278   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
279 
280 
281   PORT_START("X5")
282   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
283   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
284   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
285   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
286   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
287   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
288   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
289   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
290   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
291   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
292   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
293 
294 
295   PORT_START("X6")
296   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
297   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
298   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
299   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
300   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
301   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
302   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
303   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
304   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
305 
306   PORT_START("X7")
307   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
308   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
309   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xFFFD)
310   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
311   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
312   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
313   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
314   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
315   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
316   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~')
317   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
318 
319   PORT_START("MODIFIERS")
320   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
321   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
322   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
323INPUT_PORTS_END
324 
325 
326static DEVICE_START( kr2376 )
327{
328   kr2376_t *kr2376 = get_safe_token(device);
329 
330   /* validate arguments */
331   assert(device != NULL);
332   assert(device->tag != NULL);
333 
334   kr2376->intf = device->static_config;
335 
336   assert(kr2376->intf != NULL);
337   assert(kr2376->intf->clock > 0);
338 
339   /* set initial values */
340   kr2376->ring11 = 0;
341   kr2376->ring8 = 0;
342   kr2376->modifiers = 0;
343   kr2376->strobe = 0;
344   kr2376->strobe_old = 0;
345   kr2376->parity = 0;
346   kr2376->data = 0;
347   change_output_lines(device);
348 
349   /* create the timers */
350   kr2376->scan_timer = timer_alloc(device->machine, kr2376_scan_tick, (void *)device);
351   timer_adjust_periodic(kr2376->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(kr2376->intf->clock));
352 
353   /* register for state saving */
354   state_save_register_device_item(device, 0, kr2376->ring11);
355   state_save_register_device_item(device, 0, kr2376->ring8);
356   state_save_register_device_item(device, 0, kr2376->modifiers);
357   state_save_register_device_item(device, 0, kr2376->strobe);
358   state_save_register_device_item(device, 0, kr2376->strobe_old);
359   state_save_register_device_item(device, 0, kr2376->parity);
360   state_save_register_device_item(device, 0, kr2376->data);
361}
362 
363static DEVICE_SET_INFO( kr2376 )
364{
365   switch (state)
366   {
367      /* no parameters to set */
368   }
369}
370 
371DEVICE_GET_INFO( kr2376 )
372{
373   switch (state)
374   {
375      /* --- the following bits of info are returned as 64-bit signed integers --- */
376      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(kr2376_t);            break;
377      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
378      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
379 
380      /* --- the following bits of info are returned as pointers to data or functions --- */
381      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(kr2376); break;
382      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(kr2376);   break;
383      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
384      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
385 
386      /* --- the following bits of info are returned as NULL-terminated strings --- */
387      case DEVINFO_STR_NAME:                     strcpy(info->s, "SMC KR2376");               break;
388      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "SMC");               break;
389      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
390      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
391      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
392   }
393}
1/**********************************************************************
2
3    SMC KR2376 Keyboard Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "driver.h"
11#include "kr2376.h"
12
13static const UINT8 KR2376_KEY_CODES[3][8][11] =
14{
15   // normal
16   {
17      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
18      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x50, 0x30 }, // X0
19      { 0x10, 0x4b, 0x4c, 0x4e, 0x4d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
20      { 0x2d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2
21      { 0x30, 0x3a, 0x70, 0x5f, 0x40, 0x08, 0x5B, 0x5d, 0x0d, 0x0a, 0x7f }, // X3
22      { 0x3b, 0x2f, 0x2e, 0x2c, 0x6d, 0x6e, 0x62, 0x76, 0x63, 0x78, 0x7a }, // X4
23      { 0x6c, 0x6b, 0x6a, 0x68, 0x67, 0x66, 0x64, 0x73, 0x61, 0x0c, 0x1b }, // X5
24      { 0x6f, 0x69, 0x75, 0x79, 0x74, 0x72, 0x65, 0x77, 0x71, 0x09, 0x0b }, // X6
25      { 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x5e, 0x5c }  // X7
26   },
27
28   // shift
29   {
30      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
31      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x40, 0x5f }, // X0
32      { 0x10, 0x5b, 0x60, 0x5e, 0x5d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
33      { 0x3d, 0x1c, 0x1d, 0x1e, 0x1f, 0x3c, 0x3e, 0x2c, 0x20, 0x2e, 0x5f }, // X2
34      { 0x00, 0x2a, 0x50, 0x7f, 0x60, 0x08, 0x7B, 0x7d, 0x0d, 0x0a, 0x7f }, // X3
35      { 0x2b, 0x3f, 0x3e, 0x3c, 0x4d, 0x4e, 0x42, 0x56, 0x43, 0x58, 0x5a }, // X4
36      { 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x46, 0x44, 0x53, 0x41, 0x0c, 0x1b }, // X5
37      { 0x4f, 0x49, 0x55, 0x59, 0x54, 0x52, 0x45, 0x57, 0x51, 0x09, 0x0b }, // X6
38      { 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x7e, 0x7c }  // X7
39   },
40
41   // control
42   {
43      //  Y0    Y1    Y2    Y3    Y4    Y5    Y6    Y7    Y8    Y9   Y10
44      { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x10, 0x0f }, // X0
45      { 0x10, 0x0b, 0x0c, 0x0e, 0x0d, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a }, // X1
46      { 0x00, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x1f }, // X2
47      { 0x00, 0x00, 0x10, 0x1f, 0x00, 0x08, 0x1B, 0x1d, 0x0d, 0x0a, 0x7f }, // X3
48      { 0x00, 0x00, 0x00, 0x00, 0x1d, 0x0e, 0x02, 0x16, 0x03, 0x18, 0x1a }, // X4
49      { 0x0c, 0x0b, 0x0a, 0x08, 0x07, 0x06, 0x04, 0x13, 0x01, 0x0c, 0x1b }, // X5
50      { 0x1f, 0x09, 0x15, 0x19, 0x14, 0x12, 0x05, 0x17, 0x11, 0x09, 0x0b }, // X6
51      { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1c }  // X7
52   }
53};
54
55typedef struct _kr2376_t kr2376_t;
56struct _kr2376_t
57{
58   const kr2376_interface *intf;
59   int   pins[41];
60
61   int ring11;                  /* sense input scan counter */
62   int ring8;                  /* drive output scan counter */
63   int modifiers;               /* modifier inputs */
64
65   int strobe;                  /* strobe output */
66   int strobe_old;
67   int parity;
68   int data;
69
70   /* timers */
71   emu_timer *scan_timer;         /* keyboard scan timer */
72};
73
74INLINE kr2376_t *get_safe_token(const device_config *device)
75{
76   assert(device != NULL);
77   assert(device->token != NULL);
78
79   return (kr2376_t *)device->token;
80}
81
82/*-------------------------------------------------
83    kr2376_set_input_pin - set an input pin
84-------------------------------------------------*/
85void kr2376_set_input_pin( const device_config *device, kr2376_input_pin_t pin, int data )
86{
87   kr2376_t *kr2376 = get_safe_token(device);
88
89   data = data ? 1 : 0;
90   switch ( pin )
91   {
92   case KR2376_PII:
93   case KR2376_DSII:
94      kr2376->pins[pin] = data;
95      break;
96   }
97}
98
99
100/*-------------------------------------------------
101    kr2376_get_output_pin - get the status of an output pin
102-------------------------------------------------*/
103int kr2376_get_output_pin( const device_config *device, kr2376_output_pin_t pin )
104{
105   kr2376_t   *kr2376 = get_safe_token(device);
106
107   return kr2376->pins[pin];
108}
109
110
111static void change_output_lines(const device_config *device)
112{
113   kr2376_t *kr2376 = get_safe_token(device);
114
115   if (kr2376->strobe != kr2376->strobe_old)
116   {
117      kr2376->strobe_old = kr2376->strobe;
118
119      if (kr2376->strobe) // strobe 0 --> 1 transition
120      {
121         /* update parity */
122         kr2376->pins[KR2376_PO] = kr2376->parity ^ kr2376->pins[KR2376_PII];
123      }
124      kr2376->pins[KR2376_SO] = kr2376->strobe ^ kr2376->pins[KR2376_DSII];
125      if (kr2376->intf->on_strobe_changed)
126         kr2376->intf->on_strobe_changed(device, 0, kr2376->strobe ^ kr2376->pins[KR2376_DSII]);
127   }
128}
129
130static void clock_scan_counters(const device_config *device)
131{
132   kr2376_t *kr2376 = get_safe_token(device);
133
134   /* ring counters inhibited while strobe active */
135   if (!kr2376->strobe)
136   {
137      kr2376->ring11++;
138      if (kr2376->ring11 == 11)
139      {
140         kr2376->ring11 = 0;
141         kr2376->ring8++;
142         if (kr2376->ring8 == 8)
143            kr2376->ring8 = 0;
144      }
145   }
146}
147
148static void detect_keypress(const device_config *device)
149{
150   kr2376_t *kr2376= get_safe_token(device);
151
152   static const char *const keynames[] = { "X0", "X1", "X2", "X3", "X4", "X5", "X6", "X7" };
153
154   if (input_port_read(device->machine, keynames[kr2376->ring8]) == (1 << kr2376->ring11))
155   {
156      kr2376->modifiers = input_port_read(device->machine, "MODIFIERS");
157
158      kr2376->strobe = 1;
159      /*  strobe 0->1 transition, encode char and update parity */
160      if (!kr2376->strobe_old)
161      {
162         int i;
163         int parbit;
164         int shift = BIT(kr2376->modifiers, 0);
165         int control = BIT(kr2376->modifiers, 1);
166         int alpha = BIT(kr2376->modifiers, 2);
167         int table = 0;
168
169         if (shift || alpha)
170            table = 1;
171         else if (control)
172            table = 2;
173
174         kr2376->data = KR2376_KEY_CODES[table][kr2376->ring8][kr2376->ring11];
175
176         /* Compute ODD parity */
177         kr2376->parity = kr2376->data;
178         parbit = 0;
179         for (i=0; i<8; i++)
180            parbit ^= (kr2376->parity >> i) & 1;
181         kr2376->parity = parbit;
182      }
183   }
184   else
185   {
186      kr2376->strobe = 0;
187   }
188}
189
190static TIMER_CALLBACK( kr2376_scan_tick )
191{
192   const device_config *device = ptr;
193
194   change_output_lines(device);
195   clock_scan_counters(device);
196   detect_keypress(device);
197}
198
199/* Keyboard Data */
200
201READ8_DEVICE_HANDLER( kr2376_data_r )
202{
203   kr2376_t *kr2376 = get_safe_token(device);
204
205   if (kr2376->pins[KR2376_DSII])
206      return kr2376->data ^ 0xff;
207   else
208      return kr2376->data;
209}
210
211/* Input Ports */
212
213INPUT_PORTS_START( kr2376 )
214   PORT_START("X0")
215   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
216   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
217   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
218   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
219   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
220   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
221   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
222   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
223   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
224   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
225   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
226
227   PORT_START("X1")
228   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
229   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
230   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
232   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
233   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
234   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
235   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
236   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
237   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
238   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
239
240
241   PORT_START("X2")
242   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
243   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
244   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
245   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
246   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
247   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
248   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
249   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
250   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
251   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
252   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
253
254   PORT_START("X3")
255   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
256   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
257   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
258   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- Delete") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_')
259   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`')
260   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
261   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
262   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
263   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Carriage Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
264   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10)
265   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL)
266
267   PORT_START("X4")
268   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+')
269   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
270   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
271   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
272   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
273   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
274   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
275   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
276   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
277   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
278   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
279
280
281   PORT_START("X5")
282   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
283   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
284   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
285   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
286   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
287   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
288   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
289   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
290   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
291   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
292   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
293
294
295   PORT_START("X6")
296   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
297   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
298   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
299   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
300   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
301   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
302   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
303   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
304   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
305
306   PORT_START("X7")
307   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
308   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
309   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xFFFD)
310   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
311   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
312   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
313   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
314   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
315   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
316   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~')
317   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
318
319   PORT_START("MODIFIERS")
320   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
321   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
322   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
323INPUT_PORTS_END
324
325
326static DEVICE_START( kr2376 )
327{
328   kr2376_t *kr2376 = get_safe_token(device);
329
330   /* validate arguments */
331   assert(device != NULL);
332   assert(device->tag != NULL);
333
334   kr2376->intf = device->static_config;
335
336   assert(kr2376->intf != NULL);
337   assert(kr2376->intf->clock > 0);
338
339   /* set initial values */
340   kr2376->ring11 = 0;
341   kr2376->ring8 = 0;
342   kr2376->modifiers = 0;
343   kr2376->strobe = 0;
344   kr2376->strobe_old = 0;
345   kr2376->parity = 0;
346   kr2376->data = 0;
347   change_output_lines(device);
348
349   /* create the timers */
350   kr2376->scan_timer = timer_alloc(device->machine, kr2376_scan_tick, (void *)device);
351   timer_adjust_periodic(kr2376->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(kr2376->intf->clock));
352
353   /* register for state saving */
354   state_save_register_device_item(device, 0, kr2376->ring11);
355   state_save_register_device_item(device, 0, kr2376->ring8);
356   state_save_register_device_item(device, 0, kr2376->modifiers);
357   state_save_register_device_item(device, 0, kr2376->strobe);
358   state_save_register_device_item(device, 0, kr2376->strobe_old);
359   state_save_register_device_item(device, 0, kr2376->parity);
360   state_save_register_device_item(device, 0, kr2376->data);
361}
362
363static DEVICE_SET_INFO( kr2376 )
364{
365   switch (state)
366   {
367      /* no parameters to set */
368   }
369}
370
371DEVICE_GET_INFO( kr2376 )
372{
373   switch (state)
374   {
375      /* --- the following bits of info are returned as 64-bit signed integers --- */
376      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(kr2376_t);            break;
377      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
378      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
379
380      /* --- the following bits of info are returned as pointers to data or functions --- */
381      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(kr2376); break;
382      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(kr2376);   break;
383      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
384      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
385
386      /* --- the following bits of info are returned as NULL-terminated strings --- */
387      case DEVINFO_STR_NAME:                     strcpy(info->s, "SMC KR2376");               break;
388      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "SMC");               break;
389      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
390      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
391      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
392   }
393}
src/mess/machine/kr2376.h
r4517r4518
1/**********************************************************************
2 
3    SMC XR2376 Keyboard Encoder emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************
9                     _____   _____
10               Vcc    1 |*    \_/     | 40  Frequency Control A
11   Frequency Control B     2 |          | 39  X0
12   Frequency Control C    3 |          | 38  X1
13         Shift Input    4 |          | 37  X2
14       Control Input    5 |          | 36  X3
15   Parity Invert Input    6 |          | 35  X4
16       Parity Output    7 |          | 34  X5
17      Data Output B8    8 |          | 33  X6
18      Data Output B7    9 |          | 32  X7
19      Data Output B6   10 |   CDP1871    | 31  Y0
20      Data Output B5   11 |          | 30  Y1
21      Data Output B4   12 |          | 29  Y2
22      Data Output B3   13 |          | 28  Y3
23      Data Output B2   14 |          | 27  Y4
24      Data Output B1   15 |          | 26  Y5
25       Strobe Output   16 |          | 25  Y6
26            Ground   17 |          | 24  Y7
27               Vgg   18 |          | 23  Y8
28  Strobe Control Input   19 |          | 22  Y9
29        Invert Input  20 |_____________| 21  Y10
30 
31**********************************************************************/
32 
33#ifndef __KR2376__
34#define __KR2376__
35 
36typedef void (*kr2376_on_strobe_changed_func) (const device_config *device, int level);
37#define KR2376_ON_STROBE_CHANGED(name) void name(const device_config *device, int level)
38 
39#define KR2376      DEVICE_GET_INFO_NAME(kr2376)
40 
41#define MDRV_KR2376_ADD(_tag, _intrf) \
42   MDRV_DEVICE_ADD(_tag, KR2376, 0) \
43   MDRV_DEVICE_CONFIG(_intrf)
44 
45#define MDRV_KR2376_REMOVE(_tag) \
46   MDRV_DEVICE_REMOVE(_tag, KR2376)
47 
48/*
49 * Input pins
50 */
51typedef enum
52{
53   KR2376_DSII=20,         /* DSII  - Pin 20 - Data & Strobe Invert Input */
54   KR2376_PII=6         /* PII   - Pin  6 - Parity Invert Input */
55} kr2376_input_pin_t;
56 
57typedef enum
58{
59   KR2376_SO=16,         /* SO    - Pin 16 - Strobe Output */
60   KR2376_PO=7         /* PO    - Pin  7 - Parity Output */
61} kr2376_output_pin_t;
62 
63/* interface */
64typedef struct _kr2376_interface kr2376_interface;
65struct _kr2376_interface
66{
67   /* The clock of the chip (Typical 50 kHz) */
68   int clock;
69 
70   /* This will be called for every change of the strobe pin (pin 16). Optional */
71//   kr2376_on_strobe_changed_func      on_strobe_changed;
72   write8_device_func   on_strobe_changed;
73};
74#define KR2376_INTERFACE(name) const kr2376_interface (name)=
75 
76/* device interface */
77DEVICE_GET_INFO( kr2376 );
78 
79/* keyboard matrix */
80INPUT_PORTS_EXTERN( kr2376 );
81 
82/* keyboard data */
83READ8_DEVICE_HANDLER( kr2376_data_r );
84 
85/* Set an input pin */
86void kr2376_set_input_pin( const device_config *device, kr2376_input_pin_t pin, int data );
87 
88 
89/* Get an output pin */
90int kr2376_get_output_pin( const device_config *device, kr2376_output_pin_t pin );
91 
92#endif
1/**********************************************************************
2
3    SMC XR2376 Keyboard Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               Vcc    1 |*    \_/     | 40  Frequency Control A
11   Frequency Control B     2 |          | 39  X0
12   Frequency Control C    3 |          | 38  X1
13         Shift Input    4 |          | 37  X2
14       Control Input    5 |          | 36  X3
15   Parity Invert Input    6 |          | 35  X4
16       Parity Output    7 |          | 34  X5
17      Data Output B8    8 |          | 33  X6
18      Data Output B7    9 |          | 32  X7
19      Data Output B6   10 |   CDP1871    | 31  Y0
20      Data Output B5   11 |          | 30  Y1
21      Data Output B4   12 |          | 29  Y2
22      Data Output B3   13 |          | 28  Y3
23      Data Output B2   14 |          | 27  Y4
24      Data Output B1   15 |          | 26  Y5
25       Strobe Output   16 |          | 25  Y6
26            Ground   17 |          | 24  Y7
27               Vgg   18 |          | 23  Y8
28  Strobe Control Input   19 |          | 22  Y9
29        Invert Input  20 |_____________| 21  Y10
30
31**********************************************************************/
32
33#ifndef __KR2376__
34#define __KR2376__
35
36typedef void (*kr2376_on_strobe_changed_func) (const device_config *device, int level);
37#define KR2376_ON_STROBE_CHANGED(name) void name(const device_config *device, int level)
38
39#define KR2376      DEVICE_GET_INFO_NAME(kr2376)
40
41#define MDRV_KR2376_ADD(_tag, _intrf) \
42   MDRV_DEVICE_ADD(_tag, KR2376, 0) \
43   MDRV_DEVICE_CONFIG(_intrf)
44
45#define MDRV_KR2376_REMOVE(_tag) \
46   MDRV_DEVICE_REMOVE(_tag, KR2376)
47
48/*
49 * Input pins
50 */
51typedef enum
52{
53   KR2376_DSII=20,         /* DSII  - Pin 20 - Data & Strobe Invert Input */
54   KR2376_PII=6         /* PII   - Pin  6 - Parity Invert Input */
55} kr2376_input_pin_t;
56
57typedef enum
58{
59   KR2376_SO=16,         /* SO    - Pin 16 - Strobe Output */
60   KR2376_PO=7         /* PO    - Pin  7 - Parity Output */
61} kr2376_output_pin_t;
62
63/* interface */
64typedef struct _kr2376_interface kr2376_interface;
65struct _kr2376_interface
66{
67   /* The clock of the chip (Typical 50 kHz) */
68   int clock;
69
70   /* This will be called for every change of the strobe pin (pin 16). Optional */
71//   kr2376_on_strobe_changed_func      on_strobe_changed;
72   write8_device_func   on_strobe_changed;
73};
74#define KR2376_INTERFACE(name) const kr2376_interface (name)=
75
76/* device interface */
77DEVICE_GET_INFO( kr2376 );
78
79/* keyboard matrix */
80INPUT_PORTS_EXTERN( kr2376 );
81
82/* keyboard data */
83READ8_DEVICE_HANDLER( kr2376_data_r );
84
85/* Set an input pin */
86void kr2376_set_input_pin( const device_config *device, kr2376_input_pin_t pin, int data );
87
88
89/* Get an output pin */
90int kr2376_get_output_pin( const device_config *device, kr2376_output_pin_t pin );
91
92#endif
src/mess/machine/kay_kbd.c
r4517r4518
1/******************************************************************************
2 *
3 *   kay_kbd.c
4 *
5 *   Kaypro II Serial Keyboard
6 *
7 *   Most of this is copied from kaypro.c,
8 *   rather than re-inventing the wheel.
9 *
10 *   Juergen Buchmueller, July 1998
11 *   Benjamin C. W. Sittler, July 1998 (new keyboard table)
12 *
13 *   Converted to a serial device (as far as MESS will allow)
14 *   by Robbbert, April 2009.
15 
16   NOTE: THIS IS A WIP, IT DOESN'T DO ANYTHING AT THIS TIME !!
17 *
18 ******************************************************************************/
19 
20#include "driver.h"
21#include "sound/beep.h"
22#include "kay_kbd.h"
23 
24 
25/*
26 * The KAYPRO keyboard has roughly the following layout:
27 *
28 *                                                                  [up] [down] [left] [right]
29 *         [ESC] [1!] [2@] [3#] [4$] [5%] [6^] [7&] [8*] [9(] [0)] [-_] [=+] [`~] [BACK SPACE]
30 *           [TAB] [qQ] [wW] [eE] [rR] [tT] [yY] [uU] [iI] [oO] [pP] [[{] []}]       [DEL]
31 *[CTRL] [CAPS LOCK] [aA] [sS] [dD] [fF] [gG] [hH] [jJ] [kK] [lL] [;:] ['"] [RETURN] [\|]
32 *            [SHIFT] [zZ] [xX] [cC] [vV] [bB] [nN] [mM] [,<] [.>] [/?] [SHIFT] [LINE FEED]
33 *                      [                 SPACE                     ]
34 *
35 * [7] [8] [9] [-]
36 * [4] [5] [6] [,]
37 * [1] [2] [3]
38 * [  0  ] [.] [ENTER]
39 *
40 * Notes on Appearance
41 * -------------------
42 * The RETURN key is shaped like a backwards "L". The keypad ENTER key is actually
43 * oriented vertically, not horizontally. The alpha keys are marked with the uppercase letters
44 * only. Other keys with two symbols have the shifted symbol printed above the unshifted symbol.
45 * The keypad is actually located to the right of the main keyboard; it is shown separately here
46 * as a convenience to users of narrow listing windows. The arrow keys are actually marked with
47 * arrow graphics pointing in the appropriate directions. The F and J keys are specially shaped,
48 * since they are the "home keys" for touch-typing. The CAPS LOCK key has a build-in red indicator
49 * which is lit when CAPS LOCK is pressed once, and extinguished when the key is pressed again.
50 *
51 * Technical Notes
52 * ---------------
53 * The keyboard interfaces to the computer using a serial protocol. Modifier keys are handled
54 * inside the keyboards, as is the CAPS LOCK key. The arrow keys and the numeric keypad send
55 * non-ASCII codes which are not affected by the modifier keys. The remaining keys send the
56 * appropriate ASCII values.
57 *
58 * The keyboard has a built-in buzzer which is activated briefly by a non-modifier keypress,
59 * producing a "clicking" sound for user feedback. Additionally, this buzzer can be activated
60 * for a longer period by sending a 0x04 byte to the keyboard. This is used by the ROM soft
61 * terminal to alert the user in case of a BEL.
62*
63 * 2008-05 FP:
64 * Small note about natural keyboard support: currently,
65 * - "Line Feed" is mapped to the 'End' key
66 * - "Keypad ," is not mapped
67 */
68 
69INPUT_PORTS_START( kay_kbd )
70   PORT_START("ROW0")
71   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)         PORT_CHAR(UCHAR_MAMEKEY(ESC))
72   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)            PORT_CHAR('1') PORT_CHAR('!')
73   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)            PORT_CHAR('2') PORT_CHAR('@')
74   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
75   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
76   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
77   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('^')
78   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)            PORT_CHAR('7') PORT_CHAR('&')
79 
80   PORT_START("ROW1")
81   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('*')
82   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR('(')
83   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR(')')
84   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)          PORT_CHAR('-') PORT_CHAR('_')
85   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)          PORT_CHAR('=') PORT_CHAR('+')
86   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)          PORT_CHAR('`') PORT_CHAR('~')
87   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE")          PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
88   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)          PORT_CHAR('\t')
89 
90   PORT_START("ROW2")
91   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')
92   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')
93   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
94   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
95   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')
96   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
97   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
98   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')
99 
100   PORT_START("ROW3")
101   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
102   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')
103   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)         PORT_CHAR('[') PORT_CHAR('{')
104   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)      PORT_CHAR(']') PORT_CHAR('}')
105   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN")            PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
106   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)   PORT_CHAR(UCHAR_MAMEKEY(DEL)) 
107   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)         PORT_CHAR(UCHAR_SHIFT_2)
108   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK)         PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
109 
110   PORT_START("ROW4")
111   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')
112   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')
113   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')
114   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')
115   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')
116   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')
117   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')
118   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')
119 
120   PORT_START("ROW5")
121   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')
122   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)         PORT_CHAR(';') PORT_CHAR(':')
123   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)         PORT_CHAR('\'') PORT_CHAR('"')
124   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)         PORT_CHAR('\\') PORT_CHAR('|')
125   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)         PORT_CHAR(UCHAR_MAMEKEY(LSHIFT))
126   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
127   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')
128   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')
129 
130   PORT_START("ROW6")
131   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')
132   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')
133   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')
134   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)            PORT_CHAR('m') PORT_CHAR('M')
135   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)         PORT_CHAR(',') PORT_CHAR('<')
136   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)         PORT_CHAR('.') PORT_CHAR('>')
137   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)         PORT_CHAR('/') PORT_CHAR('?')
138   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT)         PORT_CHAR(UCHAR_MAMEKEY(RSHIFT))
139 
140   PORT_START("ROW7")
141   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED")         PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
142   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)         PORT_CHAR(' ')
143   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD)          PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
144   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Keypad ,")         PORT_CODE(KEYCODE_PLUS_PAD)
145   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD)         PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
146   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD)          PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
147   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD)          PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
148   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD)          PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
149 
150   PORT_START("ROW8")
151   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD)          PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
152   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD)          PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
153   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD)          PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
154   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD)          PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
155   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD)          PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
156   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD)          PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
157   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD)          PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
158   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD)         PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
159 
160   PORT_START("ROW9")
161   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91")         PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
162   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93")         PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
163   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90")         PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
164   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92")         PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
165   PORT_BIT(0xf0, 0x00, IPT_UNUSED)
166INPUT_PORTS_END
167 
168static void kay_kbd_in( running_machine *machine, UINT8 data );
169static const device_config *kay_kbd_beeper;
170static UINT8 kbd_buff[16];
171static UINT8 kbd_head = 0;
172static UINT8 kbd_tail = 0;
173static UINT8 beep_on = 0;
174static UINT8 keyrows[10] = { 0,0,0,0,0,0,0,0,0,0 };
175static const char keyboard[8][10][8] = {
176   { /* normal */
177      { 27,'1','2','3','4','5','6','7'},
178      {'8','9','0','-','=','`',  8,  9},
179      {'q','w','e','r','t','y','u','i'},
180      {'o','p','[',']', 13,127,  0,  0},
181      {'a','s','d','f','g','h','j','k'},
182      {'l',';', 39, 92,  0,'z','x','c'},
183      {'v','b','n','m',',','.','/',  0},
184      { 10, 32, 228, 211, 195, 178, 177, 192},
185      { 193, 194, 208, 209, 210, 225, 226, 227},
186      { 241, 242, 243, 244,  0,  0,  0,  0},
187   },
188   { /* Shift */
189      { 27,'!','@','#','$','%','^','&'},
190      {'*','(',')','_','+','~',  8,  9},
191      {'Q','W','E','R','T','Y','U','I'},
192      {'O','P','{','}', 13,127,  0,  0},
193      {'A','S','D','F','G','H','J','K'},
194      {'L',':','"','|',  0,'Z','X','C'},
195      {'V','B','N','M','<','>','?',  0},
196      { 10, 32, 228, 211, 195, 178, 177, 192},
197      { 193, 194, 208, 209, 210, 225, 226, 227},
198      { 241, 242, 243, 244,  0,  0,  0,  0},
199   },
200   { /* Control */
201      { 27,'1','2','3','4','5','6','7'},
202      {'8','9','0','-','=','`',  8,  9},
203      { 17, 23,  5, 18, 20, 25, 21,  9},
204      { 15, 16, 27, 29, 13,127,  0,  0},
205      {  1, 19,  4,  6,  7,  8, 10, 11},
206      { 12,';', 39, 28,  0, 26, 24,  3},
207      { 22,  2, 14, 13,',','.','/',  0},
208      { 10, 32, 228, 211, 195, 178, 177, 192},
209      { 193, 194, 208, 209, 210, 225, 226, 227},
210      { 241, 242, 243, 244,  0,  0,  0,  0},
211   },
212   { /* Shift+Control */
213      { 27,'!',  0,'#','$','%', 30,'&'},
214      {'*','(',')', 31,'+','~',  8,  9},
215      { 17, 23,  5, 18, 20, 25, 21,  9},
216      { 15, 16, 27, 29, 13,127,  0,  0},
217      {  1, 19,  4,  6,  7,  8, 10, 11},
218      { 12,':','"', 28,  0, 26, 24,  3},
219      { 22,  2, 14, 13,',','.','/',  0},
220      { 10, 32, 228, 211, 195, 178, 177, 192},
221      { 193, 194, 208, 209, 210, 225, 226, 227},
222      { 241, 242, 243, 244,  0,  0,  0,  0},
223   },
224   { /* CapsLock */
225      { 27,'1','2','3','4','5','6','7'},
226      {'8','9','0','-','=','`',  8,  9},
227      {'Q','W','E','R','T','Y','U','I'},
228      {'O','P','[',']', 13,127,  0,  0},
229      {'A','S','D','F','G','H','J','K'},
230      {'L',';', 39, 92,  0,'Z','X','C'},
231      {'V','B','N','M',',','.','/',  0},
232      { 10, 32, 228, 211, 195, 178, 177, 192},
233      { 193, 194, 208, 209, 210, 225, 226, 227},
234      { 241, 242, 243, 244,  0,  0,  0,  0},
235   },
236   { /* Shift+CapsLock */
237      { 27,'!','@','#','$','%','^','&'},
238      {'*','(',')','_','+','~',  8,  9},
239      {'Q','W','E','R','T','Y','U','I'},
240      {'O','P','{','}', 13,127,  0,  0},
241      {'A','S','D','F','G','H','J','K'},
242      {'L',':','"','|',  0,'Z','X','C'},
243      {'V','B','N','M','<','>','?',  0},
244      { 10, 32, 228, 211, 195, 178, 177, 192},
245      { 193, 194, 208, 209, 210, 225, 226, 227},
246      { 241, 242, 243, 244,  0,  0,  0,  0},
247   },
248   { /* Control+CapsLock */
249      { 27,'1','2','3','4','5','6','7'},
250      {'8','9','0','-','=','`',  8,  9},
251      { 17, 23,  5, 18, 20, 25, 21,  9},
252      { 15, 16, 27, 29, 13,127,  0,  0},
253      {  1, 19,  4,  6,  7,  8, 10, 11},
254      { 12,';', 39, 28,  0, 26, 24,  3},
255      { 22,  2, 14, 13,',','.','/',  0},
256      { 10, 32, 228, 211, 195, 178, 177, 192},
257      { 193, 194, 208, 209, 210, 225, 226, 227},
258      { 241, 242, 243, 244,  0,  0,  0,  0},
259   },
260   { /* Shift+Control+CapsLock */
261      { 27,'!',  0,'#','$','%', 30,'&'},
262      {'*','(',')', 31,'+','~',  8,  9},
263      { 17, 23,  5, 18, 20, 25, 21,  9},
264      { 15, 16, 27, 29, 13,127,  0,  0},
265      {  1, 19,  4,  6,  7,  8, 10, 11},
266      { 12,':','"', 28,  0, 26, 24,  3},
267      { 22,  2, 14, 13,',','.','/',  0},
268      { 10, 32, 228, 211, 195, 178, 177, 192},
269      { 193, 194, 208, 209, 210, 225, 226, 227},
270      { 241, 242, 243, 244,  0,  0,  0,  0},
271   },
272};
273 
274MACHINE_RESET( kay_kbd )
275{
276   /* disable CapsLock LED initially */
277   set_led_status(1, 1);
278   set_led_status(1, 0);
279   kay_kbd_beeper = devtag_get_device(machine, "beep");
280   beep_on = 1;
281   beep_set_state(kay_kbd_beeper, 0);
282   beep_set_frequency(kay_kbd_beeper, 950);   /* piezo-device needs to be measured */
283   kbd_head = kbd_tail = 0;         /* init buffer */
284}
285 
286/******************************************************
287 * vertical blank interrupt
288 * used to scan keyboard; newly pressed keys
289 * are stuffed into a keyboard buffer;
290 * also drives keyboard LEDs and
291 * and handles autorepeating keys
292 ******************************************************/
293INTERRUPT_GEN( kay_kbd_interrupt )
294{
295   int mod, row, col, chg, new;
296   static int lastrow = 0, mask = 0x00, key = 0x00, repeat = 0, repeater = 0;
297 
298   if( repeat )
299   {
300      if( !--repeat )
301         repeater = 4;
302   }
303   else
304   if( repeater )
305   {
306      repeat = repeater;
307   }
308 
309   row = 9;
310   new = input_port_read(device->machine, "ROW9");
311   chg = keyrows[row] ^ new;
312 
313   if (!chg) { new = input_port_read(device->machine, "ROW8"); chg = keyrows[--row] ^ new; }
314   if (!chg) { new = input_port_read(device->machine, "ROW7"); chg = keyrows[--row] ^ new; }
315   if (!chg) { new = input_port_read(device->machine, "ROW6"); chg = keyrows[--row] ^ new; }
316   if (!chg) { new = input_port_read(device->machine, "ROW5"); chg = keyrows[--row] ^ new; }
317   if (!chg) { new = input_port_read(device->machine, "ROW4"); chg = keyrows[--row] ^ new; }
318   if (!chg) { new = input_port_read(device->machine, "ROW3"); chg = keyrows[--row] ^ new; }
319   if (!chg) { new = input_port_read(device->machine, "ROW2"); chg = keyrows[--row] ^ new; }
320   if (!chg) { new = input_port_read(device->machine, "ROW1"); chg = keyrows[--row] ^ new; }
321   if (!chg) { new = input_port_read(device->machine, "ROW0"); chg = keyrows[--row] ^ new; }
322   if (!chg) --row;
323 
324   if (row >= 0)
325   {
326      repeater = 0x00;
327      mask = 0x00;
328      key = 0x00;
329      lastrow = row;
330      /* CapsLock LED */
331      if( row == 3 && chg == 0x80 )
332         set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1);
333 
334      if (new & chg)   /* key(s) pressed ? */
335      {
336         mod = 0;
337 
338         /* Shift modifier */
339         if ( (keyrows[5] & 0x10) || (keyrows[6] & 0x80) )
340            mod |= 1;
341 
342         /* Control modifier */
343         if (keyrows[3] & 0x40)
344            mod |= 2;
345 
346         /* CapsLock modifier */
347         if (keyrows[3] & 0x80)
348            mod |= 4;
349 
350         /* find new key */
351         mask = 0x01;
352         for (col = 0; col < 8; col ++)
353         {
354            if (chg & mask)
355            {
356               new &= mask;
357               key = keyboard[mod][row][col];
358               break;
359            }
360            mask <<= 1;
361         }
362         if( key )   /* normal key */
363         {
364            repeater = 30;
365            kay_kbd_in(device->machine, key);
366         }
367         else
368         if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */
369            kay_kbd_in(device->machine, 0);
370         keyrows[row] |= new;
371      }
372      else
373      {
374         keyrows[row] = new;
375      }
376      repeat = repeater;
377   }
378   else if ( key && (keyrows[lastrow] & mask) && repeat == 0 )
379   {
380      kay_kbd_in(device->machine, key);
381   }
382}
383 
384#if 0
385 
386/******************************************************
387 *   kaypro_const_w (write console status ;)
388 *   bit
389 *   0   flush keyboard buffer
390 ******************************************************/
391static WRITE8_HANDLER ( kaypro2_const_w )
392{
393   if (data & 1)
394      kbd_head = kbd_tail = 0;
395}
396 
397#endif
398 
399/******************************************************
400 *   kaypro_conin_w
401 *   stuff character into the keyboard buffer
402 *   releases CPU if it was waiting for a key
403 *   sounds bell if buffer would overflow
404 ******************************************************/
405static void kay_kbd_in( running_machine *machine, UINT8 data )
406{
407   UINT8 kbd_head_old;
408 
409   kbd_head_old = kbd_head;
410   kbd_buff[kbd_head] = data;
411   kbd_head = (kbd_head + 1) % sizeof(kbd_buff);
412   /* will the buffer overflow ? */
413   if (kbd_head == kbd_tail)
414   {
415      kbd_head = kbd_head_old;
416      kay_kbd_d_w(machine, 4);
417   }
418   else
419      kay_kbd_d_w(machine, 1);
420}
421 
422 
423UINT8 kay_kbd_c_r( void )
424{
425/*   d4 transmit buffer empty - 1=ok to send
426   d0 keyboard buffer empty - 1=key waiting to be used */
427 
428   UINT8 data = 0x10;
429 
430   if( kbd_head != kbd_tail )
431      data++;
432 
433   return data;
434}
435 
436UINT8 kay_kbd_d_r( void )
437{
438/* return next key in buffer */
439 
440   UINT8 data = 0;
441 
442   if (kbd_tail != kbd_head)
443   {
444      data = kbd_buff[kbd_tail];
445      kbd_tail = (kbd_tail + 1) % sizeof(kbd_buff);
446   }
447 
448   return data;
449}
450 
451static TIMER_CALLBACK( kay_kbd_beepoff )
452{
453   beep_set_state(kay_kbd_beeper, 0);
454}
455 
456void kay_kbd_d_w( running_machine *machine, UINT8 data )
457{
458/* Beeper control - lengths need verifying
459   01 - keyclick
460   02 - short beep
461   04 - standard bell beep
462   08 - mute
463   16 - unmute */
464 
465   UINT16 length = 0;
466 
467   if (data & 0x10)
468      beep_on = 1;
469   else
470   if (data & 0x08)
471      beep_on = 0;
472   else
473   if (beep_on)
474   {
475      if (data & 0x04)
476         length = 400;
477      else
478      if (data & 0x02)
479         length = 200;
480      else
481      if (data & 0x01)
482         length = 4;
483 
484      if (length)
485      {
486         timer_set(machine, ATTOTIME_IN_MSEC(length), NULL, 0, kay_kbd_beepoff);
487         beep_set_state(kay_kbd_beeper, 1);
488      }
489   }
490}
1/******************************************************************************
2 *
3 *   kay_kbd.c
4 *
5 *   Kaypro II Serial Keyboard
6 *
7 *   Most of this is copied from kaypro.c,
8 *   rather than re-inventing the wheel.
9 *
10 *   Juergen Buchmueller, July 1998
11 *   Benjamin C. W. Sittler, July 1998 (new keyboard table)
12 *
13 *   Converted to a serial device (as far as MESS will allow)
14 *   by Robbbert, April 2009.
15
16   NOTE: THIS IS A WIP, IT DOESN'T DO ANYTHING AT THIS TIME !!
17 *
18 ******************************************************************************/
19
20#include "driver.h"
21#include "sound/beep.h"
22#include "kay_kbd.h"
23
24
25/*
26 * The KAYPRO keyboard has roughly the following layout:
27 *
28 *                                                                  [up] [down] [left] [right]
29 *         [ESC] [1!] [2@] [3#] [4$] [5%] [6^] [7&] [8*] [9(] [0)] [-_] [=+] [`~] [BACK SPACE]
30 *           [TAB] [qQ] [wW] [eE] [rR] [tT] [yY] [uU] [iI] [oO] [pP] [[{] []}]       [DEL]
31 *[CTRL] [CAPS LOCK] [aA] [sS] [dD] [fF] [gG] [hH] [jJ] [kK] [lL] [;:] ['"] [RETURN] [\|]
32 *            [SHIFT] [zZ] [xX] [cC] [vV] [bB] [nN] [mM] [,<] [.>] [/?] [SHIFT] [LINE FEED]
33 *                      [                 SPACE                     ]
34 *
35 * [7] [8] [9] [-]
36 * [4] [5] [6] [,]
37 * [1] [2] [3]
38 * [  0  ] [.] [ENTER]
39 *
40 * Notes on Appearance
41 * -------------------
42 * The RETURN key is shaped like a backwards "L". The keypad ENTER key is actually
43 * oriented vertically, not horizontally. The alpha keys are marked with the uppercase letters
44 * only. Other keys with two symbols have the shifted symbol printed above the unshifted symbol.
45 * The keypad is actually located to the right of the main keyboard; it is shown separately here
46 * as a convenience to users of narrow listing windows. The arrow keys are actually marked with
47 * arrow graphics pointing in the appropriate directions. The F and J keys are specially shaped,
48 * since they are the "home keys" for touch-typing. The CAPS LOCK key has a build-in red indicator
49 * which is lit when CAPS LOCK is pressed once, and extinguished when the key is pressed again.
50 *
51 * Technical Notes
52 * ---------------
53 * The keyboard interfaces to the computer using a serial protocol. Modifier keys are handled
54 * inside the keyboards, as is the CAPS LOCK key. The arrow keys and the numeric keypad send
55 * non-ASCII codes which are not affected by the modifier keys. The remaining keys send the
56 * appropriate ASCII values.
57 *
58 * The keyboard has a built-in buzzer which is activated briefly by a non-modifier keypress,
59 * producing a "clicking" sound for user feedback. Additionally, this buzzer can be activated
60 * for a longer period by sending a 0x04 byte to the keyboard. This is used by the ROM soft
61 * terminal to alert the user in case of a BEL.
62*
63 * 2008-05 FP:
64 * Small note about natural keyboard support: currently,
65 * - "Line Feed" is mapped to the 'End' key
66 * - "Keypad ," is not mapped
67 */
68
69INPUT_PORTS_START( kay_kbd )
70   PORT_START("ROW0")
71   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)         PORT_CHAR(UCHAR_MAMEKEY(ESC))
72   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)            PORT_CHAR('1') PORT_CHAR('!')
73   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)            PORT_CHAR('2') PORT_CHAR('@')
74   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3)          PORT_CHAR('3') PORT_CHAR('#')
75   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)          PORT_CHAR('4') PORT_CHAR('$')
76   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)          PORT_CHAR('5') PORT_CHAR('%')
77   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)          PORT_CHAR('6') PORT_CHAR('^')
78   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)            PORT_CHAR('7') PORT_CHAR('&')
79
80   PORT_START("ROW1")
81   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)          PORT_CHAR('8') PORT_CHAR('*')
82   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)          PORT_CHAR('9') PORT_CHAR('(')
83   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)          PORT_CHAR('0') PORT_CHAR(')')
84   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)          PORT_CHAR('-') PORT_CHAR('_')
85   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)          PORT_CHAR('=') PORT_CHAR('+')
86   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE)          PORT_CHAR('`') PORT_CHAR('~')
87   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("BACK SPACE")          PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
88   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)          PORT_CHAR('\t')
89
90   PORT_START("ROW2")
91   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)          PORT_CHAR('q') PORT_CHAR('Q')
92   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)          PORT_CHAR('w') PORT_CHAR('W')
93   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)          PORT_CHAR('e') PORT_CHAR('E')
94   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)          PORT_CHAR('r') PORT_CHAR('R')
95   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)          PORT_CHAR('t') PORT_CHAR('T')
96   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)          PORT_CHAR('y') PORT_CHAR('Y')
97   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)          PORT_CHAR('u') PORT_CHAR('U')
98   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)          PORT_CHAR('i') PORT_CHAR('I')
99
100   PORT_START("ROW3")
101   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)          PORT_CHAR('o') PORT_CHAR('O')
102   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)          PORT_CHAR('p') PORT_CHAR('P')
103   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)         PORT_CHAR('[') PORT_CHAR('{')
104   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)      PORT_CHAR(']') PORT_CHAR('}')
105   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("RETURN")            PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
106   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL)   PORT_CHAR(UCHAR_MAMEKEY(DEL))
107   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)         PORT_CHAR(UCHAR_SHIFT_2)
108   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK)         PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
109
110   PORT_START("ROW4")
111   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)          PORT_CHAR('a') PORT_CHAR('A')
112   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)          PORT_CHAR('s') PORT_CHAR('S')
113   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)          PORT_CHAR('d') PORT_CHAR('D')
114   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)          PORT_CHAR('f') PORT_CHAR('F')
115   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)          PORT_CHAR('g') PORT_CHAR('G')
116   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)          PORT_CHAR('h') PORT_CHAR('H')
117   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)          PORT_CHAR('j') PORT_CHAR('J')
118   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)          PORT_CHAR('k') PORT_CHAR('K')
119
120   PORT_START("ROW5")
121   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)          PORT_CHAR('l') PORT_CHAR('L')
122   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)         PORT_CHAR(';') PORT_CHAR(':')
123   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)         PORT_CHAR('\'') PORT_CHAR('"')
124   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)         PORT_CHAR('\\') PORT_CHAR('|')
125   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)         PORT_CHAR(UCHAR_MAMEKEY(LSHIFT))
126   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)          PORT_CHAR('z') PORT_CHAR('Z')
127   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)          PORT_CHAR('x') PORT_CHAR('X')
128   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)          PORT_CHAR('c') PORT_CHAR('C')
129
130   PORT_START("ROW6")
131   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)          PORT_CHAR('v') PORT_CHAR('V')
132   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)          PORT_CHAR('b') PORT_CHAR('B')
133   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)          PORT_CHAR('n') PORT_CHAR('N')
134   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)            PORT_CHAR('m') PORT_CHAR('M')
135   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)         PORT_CHAR(',') PORT_CHAR('<')
136   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)         PORT_CHAR('.') PORT_CHAR('>')
137   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH)         PORT_CHAR('/') PORT_CHAR('?')
138   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT)         PORT_CHAR(UCHAR_MAMEKEY(RSHIFT))
139
140   PORT_START("ROW7")
141   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED")         PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
142   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)         PORT_CHAR(' ')
143   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD)          PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
144   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("Keypad ,")         PORT_CODE(KEYCODE_PLUS_PAD)
145   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD)         PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
146   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD)          PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
147   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD)          PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
148   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD)          PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
149
150   PORT_START("ROW8")
151   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD)          PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
152   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD)          PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
153   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD)          PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
154   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD)          PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
155   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD)          PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
156   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD)          PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
157   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD)          PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
158   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD)         PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
159
160   PORT_START("ROW9")
161   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91")         PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
162   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93")         PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
163   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x90")         PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
164   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x92")         PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
165   PORT_BIT(0xf0, 0x00, IPT_UNUSED)
166INPUT_PORTS_END
167
168static void kay_kbd_in( running_machine *machine, UINT8 data );
169static const device_config *kay_kbd_beeper;
170static UINT8 kbd_buff[16];
171static UINT8 kbd_head = 0;
172static UINT8 kbd_tail = 0;
173static UINT8 beep_on = 0;
174static UINT8 keyrows[10] = { 0,0,0,0,0,0,0,0,0,0 };
175static const char keyboard[8][10][8] = {
176   { /* normal */
177      { 27,'1','2','3','4','5','6','7'},
178      {'8','9','0','-','=','`',  8,  9},
179      {'q','w','e','r','t','y','u','i'},
180      {'o','p','[',']', 13,127,  0,  0},
181      {'a','s','d','f','g','h','j','k'},
182      {'l',';', 39, 92,  0,'z','x','c'},
183      {'v','b','n','m',',','.','/',  0},
184      { 10, 32, 228, 211, 195, 178, 177, 192},
185      { 193, 194, 208, 209, 210, 225, 226, 227},
186      { 241, 242, 243, 244,  0,  0,  0,  0},
187   },
188   { /* Shift */
189      { 27,'!','@','#','$','%','^','&'},
190      {'*','(',')','_','+','~',  8,  9},
191      {'Q','W','E','R','T','Y','U','I'},
192      {'O','P','{','}', 13,127,  0,  0},
193      {'A','S','D','F','G','H','J','K'},
194      {'L',':','"','|',  0,'Z','X','C'},
195      {'V','B','N','M','<','>','?',  0},
196      { 10, 32, 228, 211, 195, 178, 177, 192},
197      { 193, 194, 208, 209, 210, 225, 226, 227},
198      { 241, 242, 243, 244,  0,  0,  0,  0},
199   },
200   { /* Control */
201      { 27,'1','2','3','4','5','6','7'},
202      {'8','9','0','-','=','`',  8,  9},
203      { 17, 23,  5, 18, 20, 25, 21,  9},
204      { 15, 16, 27, 29, 13,127,  0,  0},
205      {  1, 19,  4,  6,  7,  8, 10, 11},
206      { 12,';', 39, 28,  0, 26, 24,  3},
207      { 22,  2, 14, 13,',','.','/',  0},
208      { 10, 32, 228, 211, 195, 178, 177, 192},
209      { 193, 194, 208, 209, 210, 225, 226, 227},
210      { 241, 242, 243, 244,  0,  0,  0,  0},
211   },
212   { /* Shift+Control */
213      { 27,'!',  0,'#','$','%', 30,'&'},
214      {'*','(',')', 31,'+','~',  8,  9},
215      { 17, 23,  5, 18, 20, 25, 21,  9},
216      { 15, 16, 27, 29, 13,127,  0,  0},
217      {  1, 19,  4,  6,  7,  8, 10, 11},
218      { 12,':','"', 28,  0, 26, 24,  3},
219      { 22,  2, 14, 13,',','.','/',  0},
220      { 10, 32, 228, 211, 195, 178, 177, 192},
221      { 193, 194, 208, 209, 210, 225, 226, 227},
222      { 241, 242, 243, 244,  0,  0,  0,  0},
223   },
224   { /* CapsLock */
225      { 27,'1','2','3','4','5','6','7'},
226      {'8','9','0','-','=','`',  8,  9},
227      {'Q','W','E','R','T','Y','U','I'},
228      {'O','P','[',']', 13,127,  0,  0},
229      {'A','S','D','F','G','H','J','K'},
230      {'L',';', 39, 92,  0,'Z','X','C'},
231      {'V','B','N','M',',','.','/',  0},
232      { 10, 32, 228, 211, 195, 178, 177, 192},
233      { 193, 194, 208, 209, 210, 225, 226, 227},
234      { 241, 242, 243, 244,  0,  0,  0,  0},
235   },
236   { /* Shift+CapsLock */
237      { 27,'!','@','#','$','%','^','&'},
238      {'*','(',')','_','+','~',  8,  9},
239      {'Q','W','E','R','T','Y','U','I'},
240      {'O','P','{','}', 13,127,  0,  0},
241      {'A','S','D','F','G','H','J','K'},
242      {'L',':','"','|',  0,'Z','X','C'},
243      {'V','B','N','M','<','>','?',  0},
244      { 10, 32, 228, 211, 195, 178, 177, 192},
245      { 193, 194, 208, 209, 210, 225, 226, 227},
246      { 241, 242, 243, 244,  0,  0,  0,  0},
247   },
248   { /* Control+CapsLock */
249      { 27,'1','2','3','4','5','6','7'},
250      {'8','9','0','-','=','`',  8,  9},
251      { 17, 23,  5, 18, 20, 25, 21,  9},
252      { 15, 16, 27, 29, 13,127,  0,  0},
253      {  1, 19,  4,  6,  7,  8, 10, 11},
254      { 12,';', 39, 28,  0, 26, 24,  3},
255      { 22,  2, 14, 13,',','.','/',  0},
256      { 10, 32, 228, 211, 195, 178, 177, 192},
257      { 193, 194, 208, 209, 210, 225, 226, 227},
258      { 241, 242, 243, 244,  0,  0,  0,  0},
259   },
260   { /* Shift+Control+CapsLock */
261      { 27,'!',  0,'#','$','%', 30,'&'},
262      {'*','(',')', 31,'+','~',  8,  9},
263      { 17, 23,  5, 18, 20, 25, 21,  9},
264      { 15, 16, 27, 29, 13,127,  0,  0},
265      {  1, 19,  4,  6,  7,  8, 10, 11},
266      { 12,':','"', 28,  0, 26, 24,  3},
267      { 22,  2, 14, 13,',','.','/',  0},
268      { 10, 32, 228, 211, 195, 178, 177, 192},
269      { 193, 194, 208, 209, 210, 225, 226, 227},
270      { 241, 242, 243, 244,  0,  0,  0,  0},
271   },
272};
273
274MACHINE_RESET( kay_kbd )
275{
276   /* disable CapsLock LED initially */
277   set_led_status(1, 1);
278   set_led_status(1, 0);
279   kay_kbd_beeper = devtag_get_device(machine, "beep");
280   beep_on = 1;
281   beep_set_state(kay_kbd_beeper, 0);
282   beep_set_frequency(kay_kbd_beeper, 950);   /* piezo-device needs to be measured */
283   kbd_head = kbd_tail = 0;         /* init buffer */
284}
285
286/******************************************************
287 * vertical blank interrupt
288 * used to scan keyboard; newly pressed keys
289 * are stuffed into a keyboard buffer;
290 * also drives keyboard LEDs and
291 * and handles autorepeating keys
292 ******************************************************/
293INTERRUPT_GEN( kay_kbd_interrupt )
294{
295   int mod, row, col, chg, new;
296   static int lastrow = 0, mask = 0x00, key = 0x00, repeat = 0, repeater = 0;
297
298   if( repeat )
299   {
300      if( !--repeat )
301         repeater = 4;
302   }
303   else
304   if( repeater )
305   {
306      repeat = repeater;
307   }
308
309   row = 9;
310   new = input_port_read(device->machine, "ROW9");
311   chg = keyrows[row] ^ new;
312
313   if (!chg) { new = input_port_read(device->machine, "ROW8"); chg = keyrows[--row] ^ new; }
314   if (!chg) { new = input_port_read(device->machine, "ROW7"); chg = keyrows[--row] ^ new; }
315   if (!chg) { new = input_port_read(device->machine, "ROW6"); chg = keyrows[--row] ^ new; }
316   if (!chg) { new = input_port_read(device->machine, "ROW5"); chg = keyrows[--row] ^ new; }
317   if (!chg) { new = input_port_read(device->machine, "ROW4"); chg = keyrows[--row] ^ new; }
318   if (!chg) { new = input_port_read(device->machine, "ROW3"); chg = keyrows[--row] ^ new; }
319   if (!chg) { new = input_port_read(device->machine, "ROW2"); chg = keyrows[--row] ^ new; }
320   if (!chg) { new = input_port_read(device->machine, "ROW1"); chg = keyrows[--row] ^ new; }
321   if (!chg) { new = input_port_read(device->machine, "ROW0"); chg = keyrows[--row] ^ new; }
322   if (!chg) --row;
323
324   if (row >= 0)
325   {
326      repeater = 0x00;
327      mask = 0x00;
328      key = 0x00;
329      lastrow = row;
330      /* CapsLock LED */
331      if( row == 3 && chg == 0x80 )
332         set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1);
333
334      if (new & chg)   /* key(s) pressed ? */
335      {
336         mod = 0;
337
338         /* Shift modifier */
339         if ( (keyrows[5] & 0x10) || (keyrows[6] & 0x80) )
340            mod |= 1;
341
342         /* Control modifier */
343         if (keyrows[3] & 0x40)
344            mod |= 2;
345
346         /* CapsLock modifier */
347         if (keyrows[3] & 0x80)
348            mod |= 4;
349
350         /* find new key */
351         mask = 0x01;
352         for (col = 0; col < 8; col ++)
353         {
354            if (chg & mask)
355            {
356               new &= mask;
357               key = keyboard[mod][row][col];
358               break;
359            }
360            mask <<= 1;
361         }
362         if( key )   /* normal key */
363         {
364            repeater = 30;
365            kay_kbd_in(device->machine, key);
366         }
367         else
368         if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */
369            kay_kbd_in(device->machine, 0);
370         keyrows[row] |= new;
371      }
372      else
373      {
374         keyrows[row] = new;
375      }
376      repeat = repeater;
377   }
378   else if ( key && (keyrows[lastrow] & mask) && repeat == 0 )
379   {
380      kay_kbd_in(device->machine, key);
381   }
382}
383
384#if 0
385
386/******************************************************
387 *   kaypro_const_w (write console status ;)
388 *   bit
389 *   0   flush keyboard buffer
390 ******************************************************/
391static WRITE8_HANDLER ( kaypro2_const_w )
392{
393   if (data & 1)
394      kbd_head = kbd_tail = 0;
395}
396
397#endif
398
399/******************************************************
400 *   kaypro_conin_w
401 *   stuff character into the keyboard buffer
402 *   releases CPU if it was waiting for a key
403 *   sounds bell if buffer would overflow
404 ******************************************************/
405static void kay_kbd_in( running_machine *machine, UINT8 data )
406{
407   UINT8 kbd_head_old;
408
409   kbd_head_old = kbd_head;
410   kbd_buff[kbd_head] = data;
411   kbd_head = (kbd_head + 1) % sizeof(kbd_buff);
412   /* will the buffer overflow ? */
413   if (kbd_head == kbd_tail)
414   {
415      kbd_head = kbd_head_old;
416      kay_kbd_d_w(machine, 4);
417   }
418   else
419      kay_kbd_d_w(machine, 1);
420}
421
422
423UINT8 kay_kbd_c_r( void )
424{
425/*   d4 transmit buffer empty - 1=ok to send
426   d0 keyboard buffer empty - 1=key waiting to be used */
427
428   UINT8 data = 0x10;
429
430   if( kbd_head != kbd_tail )
431      data++;
432
433   return data;
434}
435
436UINT8 kay_kbd_d_r( void )
437{
438/* return next key in buffer */
439
440   UINT8 data = 0;
441
442   if (kbd_tail != kbd_head)
443   {
444      data = kbd_buff[kbd_tail];
445      kbd_tail = (kbd_tail + 1) % sizeof(kbd_buff);
446   }
447
448   return data;
449}
450
451static TIMER_CALLBACK( kay_kbd_beepoff )
452{
453   beep_set_state(kay_kbd_beeper, 0);
454}
455
456void kay_kbd_d_w( running_machine *machine, UINT8 data )
457{
458/* Beeper control - lengths need verifying
459   01 - keyclick
460   02 - short beep
461   04 - standard bell beep
462   08 - mute
463   16 - unmute */
464
465   UINT16 length = 0;
466
467   if (data & 0x10)
468      beep_on = 1;
469   else
470   if (data & 0x08)
471      beep_on = 0;
472   else
473   if (beep_on)
474   {
475      if (data & 0x04)
476         length = 400;
477      else
478      if (data & 0x02)
479         length = 200;
480      else
481      if (data & 0x01)
482         length = 4;
483
484      if (length)
485      {
486         timer_set(machine, ATTOTIME_IN_MSEC(length), NULL, 0, kay_kbd_beepoff);
487         beep_set_state(kay_kbd_beeper, 1);
488      }
489   }
490}
src/mess/machine/kay_kbd.h
r4517r4518
1UINT8 kay_kbd_c_r( void );
2UINT8 kay_kbd_d_r( void );
3void kay_kbd_d_w( running_machine *machine, UINT8 data );
4INTERRUPT_GEN( kay_kbd_interrupt );
5MACHINE_RESET( kay_kbd );
6INPUT_PORTS_EXTERN( kay_kbd );
1UINT8 kay_kbd_c_r( void );
2UINT8 kay_kbd_d_r( void );
3void kay_kbd_d_w( running_machine *machine, UINT8 data );
4INTERRUPT_GEN( kay_kbd_interrupt );
5MACHINE_RESET( kay_kbd );
6INPUT_PORTS_EXTERN( kay_kbd );
src/mess/machine/kaypro.c
r4517r4518
1 
2#include "driver.h"
3#include "cpu/z80/z80.h"
4#include "machine/z80pio.h"
5#include "machine/z80sio.h"
6#include "cpu/z80/z80daisy.h"
7#include "machine/ctronics.h"
8#include "machine/kay_kbd.h"
9#include "machine/wd17xx.h"
10#include "devices/basicdsk.h"
11#include "includes/kaypro.h"
12 
13 
14static const device_config *kaypro2_z80pio_g;
15static const device_config *kaypro2_z80pio_s;
16static const device_config *kaypro2_z80sio;
17static const device_config *kaypro2_printer;
18static const device_config *kaypro2_fdc;
19 
20 
21 
22/***********************************************************
23 
24   PIO
25 
26   It seems there must have been a bulk-purchase
27   special on pios - port B is unused on both of them
28 
29************************************************************/
30 
31static WRITE8_DEVICE_HANDLER( kaypro2_interrupt )
32{
33   cpu_set_input_line(device->machine->cpu[0], 0, data);
34}
35 
36static READ8_DEVICE_HANDLER( pio_system_r )
37{
38/*   d3 Centronics ready flag */
39 
40   return ~centronics_busy_r(kaypro2_printer) << 3;
41}
42 
43static WRITE8_DEVICE_HANDLER( pio_system_w )
44{
45/*   d7 bank select
46   d6 disk drive motors - not emulated
47   d5 double-density enable
48   d4 Centronics strobe
49   d1 drive B
50   d0 drive A */
51 
52   /* get address space */
53   const address_space *mem = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
54 
55   if (data & 0x80)
56   {
57      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
58      memory_install_read8_handler (mem, 0x0000, 0x0fff, 0, 0, SMH_BANK1);
59      memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
60      memory_install_readwrite8_handler (mem, 0x3000, 0x3fff, 0, 0, kaypro_videoram_r, kaypro_videoram_w);
61   }
62   else
63   {
64      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
65       memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_BANK2, SMH_BANK3);
66      memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "rambank"));
67      memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "rambank"));
68   }
69 
70   wd17xx_set_density(kaypro2_fdc, (data & 0x20) ? 1 : 0);
71 
72   centronics_strobe_w(kaypro2_printer, BIT(data, 4));
73 
74   if (data & 1)
75      wd17xx_set_drive(kaypro2_fdc, 0);
76   else
77   if (data & 2)
78      wd17xx_set_drive(kaypro2_fdc, 1);
79 
80   if (data & 3)
81      wd17xx_set_side(kaypro2_fdc, 0);   /* only has 1 side */
82}
83 
84const z80pio_interface kaypro2_pio_g_intf =
85{
86   DEVCB_HANDLER(kaypro2_interrupt),
87   DEVCB_NULL,
88   DEVCB_NULL,
89   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w),
90   DEVCB_NULL,
91   DEVCB_NULL,         /* portA ready active callback */
92   DEVCB_NULL         /* portB ready active callback */
93};
94 
95const z80pio_interface kaypro2_pio_s_intf =
96{
97   DEVCB_HANDLER(kaypro2_interrupt),
98   DEVCB_HANDLER(pio_system_r),   /* read printer status */
99   DEVCB_NULL,
100   DEVCB_HANDLER(pio_system_w),   /* activate various internal devices */
101   DEVCB_NULL,
102   DEVCB_NULL,         /* portA ready active callback */
103   DEVCB_NULL         /* portB ready active callback */
104};
105 
106READ8_DEVICE_HANDLER( kaypro2_pio_r )
107{
108   if (!offset)
109      return z80pio_d_r(device, 0);
110   else
111   if (offset == 1)
112      return z80pio_c_r(device, 0);
113   else
114   if (offset == 2)
115      return z80pio_d_r(device, 1);
116   else
117      return z80pio_c_r(device, 1);
118}
119 
120WRITE8_DEVICE_HANDLER( kaypro2_pio_w )
121{
122   if (!offset)
123      z80pio_d_w(device, 0, data);
124   else
125   if (offset == 1)
126      z80pio_c_w(device, 0, data);
127   else
128   if (offset == 2)
129      z80pio_d_w(device, 1, data);
130   else
131      z80pio_c_w(device, 1, data);
132}
133 
134 
135/***********************************************************
136 
137   SIO
138   Baud rate setup commented out until MAME includes
139   the feature.
140 
141************************************************************/
142 
143/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, etc.
144   00h    50   
145   11h    75   
146   22h    110   
147   33h    134.5   
148   44h    150   
149   55h    300   
150   66h    600   
151   77h    1200   
152   88h    1800   
153   99h    2000   
154   AAh    2400   
155   BBh    3600   
156   CCh    4800   
157   DDh    7200   
158   EEh    9600   
159   FFh    19200 */
160 
161static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
162 
163WRITE8_HANDLER( kaypro2_baud_a_w )   /* channel A - RS232C */
164{
165   data &= 0x0f;
166 
167//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 0);
168//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 0);
169}
170 
171WRITE8_HANDLER( kaypro2_baud_b_w )   /* Channel B - Keyboard */
172{
173/* Only speed used is 300 baud */
174 
175   data &= 0x0f;
176 
177//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 1);
178//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 1);
179}
180 
181/* when sio devcb'ed like pio is, change to use pio's int handler */
182static void kaypro2_int_sio(const device_config *device, int state)
183{
184   cpu_set_input_line(device->machine->cpu[0], 0, state);
185}
186 
187const z80sio_interface kaypro2_sio_intf =
188{
189   kaypro2_int_sio,   /* interrupt handler */
190   0,         /* DTR changed handler */
191   0,         /* RTS changed handler */
192   0,         /* BREAK changed handler */
193   0,         /* transmit handler - which channel is this for? */
194   0         /* receive handler - which channel is this for? */
195};
196 
197static const z80_daisy_chain kaypro2_daisy_chain[] =
198{
199/* Which order are these supposed to be in? assumed highest priority at the top */
200   { "z80sio" },      /* sio */
201   { "z80pio_s" },      /* System pio */
202   { "z80pio_g" },      /* General purpose pio */
203   { NULL }
204};
205 
206READ8_DEVICE_HANDLER( kaypro2_sio_r )
207{
208   if (!offset)
209      return z80sio_d_r(device, 0);
210   else
211   if (offset == 1)
212//      return z80sio_d_r(device, 1);
213      return kay_kbd_d_r();
214   else
215   if (offset == 2)
216      return z80sio_c_r(device, 0);
217   else
218//      return z80sio_c_r(device, 1);
219      return kay_kbd_c_r();
220}
221 
222WRITE8_DEVICE_HANDLER( kaypro2_sio_w )
223{
224   if (!offset)
225      z80sio_d_w(device, 0, data);
226   else
227   if (offset == 1)
228//      z80sio_d_w(device, 1, data);
229      kay_kbd_d_w(device->machine, data);
230   else
231   if (offset == 2)
232      z80sio_c_w(device, 0, data);
233   else
234      z80sio_c_w(device, 1, data);
235}
236 
237 
238/***********************************************************
239 
240   Floppy DIsk
241 
242   If there is no diskette in the drive, the cpu will
243   HALT, until the fdc does a NMI. NMI is deactivated
244   otherwise.
245 
246************************************************************/
247 
248static WD17XX_CALLBACK( kaypro2_fdc_callback )
249{
250   switch (state)
251   {
252      case WD17XX_DRQ_CLR:
253      case WD17XX_IRQ_CLR:
254         cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, 0);
255         break;
256      case WD17XX_DRQ_SET:
257      case WD17XX_IRQ_SET:
258         if (cpu_get_reg(device->machine->cpu[0], Z80_HALT))
259            cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
260         break;
261   }
262}
263 
264const wd17xx_interface kaypro2_wd1793_interface = { kaypro2_fdc_callback, NULL };
265 
266/* I have no idea how to set up floppies - these ones have 40 tracks, 40 sectors, 128 bytes per track, single sided */
267 
268void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
269{
270   /* floppy */
271   switch(state)
272   {
273      /* --- the following bits of info are returned as 64-bit signed integers --- */
274      case MESS_DEVINFO_INT_COUNT:         info->i = 2; break;
275 
276      /* --- the following bits of info are returned as pointers to data or functions --- */
277//      case MESS_DEVINFO_PTR_LOAD:         info->load = DEVICE_IMAGE_LOAD_NAME(kaypro2_floppy); break;
278 
279      /* --- the following bits of info are returned as NULL-terminated strings --- */
280      case MESS_DEVINFO_STR_FILE_EXTENSIONS:      strcpy(info->s = device_temp_str(), "dsk"); break;
281 
282      default:               legacybasicdsk_device_getinfo(devclass, state, info); break;
283   }
284}
285 
286 
287/***********************************************************
288 
289   Machine
290 
291************************************************************/
292 
293MACHINE_RESET( kayproii )
294{
295   kaypro2_z80pio_g = devtag_get_device(machine, "z80pio_g");
296   kaypro2_z80pio_s = devtag_get_device(machine, "z80pio_s");
297   kaypro2_z80sio = devtag_get_device(machine, "z80sio");
298   kaypro2_printer = devtag_get_device(machine, "centronics");
299   kaypro2_fdc = devtag_get_device(machine, "wd1793");
300   pio_system_w(kaypro2_z80pio_s, 0, 0x80);
301   MACHINE_RESET_CALL(kay_kbd);
302}
303 
1
2#include "driver.h"
3#include "cpu/z80/z80.h"
4#include "machine/z80pio.h"
5#include "machine/z80sio.h"
6#include "cpu/z80/z80daisy.h"
7#include "machine/ctronics.h"
8#include "machine/kay_kbd.h"
9#include "machine/wd17xx.h"
10#include "devices/basicdsk.h"
11#include "includes/kaypro.h"
12
13
14static const device_config *kaypro2_z80pio_g;
15static const device_config *kaypro2_z80pio_s;
16static const device_config *kaypro2_z80sio;
17static const device_config *kaypro2_printer;
18static const device_config *kaypro2_fdc;
19
20
21
22/***********************************************************
23
24   PIO
25
26   It seems there must have been a bulk-purchase
27   special on pios - port B is unused on both of them
28
29************************************************************/
30
31static WRITE8_DEVICE_HANDLER( kaypro2_interrupt )
32{
33   cpu_set_input_line(device->machine->cpu[0], 0, data);
34}
35
36static READ8_DEVICE_HANDLER( pio_system_r )
37{
38/*   d3 Centronics ready flag */
39
40   return ~centronics_busy_r(kaypro2_printer) << 3;
41}
42
43static WRITE8_DEVICE_HANDLER( pio_system_w )
44{
45/*   d7 bank select
46   d6 disk drive motors - not emulated
47   d5 double-density enable
48   d4 Centronics strobe
49   d1 drive B
50   d0 drive A */
51
52   /* get address space */
53   const address_space *mem = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
54
55   if (data & 0x80)
56   {
57      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
58      memory_install_read8_handler (mem, 0x0000, 0x0fff, 0, 0, SMH_BANK1);
59      memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
60      memory_install_readwrite8_handler (mem, 0x3000, 0x3fff, 0, 0, kaypro_videoram_r, kaypro_videoram_w);
61   }
62   else
63   {
64      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
65       memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_BANK2, SMH_BANK3);
66      memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "rambank"));
67      memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "rambank"));
68   }
69
70   wd17xx_set_density(kaypro2_fdc, (data & 0x20) ? 1 : 0);
71
72   centronics_strobe_w(kaypro2_printer, BIT(data, 4));
73
74   if (data & 1)
75      wd17xx_set_drive(kaypro2_fdc, 0);
76   else
77   if (data & 2)
78      wd17xx_set_drive(kaypro2_fdc, 1);
79
80   if (data & 3)
81      wd17xx_set_side(kaypro2_fdc, 0);   /* only has 1 side */
82}
83
84const z80pio_interface kaypro2_pio_g_intf =
85{
86   DEVCB_HANDLER(kaypro2_interrupt),
87   DEVCB_NULL,
88   DEVCB_NULL,
89   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w),
90   DEVCB_NULL,
91   DEVCB_NULL,         /* portA ready active callback */
92   DEVCB_NULL         /* portB ready active callback */
93};
94
95const z80pio_interface kaypro2_pio_s_intf =
96{
97   DEVCB_HANDLER(kaypro2_interrupt),
98   DEVCB_HANDLER(pio_system_r),   /* read printer status */
99   DEVCB_NULL,
100   DEVCB_HANDLER(pio_system_w),   /* activate various internal devices */
101   DEVCB_NULL,
102   DEVCB_NULL,         /* portA ready active callback */
103   DEVCB_NULL         /* portB ready active callback */
104};
105
106READ8_DEVICE_HANDLER( kaypro2_pio_r )
107{
108   if (!offset)
109      return z80pio_d_r(device, 0);
110   else
111   if (offset == 1)
112      return z80pio_c_r(device, 0);
113   else
114   if (offset == 2)
115      return z80pio_d_r(device, 1);
116   else
117      return z80pio_c_r(device, 1);
118}
119
120WRITE8_DEVICE_HANDLER( kaypro2_pio_w )
121{
122   if (!offset)
123      z80pio_d_w(device, 0, data);
124   else
125   if (offset == 1)
126      z80pio_c_w(device, 0, data);
127   else
128   if (offset == 2)
129      z80pio_d_w(device, 1, data);
130   else
131      z80pio_c_w(device, 1, data);
132}
133
134
135/***********************************************************
136
137   SIO
138   Baud rate setup commented out until MAME includes
139   the feature.
140
141************************************************************/
142
143/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, etc.
144   00h    50 
145   11h    75 
146   22h    110 
147   33h    134.5 
148   44h    150 
149   55h    300 
150   66h    600 
151   77h    1200 
152   88h    1800 
153   99h    2000 
154   AAh    2400 
155   BBh    3600 
156   CCh    4800 
157   DDh    7200 
158   EEh    9600 
159   FFh    19200 */
160
161static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
162
163WRITE8_HANDLER( kaypro2_baud_a_w )   /* channel A - RS232C */
164{
165   data &= 0x0f;
166
167//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 0);
168//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 0);
169}
170
171WRITE8_HANDLER( kaypro2_baud_b_w )   /* Channel B - Keyboard */
172{
173/* Only speed used is 300 baud */
174
175   data &= 0x0f;
176
177//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 1);
178//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 1);
179}
180
181/* when sio devcb'ed like pio is, change to use pio's int handler */
182static void kaypro2_int_sio(const device_config *device, int state)
183{
184   cpu_set_input_line(device->machine->cpu[0], 0, state);
185}
186
187const z80sio_interface kaypro2_sio_intf =
188{
189   kaypro2_int_sio,   /* interrupt handler */
190   0,         /* DTR changed handler */
191   0,         /* RTS changed handler */
192   0,         /* BREAK changed handler */
193   0,         /* transmit handler - which channel is this for? */
194   0         /* receive handler - which channel is this for? */
195};
196
197static const z80_daisy_chain kaypro2_daisy_chain[] =
198{
199/* Which order are these supposed to be in? assumed highest priority at the top */
200   { "z80sio" },      /* sio */
201   { "z80pio_s" },      /* System pio */
202   { "z80pio_g" },      /* General purpose pio */
203   { NULL }
204};
205
206READ8_DEVICE_HANDLER( kaypro2_sio_r )
207{
208   if (!offset)
209      return z80sio_d_r(device, 0);
210   else
211   if (offset == 1)
212//      return z80sio_d_r(device, 1);
213      return kay_kbd_d_r();
214   else
215   if (offset == 2)
216      return z80sio_c_r(device, 0);
217   else
218//      return z80sio_c_r(device, 1);
219      return kay_kbd_c_r();
220}
221
222WRITE8_DEVICE_HANDLER( kaypro2_sio_w )
223{
224   if (!offset)
225      z80sio_d_w(device, 0, data);
226   else
227   if (offset == 1)
228//      z80sio_d_w(device, 1, data);
229      kay_kbd_d_w(device->machine, data);
230   else
231   if (offset == 2)
232      z80sio_c_w(device, 0, data);
233   else
234      z80sio_c_w(device, 1, data);
235}
236
237
238/***********************************************************
239
240   Floppy DIsk
241
242   If there is no diskette in the drive, the cpu will
243   HALT, until the fdc does a NMI. NMI is deactivated
244   otherwise.
245
246************************************************************/
247
248static WD17XX_CALLBACK( kaypro2_fdc_callback )
249{
250   switch (state)
251   {
252      case WD17XX_DRQ_CLR:
253      case WD17XX_IRQ_CLR:
254         cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, 0);
255         break;
256      case WD17XX_DRQ_SET:
257      case WD17XX_IRQ_SET:
258         if (cpu_get_reg(device->machine->cpu[0], Z80_HALT))
259            cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
260         break;
261   }
262}
263
264const wd17xx_interface kaypro2_wd1793_interface = { kaypro2_fdc_callback, NULL };
265
266/* I have no idea how to set up floppies - these ones have 40 tracks, 40 sectors, 128 bytes per track, single sided */
267
268void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
269{
270   /* floppy */
271   switch(state)
272   {
273      /* --- the following bits of info are returned as 64-bit signed integers --- */
274      case MESS_DEVINFO_INT_COUNT:         info->i = 2; break;
275
276      /* --- the following bits of info are returned as pointers to data or functions --- */
277//      case MESS_DEVINFO_PTR_LOAD:         info->load = DEVICE_IMAGE_LOAD_NAME(kaypro2_floppy); break;
278
279      /* --- the following bits of info are returned as NULL-terminated strings --- */
280      case MESS_DEVINFO_STR_FILE_EXTENSIONS:      strcpy(info->s = device_temp_str(), "dsk"); break;
281
282      default:               legacybasicdsk_device_getinfo(devclass, state, info); break;
283   }
284}
285
286
287/***********************************************************
288
289   Machine
290
291************************************************************/
292
293MACHINE_RESET( kayproii )
294{
295   kaypro2_z80pio_g = devtag_get_device(machine, "z80pio_g");
296   kaypro2_z80pio_s = devtag_get_device(machine, "z80pio_s");
297   kaypro2_z80sio = devtag_get_device(machine, "z80sio");
298   kaypro2_printer = devtag_get_device(machine, "centronics");
299   kaypro2_fdc = devtag_get_device(machine, "wd1793");
300   pio_system_w(kaypro2_z80pio_s, 0, 0x80);
301   MACHINE_RESET_CALL(kay_kbd);
302}
303
src/mess/layout/z80ne.lay
r4517r4518
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4 
5<mamelayout version="2">
6 
7    <element name="button" defstate="1" />
8 
9    <element name="black">
10        <rect>
11            <bounds left="0" top="0" right="1" bottom="1" />
12            <color red="0.0" green="0.0" blue="0.0" />
13        </rect> 
14    </element>
15 
16    <element name="gray">
17        <rect>
18            <bounds left="0" top="0" right="1" bottom="1" />
19            <color red="0.15" green="0.15" blue="0.15" />
20        </rect> 
21    </element>
22 
23    <element name="digit_back">
24        <rect>
25            <bounds left="0" top="0" right="1" bottom="1" />
26            <color red="0.584" green="0.631" blue="0.690" />
27        </rect> 
28    </element>
29 
30    <element name="digit" defstate="0">
31        <led7seg>
32            <color red="0.75" green="0.0" blue="0.0"/>
33        </led7seg>
34    </element>
35 
36    <element name="back">
37        <rect>
38            <bounds left="0" top="0" right="1" bottom="1" />
39            <color red="0.0" green="0.0" blue="0.0" />
40        </rect> 
41    </element>
42 
43    <element name="pushbutton" defstate="1">
44        <rect>
45            <bounds x="2" y="2" width="48" height="48"/>
46            <color red="0.1" green="0.1" blue="0.1" />
47        </rect>
48        <rect state="0">
49            <bounds x="0" y="0" width="48" height="48"/>
50            <color red="0.75" green="0.75" blue="0.0" />
51        </rect>
52        <rect state="1">
53            <bounds x="2" y="2" width="48" height="48"/>
54            <color red="0.75" green="0.75" blue="0.0" />
55        </rect>
56    </element>
57 
58    <element name="pushbuttonCTRL" defstate="1">
59        <rect>
60            <bounds x="2" y="2" width="48" height="48"/>
61            <color red="0.1" green="0.1" blue="0.1" />
62        </rect>
63        <rect state="0">
64            <bounds x="0" y="0" width="48" height="48"/>
65            <color red="0.25" green="0.25" blue="0.25" />
66        </rect>
67        <text string="CTRL" state="0">
68            <bounds x="8" y="24" width="40" height="20"/>
69            <color red="1.0" green="1.0" blue="1.0" />
70        </text>
71        <rect state="1">
72            <bounds x="2" y="2" width="48" height="48"/>
73            <color red="0.25" green="0.25" blue="0.25" />
74        </rect>
75        <text string="CTRL" state="1">
76            <bounds x="10" y="26" width="40" height="20"/>
77            <color red="1.0" green="1.0" blue="1.0" />
78        </text>
79    </element>
80 
81    <element name="pushbuttonRST" defstate="1">
82        <rect>
83            <bounds x="2" y="2" width="48" height="48"/>
84            <color red="0.1" green="0.1" blue="0.1" />
85        </rect>
86        <rect state="0">
87            <bounds x="0" y="0" width="48" height="48"/>
88            <color red="0.75" green="0" blue="0" />
89        </rect>
90        <text string="RST " state="0">
91            <bounds x="8" y="24" width="40" height="20"/>
92            <color red="1.0" green="1.0" blue="1.0" />
93        </text>
94        <rect state="1">
95            <bounds x="2" y="2" width="48" height="48"/>
96            <color red="0.75" green="0" blue="0" />
97        </rect>
98        <text string="RST " state="1">
99            <bounds x="10" y="26" width="40" height="20"/>
100            <color red="1.0" green="1.0" blue="1.0" />
101        </text>
102    </element>
103 
104    <element name="pushbutton0" defstate="1">
105        <rect>
106            <bounds x="2" y="2" width="48" height="48"/>
107            <color red="0.1" green="0.1" blue="0.1" />
108        </rect>
109        <rect state="0">
110            <bounds x="0" y="0" width="48" height="48"/>
111            <color red="0.0" green="0.0" blue="0.75" />
112        </rect>
113        <text string="  0 " state="0">
114            <bounds x="8" y="24" width="40" height="20"/>
115            <color red="1.0" green="1.0" blue="1.0" />
116        </text>
117        <rect state="1">
118            <bounds x="2" y="2" width="48" height="48"/>
119            <color red="0.0" green="0.0" blue="0.75" />
120        </rect>
121        <text string="  0 " state="1">
122            <bounds x="10" y="26" width="40" height="20"/>
123            <color red="1.0" green="1.0" blue="1.0" />
124        </text>
125    </element>
126 
127    <element name="pushbutton1" defstate="1">
128        <rect>
129            <bounds x="2" y="2" width="48" height="48"/>
130            <color red="0.1" green="0.1" blue="0.1" />
131        </rect>
132        <rect state="0">
133            <bounds x="0" y="0" width="48" height="48"/>
134            <color red="0.0" green="0.0" blue="0.75" />
135        </rect>
136        <text string="  1 " state="0">
137            <bounds x="8" y="24" width="40" height="20"/>
138            <color red="1.0" green="1.0" blue="1.0" />
139        </text>
140        <rect state="1">
141            <bounds x="2" y="2" width="48" height="48"/>
142            <color red="0.0" green="0.0" blue="0.75" />
143        </rect>
144        <text string="  1 " state="1">
145            <bounds x="10" y="26" width="40" height="20"/>
146            <color red="1.0" green="1.0" blue="1.0" />
147        </text>
148    </element>
149 
150    <element name="pushbutton2" defstate="1">
151        <rect>
152            <bounds x="2" y="2" width="48" height="48"/>
153            <color red="0.1" green="0.1" blue="0.1" />
154        </rect>
155        <rect state="0">
156            <bounds x="0" y="0" width="48" height="48"/>
157            <color red="0.0" green="0.0" blue="0.75" />
158        </rect>
159        <text string="  2 " state="0">
160            <bounds x="8" y="24" width="40" height="20"/>
161            <color red="1.0" green="1.0" blue="1.0" />
162        </text>
163        <rect state="1">
164            <bounds x="2" y="2" width="48" height="48"/>
165            <color red="0.0" green="0.0" blue="0.75" />
166        </rect>
167        <text string="  2 " state="1">
168            <bounds x="10" y="26" width="40" height="20"/>
169            <color red="1.0" green="1.0" blue="1.0" />
170        </text>
171    </element>
172 
173    <element name="pushbutton3" defstate="1">
174        <rect>
175            <bounds x="2" y="2" width="48" height="48"/>
176            <color red="0.1" green="0.1" blue="0.1" />
177        </rect>
178        <rect state="0">
179            <bounds x="0" y="0" width="48" height="48"/>
180            <color red="0.0" green="0.0" blue="0.75" />
181        </rect>
182        <text string="  3 " state="0">
183            <bounds x="8" y="24" width="40" height="20"/>
184            <color red="1.0" green="1.0" blue="1.0" />
185        </text>
186        <rect state="1">
187            <bounds x="2" y="2" width="48" height="48"/>
188            <color red="0.0" green="0.0" blue="0.75" />
189        </rect>
190        <text string="  3 " state="1">
191            <bounds x="10" y="26" width="40" height="20"/>
192            <color red="1.0" green="1.0" blue="1.0" />
193        </text>
194    </element>
195 
196    <element name="pushbutton4" defstate="1">
197        <rect>
198            <bounds x="2" y="2" width="48" height="48"/>
199            <color red="0.1" green="0.1" blue="0.1" />
200        </rect>
201        <rect state="0">
202            <bounds x="0" y="0" width="48" height="48"/>
203            <color red="0.0" green="0.0" blue="0.75" />
204        </rect>
205        <text string="  4 " state="0">
206            <bounds x="8" y="24" width="40" height="20"/>
207            <color red="1.0" green="1.0" blue="1.0" />
208        </text>
209        <rect state="1">
210            <bounds x="2" y="2" width="48" height="48"/>
211            <color red="0.0" green="0.0" blue="0.75" />
212        </rect>
213        <text string="  4 " state="1">
214            <bounds x="10" y="26" width="40" height="20"/>
215            <color red="1.0" green="1.0" blue="1.0" />
216        </text>
217    </element>
218 
219    <element name="pushbutton5" defstate="1">
220        <rect>
221            <bounds x="2" y="2" width="48" height="48"/>
222            <color red="0.1" green="0.1" blue="0.1" />
223        </rect>
224        <rect state="0">
225            <bounds x="0" y="0" width="48" height="48"/>
226            <color red="0.0" green="0.0" blue="0.75" />
227        </rect>
228        <text string="  5 " state="0">
229            <bounds x="8" y="24" width="40" height="20"/>
230            <color red="1.0" green="1.0" blue="1.0" />
231        </text>
232        <rect state="1">
233            <bounds x="2" y="2" width="48" height="48"/>
234            <color red="0.0" green="0.0" blue="0.75" />
235        </rect>
236        <text string="  5 " state="1">
237            <bounds x="10" y="26" width="40" height="20"/>
238            <color red="1.0" green="1.0" blue="1.0" />
239        </text>
240    </element>
241 
242    <element name="pushbutton6" defstate="1">
243        <rect>
244            <bounds x="2" y="2" width="48" height="48"/>
245            <color red="0.1" green="0.1" blue="0.1" />
246        </rect>
247        <rect state="0">
248            <bounds x="0" y="0" width="48" height="48"/>
249            <color red="0.0" green="0.0" blue="0.75" />
250        </rect>
251        <text string="  6 " state="0">
252            <bounds x="8" y="24" width="40" height="20"/>
253            <color red="1.0" green="1.0" blue="1.0" />
254        </text>
255        <rect state="1">
256            <bounds x="2" y="2" width="48" height="48"/>
257            <color red="0.0" green="0.0" blue="0.75" />
258        </rect>
259        <text string="  6 " state="1">
260            <bounds x="10" y="26" width="40" height="20"/>
261            <color red="1.0" green="1.0" blue="1.0" />
262        </text>
263    </element>
264 
265    <element name="pushbutton7" defstate="1">
266        <rect>
267            <bounds x="2" y="2" width="48" height="48"/>
268            <color red="0.1" green="0.1" blue="0.1" />
269        </rect>
270        <rect state="0">
271            <bounds x="0" y="0" width="48" height="48"/>
272            <color red="0.0" green="0.0" blue="0.75" />
273        </rect>
274        <text string="  7 " state="0">
275            <bounds x="8" y="24" width="40" height="20"/>
276            <color red="1.0" green="1.0" blue="1.0" />
277        </text>
278        <rect state="1">
279            <bounds x="2" y="2" width="48" height="48"/>
280            <color red="0.0" green="0.0" blue="0.75" />
281        </rect>
282        <text string="  7 " state="1">
283            <bounds x="10" y="26" width="40" height="20"/>
284            <color red="1.0" green="1.0" blue="1.0" />
285        </text>
286    </element>
287 
288    <element name="pushbutton8" defstate="1">
289        <rect>
290            <bounds x="2" y="2" width="48" height="48"/>
291            <color red="0.1" green="0.1" blue="0.1" />
292        </rect>
293        <rect state="0">
294            <bounds x="0" y="0" width="48" height="48"/>
295            <color red="0.0" green="0.0" blue="0.75" />
296        </rect>
297        <text string="  8 " state="0">
298            <bounds x="8" y="24" width="40" height="20"/>
299            <color red="1.0" green="1.0" blue="1.0" />
300        </text>
301        <rect state="1">
302            <bounds x="2" y="2" width="48" height="48"/>
303            <color red="0.0" green="0.0" blue="0.75" />
304        </rect>
305        <text string="  8 " state="1">
306            <bounds x="10" y="26" width="40" height="20"/>
307            <color red="1.0" green="1.0" blue="1.0" />
308        </text>
309    </element>
310 
311    <element name="pushbutton9" defstate="1">
312        <rect>
313            <bounds x="2" y="2" width="48" height="48"/>
314            <color red="0.1" green="0.1" blue="0.1" />
315        </rect>
316        <rect state="0">
317            <bounds x="0" y="0" width="48" height="48"/>
318            <color red="0.0" green="0.0" blue="0.75" />
319        </rect>
320        <text string="  9 " state="0">
321            <bounds x="8" y="24" width="40" height="20"/>
322            <color red="1.0" green="1.0" blue="1.0" />
323        </text>
324        <rect state="1">
325            <bounds x="2" y="2" width="48" height="48"/>
326            <color red="0.0" green="0.0" blue="0.75" />
327        </rect>
328        <text string="  9 " state="1">
329            <bounds x="10" y="26" width="40" height="20"/>
330            <color red="1.0" green="1.0" blue="1.0" />
331        </text>
332    </element>
333 
334    <element name="pushbuttonA" defstate="1">
335        <rect>
336            <bounds x="2" y="2" width="48" height="48"/>
337            <color red="0.1" green="0.1" blue="0.1" />
338        </rect>
339        <rect state="0">
340            <bounds x="0" y="0" width="48" height="48"/>
341            <color red="0.0" green="0.0" blue="0.75" />
342        </rect>
343        <text string="  A " state="0">
344            <bounds x="8" y="24" width="40" height="20"/>
345            <color red="1.0" green="1.0" blue="1.0" />
346        </text>
347        <rect state="1">
348            <bounds x="2" y="2" width="48" height="48"/>
349            <color red="0.0" green="0.0" blue="0.75" />
350        </rect>
351        <text string="  A " state="1">
352            <bounds x="10" y="26" width="40" height="20"/>
353            <color red="1.0" green="1.0" blue="1.0" />
354        </text>
355    </element>
356 
357    <element name="pushbuttonB" defstate="1">
358        <rect>
359            <bounds x="2" y="2" width="48" height="48"/>
360            <color red="0.1" green="0.1" blue="0.1" />
361        </rect>
362        <rect state="0">
363            <bounds x="0" y="0" width="48" height="48"/>
364            <color red="0.0" green="0.0" blue="0.75" />
365        </rect>
366        <text string="  B " state="0">
367            <bounds x="8" y="24" width="40" height="20"/>
368            <color red="1.0" green="1.0" blue="1.0" />
369        </text>
370        <rect state="1">
371            <bounds x="2" y="2" width="48" height="48"/>
372            <color red="0.0" green="0.0" blue="0.75" />
373        </rect>
374        <text string="  B " state="1">
375            <bounds x="10" y="26" width="40" height="20"/>
376            <color red="1.0" green="1.0" blue="1.0" />
377        </text>
378    </element>
379 
380    <element name="pushbuttonC" defstate="1">
381        <rect>
382            <bounds x="2" y="2" width="48" height="48"/>
383            <color red="0.1" green="0.1" blue="0.1" />
384        </rect>
385        <rect state="0">
386            <bounds x="0" y="0" width="48" height="48"/>
387            <color red="0.0" green="0.0" blue="0.75" />
388        </rect>
389        <text string="  C " state="0">
390            <bounds x="8" y="24" width="40" height="20"/>
391            <color red="1.0" green="1.0" blue="1.0" />
392        </text>
393        <rect state="1">
394            <bounds x="2" y="2" width="48" height="48"/>
395            <color red="0.0" green="0.0" blue="0.75" />
396        </rect>
397        <text string="  C " state="1">
398            <bounds x="10" y="26" width="40" height="20"/>
399            <color red="1.0" green="1.0" blue="1.0" />
400        </text>
401    </element>
402 
403    <element name="pushbuttonD" defstate="1">
404        <rect>
405            <bounds x="2" y="2" width="48" height="48"/>
406            <color red="0.1" green="0.1" blue="0.1" />
407        </rect>
408        <rect state="0">
409            <bounds x="0" y="0" width="48" height="48"/>
410            <color red="0.0" green="0.0" blue="0.75" />
411        </rect>
412        <text string="  D " state="0">
413            <bounds x="8" y="24" width="40" height="20"/>
414            <color red="1.0" green="1.0" blue="1.0" />
415        </text>
416        <rect state="1">
417            <bounds x="2" y="2" width="48" height="48"/>
418            <color red="0.0" green="0.0" blue="0.75" />
419        </rect>
420        <text string="  D " state="1">
421            <bounds x="10" y="26" width="40" height="20"/>
422            <color red="1.0" green="1.0" blue="1.0" />
423        </text>
424    </element>
425 
426    <element name="pushbuttonE" defstate="1">
427        <rect>
428            <bounds x="2" y="2" width="48" height="48"/>
429            <color red="0.1" green="0.1" blue="0.1" />
430        </rect>
431        <rect state="0">
432            <bounds x="0" y="0" width="48" height="48"/>
433            <color red="0.0" green="0.0" blue="0.75" />
434        </rect>
435        <text string="  E " state="0">
436            <bounds x="8" y="24" width="40" height="20"/>
437            <color red="1.0" green="1.0" blue="1.0" />
438        </text>
439        <rect state="1">
440            <bounds x="2" y="2" width="48" height="48"/>
441            <color red="0.0" green="0.0" blue="0.75" />
442        </rect>
443        <text string="  E " state="1">
444            <bounds x="10" y="26" width="40" height="20"/>
445            <color red="1.0" green="1.0" blue="1.0" />
446        </text>
447    </element>
448 
449    <element name="pushbuttonF" defstate="1">
450        <rect>
451            <bounds x="2" y="2" width="48" height="48"/>
452            <color red="0.1" green="0.1" blue="0.1" />
453        </rect>
454        <rect state="0">
455            <bounds x="0" y="0" width="48" height="48"/>
456            <color red="0.0" green="0.0" blue="0.75" />
457        </rect>
458        <text string="  F " state="0">
459            <bounds x="8" y="24" width="40" height="20"/>
460            <color red="1.0" green="1.0" blue="1.0" />
461        </text>
462        <rect state="1">
463            <bounds x="2" y="2" width="48" height="48"/>
464            <color red="0.0" green="0.0" blue="0.75" />
465        </rect>
466        <text string="  F " state="1">
467            <bounds x="10" y="26" width="40" height="20"/>
468            <color red="1.0" green="1.0" blue="1.0" />
469        </text>
470    </element>
471 
472    <element name="flatbackground">
473        <rect>
474            <bounds left="-10" top="-10" right="587" bottom="813" />
475            <color red="0.1" green="0.1" blue="0.1" />
476        </rect>
477        <rect>
478            <bounds left="5" top="5" right="577" bottom="803" />
479            <color red="0.1" green="0.2" blue="0.1" />
480        </rect>
481        <rect>
482            <bounds left="0" top="0" right="572" bottom="798" />
483            <color red="0.1" green="0.3" blue="0.1" />
484        </rect>
485    </element>
486 
487    <element name="LX.384">
488        <text string="LX.384">
489            <bounds x="0" y="0" width="120" height="40"/>
490            <color red="1.0" green="1.0" blue="1.0" />
491        </text>
492    </element>
493 
494    <view name="Standard">
495        <backdrop element="flatbackground">
496            <bounds x="704" y="50" width="420" height="400" />
497        </backdrop>
498 
499        <backdrop element="gray">
500            <bounds x="724" y="74" width="375" height="350" />
501        </backdrop>
502 
503        <bezel element="LX.384">
504            <bounds x="726" y="80" width="90" height="30" />
505        </bezel>
506 
507        <!-- LEDs -->
508        <!-- LEDs --> <!-- x step = 40 -->
509        <bezel element="digit_back">
510            <bounds x="740" y="119" width="36" height="52" />
511        </bezel>
512        <bezel element="digit_back">
513            <bounds x="784" y="119" width="36" height="52" />
514        </bezel>
515        <bezel element="digit_back">
516            <bounds x="828" y="119" width="36" height="52" />
517        </bezel>
518        <bezel element="digit_back">
519            <bounds x="872" y="119" width="36" height="52" />
520        </bezel>
521        <bezel element="digit_back">
522            <bounds x="916" y="119" width="36" height="52" />
523        </bezel>
524        <bezel element="digit_back">
525            <bounds x="960" y="119" width="36" height="52" />
526        </bezel>
527        <bezel element="digit_back">
528            <bounds x="1004" y="119" width="36" height="52" />
529        </bezel>
530        <bezel element="digit_back">
531            <bounds x="1048" y="119" width="36" height="52" />
532        </bezel>
533        <bezel name="digit7" element="digit">
534            <bounds x="743" y="126" width="30" height="40" />
535        </bezel>
536        <bezel name="digit6" element="digit">
537            <bounds x="787" y="126" width="30" height="40" />
538        </bezel>
539        <bezel name="digit5" element="digit">
540            <bounds x="831" y="126" width="30" height="40" />
541        </bezel>
542        <bezel name="digit4" element="digit">
543            <bounds x="875" y="126" width="30" height="40" />
544        </bezel>
545        <bezel name="digit3" element="digit">
546            <bounds x="919" y="126" width="30" height="40" />
547        </bezel>
548        <bezel name="digit2" element="digit">
549            <bounds x="963" y="126" width="30" height="40" />
550        </bezel>
551        <bezel name="digit1" element="digit">
552            <bounds x="1007" y="126" width="30" height="40" />
553        </bezel>
554        <bezel name="digit0" element="digit">
555            <bounds x="1051" y="126" width="30" height="40" />
556        </bezel>
557 
558 
559        <!-- Buttons -->
560 
561        <!-- "Control" -->
562        <bezel element="pushbuttonCTRL" inputtag="CTRL" inputmask="0x10">
563            <bounds x="765" y="338" width="40" height="40"/>
564        </bezel>
565 
566        <!-- "Reset" -->
567        <bezel element="pushbuttonRST" inputtag="RST" inputmask="0x01">
568            <bounds x="765" y="210" width="40" height="40"/>
569        </bezel>
570 
571 
572        <!-- Row 0 :  0 1 2 3 4 5 6 7 --> <!-- xstep=45, ystep=43 -->
573        <!-- "0" -->
574        <bezel element="pushbutton0" inputtag="ROW0" inputmask="0x01">
575            <bounds x="886" y="339" width="40" height="40"/>
576        </bezel>
577 
578        <!-- "1" -->
579        <bezel element="pushbutton1" inputtag="ROW0" inputmask="0x02">
580            <bounds x="886" y="296" width="40" height="40"/>
581        </bezel>
582 
583        <!-- "2" -->
584        <bezel element="pushbutton2" inputtag="ROW0" inputmask="0x04">
585            <bounds x="931" y="296" width="40" height="40"/>
586        </bezel>
587 
588        <!-- "3" -->
589        <bezel element="pushbutton3" inputtag="ROW0" inputmask="0x08">
590            <bounds x="976" y="296" width="40" height="40"/>
591        </bezel>
592 
593        <!-- "4" -->
594        <bezel element="pushbutton4" inputtag="ROW0" inputmask="0x10">
595            <bounds x="886" y="253" width="40" height="40"/>
596        </bezel>
597 
598        <!-- "5" -->
599        <bezel element="pushbutton5" inputtag="ROW0" inputmask="0x20">
600            <bounds x="931" y="253" width="40" height="40"/>
601        </bezel>
602 
603        <!-- "6" -->
604        <bezel element="pushbutton6" inputtag="ROW0" inputmask="0x40">
605            <bounds x="976" y="253" width="40" height="40"/>
606        </bezel>
607 
608        <!-- "7" -->
609        <bezel element="pushbutton7" inputtag="ROW0" inputmask="0x80">
610            <bounds x="886" y="210" width="40" height="40"/>
611        </bezel>
612 
613 
614 
615        <!-- Buttons -->
616        <!-- Row 1 :  8 9 A B C D E F -->
617        <!-- "8" -->
618        <bezel element="pushbutton8" inputtag="ROW1" inputmask="0x01">
619            <bounds x="931" y="210" width="40" height="40"/>
620        </bezel>
621 
622        <!-- "9" -->
623        <bezel element="pushbutton9" inputtag="ROW1" inputmask="0x02">
624            <bounds x="976" y="210" width="40" height="40"/>
625        </bezel>
626 
627        <!-- "A" -->
628        <bezel element="pushbuttonA" inputtag="ROW1" inputmask="0x04">
629            <bounds x="1021" y="210" width="40" height="40"/>
630        </bezel>
631 
632        <!-- "B" -->
633        <bezel element="pushbuttonB" inputtag="ROW1" inputmask="0x08">
634            <bounds x="1021" y="253" width="40" height="40"/>
635        </bezel>
636 
637        <!-- "C" -->
638        <bezel element="pushbuttonC" inputtag="ROW1" inputmask="0x10">
639            <bounds x="1021" y="296" width="40" height="40"/>
640        </bezel>
641 
642        <!-- "D" -->
643        <bezel element="pushbuttonD" inputtag="ROW1" inputmask="0x20">
644            <bounds x="1021" y="339" width="40" height="40"/>
645        </bezel>
646 
647        <!-- "E" -->
648        <bezel element="pushbuttonE" inputtag="ROW1" inputmask="0x40">
649            <bounds x="976" y="339" width="40" height="40"/>
650        </bezel>
651 
652        <!-- "F" -->
653        <bezel element="pushbuttonF" inputtag="ROW1" inputmask="0x80">
654            <bounds x="931" y="339" width="40" height="40"/>
655        </bezel>
656 
657    </view>
658 
659</mamelayout>
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4
5<mamelayout version="2">
6
7    <element name="button" defstate="1" />
8
9    <element name="black">
10        <rect>
11            <bounds left="0" top="0" right="1" bottom="1" />
12            <color red="0.0" green="0.0" blue="0.0" />
13        </rect>
14    </element>
15
16    <element name="gray">
17        <rect>
18            <bounds left="0" top="0" right="1" bottom="1" />
19            <color red="0.15" green="0.15" blue="0.15" />
20        </rect>
21    </element>
22
23    <element name="digit_back">
24        <rect>
25            <bounds left="0" top="0" right="1" bottom="1" />
26            <color red="0.584" green="0.631" blue="0.690" />
27        </rect>
28    </element>
29
30    <element name="digit" defstate="0">
31        <led7seg>
32            <color red="0.75" green="0.0" blue="0.0"/>
33        </led7seg>
34    </element>
35
36    <element name="back">
37        <rect>
38            <bounds left="0" top="0" right="1" bottom="1" />
39            <color red="0.0" green="0.0" blue="0.0" />
40        </rect>
41    </element>
42
43    <element name="pushbutton" defstate="1">
44        <rect>
45            <bounds x="2" y="2" width="48" height="48"/>
46            <color red="0.1" green="0.1" blue="0.1" />
47        </rect>
48        <rect state="0">
49            <bounds x="0" y="0" width="48" height="48"/>
50            <color red="0.75" green="0.75" blue="0.0" />
51        </rect>
52        <rect state="1">
53            <bounds x="2" y="2" width="48" height="48"/>
54            <color red="0.75" green="0.75" blue="0.0" />
55        </rect>
56    </element>
57
58    <element name="pushbuttonCTRL" defstate="1">
59        <rect>
60            <bounds x="2" y="2" width="48" height="48"/>
61            <color red="0.1" green="0.1" blue="0.1" />
62        </rect>
63        <rect state="0">
64            <bounds x="0" y="0" width="48" height="48"/>
65            <color red="0.25" green="0.25" blue="0.25" />
66        </rect>
67        <text string="CTRL" state="0">
68            <bounds x="8" y="24" width="40" height="20"/>
69            <color red="1.0" green="1.0" blue="1.0" />
70        </text>
71        <rect state="1">
72            <bounds x="2" y="2" width="48" height="48"/>
73            <color red="0.25" green="0.25" blue="0.25" />
74        </rect>
75        <text string="CTRL" state="1">
76            <bounds x="10" y="26" width="40" height="20"/>
77            <color red="1.0" green="1.0" blue="1.0" />
78        </text>
79    </element>
80
81    <element name="pushbuttonRST" defstate="1">
82        <rect>
83            <bounds x="2" y="2" width="48" height="48"/>
84            <color red="0.1" green="0.1" blue="0.1" />
85        </rect>
86        <rect state="0">
87            <bounds x="0" y="0" width="48" height="48"/>
88            <color red="0.75" green="0" blue="0" />
89        </rect>
90        <text string="RST " state="0">
91            <bounds x="8" y="24" width="40" height="20"/>
92            <color red="1.0" green="1.0" blue="1.0" />
93        </text>
94        <rect state="1">
95            <bounds x="2" y="2" width="48" height="48"/>
96            <color red="0.75" green="0" blue="0" />
97        </rect>
98        <text string="RST " state="1">
99            <bounds x="10" y="26" width="40" height="20"/>
100            <color red="1.0" green="1.0" blue="1.0" />
101        </text>
102    </element>
103
104    <element name="pushbutton0" defstate="1">
105        <rect>
106            <bounds x="2" y="2" width="48" height="48"/>
107            <color red="0.1" green="0.1" blue="0.1" />
108        </rect>
109        <rect state="0">
110            <bounds x="0" y="0" width="48" height="48"/>
111            <color red="0.0" green="0.0" blue="0.75" />
112        </rect>
113        <text string="  0 " state="0">
114            <bounds x="8" y="24" width="40" height="20"/>
115            <color red="1.0" green="1.0" blue="1.0" />
116        </text>
117        <rect state="1">
118            <bounds x="2" y="2" width="48" height="48"/>
119            <color red="0.0" green="0.0" blue="0.75" />
120        </rect>
121        <text string="  0 " state="1">
122            <bounds x="10" y="26" width="40" height="20"/>
123            <color red="1.0" green="1.0" blue="1.0" />
124        </text>
125    </element>
126
127    <element name="pushbutton1" defstate="1">
128        <rect>
129            <bounds x="2" y="2" width="48" height="48"/>
130            <color red="0.1" green="0.1" blue="0.1" />
131        </rect>
132        <rect state="0">
133            <bounds x="0" y="0" width="48" height="48"/>
134            <color red="0.0" green="0.0" blue="0.75" />
135        </rect>
136        <text string="  1 " state="0">
137            <bounds x="8" y="24" width="40" height="20"/>
138            <color red="1.0" green="1.0" blue="1.0" />
139        </text>
140        <rect state="1">
141            <bounds x="2" y="2" width="48" height="48"/>
142            <color red="0.0" green="0.0" blue="0.75" />
143        </rect>
144        <text string="  1 " state="1">
145            <bounds x="10" y="26" width="40" height="20"/>
146            <color red="1.0" green="1.0" blue="1.0" />
147        </text>
148    </element>
149
150    <element name="pushbutton2" defstate="1">
151        <rect>
152            <bounds x="2" y="2" width="48" height="48"/>
153            <color red="0.1" green="0.1" blue="0.1" />
154        </rect>
155        <rect state="0">
156            <bounds x="0" y="0" width="48" height="48"/>
157            <color red="0.0" green="0.0" blue="0.75" />
158        </rect>
159        <text string="  2 " state="0">
160            <bounds x="8" y="24" width="40" height="20"/>
161            <color red="1.0" green="1.0" blue="1.0" />
162        </text>
163        <rect state="1">
164            <bounds x="2" y="2" width="48" height="48"/>
165            <color red="0.0" green="0.0" blue="0.75" />
166        </rect>
167        <text string="  2 " state="1">
168            <bounds x="10" y="26" width="40" height="20"/>
169            <color red="1.0" green="1.0" blue="1.0" />
170        </text>
171    </element>
172
173    <element name="pushbutton3" defstate="1">
174        <rect>
175            <bounds x="2" y="2" width="48" height="48"/>
176            <color red="0.1" green="0.1" blue="0.1" />
177        </rect>
178        <rect state="0">
179            <bounds x="0" y="0" width="48" height="48"/>
180            <color red="0.0" green="0.0" blue="0.75" />
181        </rect>
182        <text string="  3 " state="0">
183            <bounds x="8" y="24" width="40" height="20"/>
184            <color red="1.0" green="1.0" blue="1.0" />
185        </text>
186        <rect state="1">
187            <bounds x="2" y="2" width="48" height="48"/>
188            <color red="0.0" green="0.0" blue="0.75" />
189        </rect>
190        <text string="  3 " state="1">
191            <bounds x="10" y="26" width="40" height="20"/>
192            <color red="1.0" green="1.0" blue="1.0" />
193        </text>
194    </element>
195
196    <element name="pushbutton4" defstate="1">
197        <rect>
198            <bounds x="2" y="2" width="48" height="48"/>
199            <color red="0.1" green="0.1" blue="0.1" />
200        </rect>
201        <rect state="0">
202            <bounds x="0" y="0" width="48" height="48"/>
203            <color red="0.0" green="0.0" blue="0.75" />
204        </rect>
205        <text string="  4 " state="0">
206            <bounds x="8" y="24" width="40" height="20"/>
207            <color red="1.0" green="1.0" blue="1.0" />
208        </text>
209        <rect state="1">
210            <bounds x="2" y="2" width="48" height="48"/>
211            <color red="0.0" green="0.0" blue="0.75" />
212        </rect>
213        <text string="  4 " state="1">
214            <bounds x="10" y="26" width="40" height="20"/>
215            <color red="1.0" green="1.0" blue="1.0" />
216        </text>
217    </element>
218
219    <element name="pushbutton5" defstate="1">
220        <rect>
221            <bounds x="2" y="2" width="48" height="48"/>
222            <color red="0.1" green="0.1" blue="0.1" />
223        </rect>
224        <rect state="0">
225            <bounds x="0" y="0" width="48" height="48"/>
226            <color red="0.0" green="0.0" blue="0.75" />
227        </rect>
228        <text string="  5 " state="0">
229            <bounds x="8" y="24" width="40" height="20"/>
230            <color red="1.0" green="1.0" blue="1.0" />
231        </text>
232        <rect state="1">
233            <bounds x="2" y="2" width="48" height="48"/>
234            <color red="0.0" green="0.0" blue="0.75" />
235        </rect>
236        <text string="  5 " state="1">
237            <bounds x="10" y="26" width="40" height="20"/>
238            <color red="1.0" green="1.0" blue="1.0" />
239        </text>
240    </element>
241
242    <element name="pushbutton6" defstate="1">
243        <rect>
244            <bounds x="2" y="2" width="48" height="48"/>
245            <color red="0.1" green="0.1" blue="0.1" />
246        </rect>
247        <rect state="0">
248            <bounds x="0" y="0" width="48" height="48"/>
249            <color red="0.0" green="0.0" blue="0.75" />
250        </rect>
251        <text string="  6 " state="0">
252            <bounds x="8" y="24" width="40" height="20"/>
253            <color red="1.0" green="1.0" blue="1.0" />
254        </text>
255        <rect state="1">
256            <bounds x="2" y="2" width="48" height="48"/>
257            <color red="0.0" green="0.0" blue="0.75" />
258        </rect>
259        <text string="  6 " state="1">
260            <bounds x="10" y="26" width="40" height="20"/>
261            <color red="1.0" green="1.0" blue="1.0" />
262        </text>
263    </element>
264
265    <element name="pushbutton7" defstate="1">
266        <rect>
267            <bounds x="2" y="2" width="48" height="48"/>
268            <color red="0.1" green="0.1" blue="0.1" />
269        </rect>
270        <rect state="0">
271            <bounds x="0" y="0" width="48" height="48"/>
272            <color red="0.0" green="0.0" blue="0.75" />
273        </rect>
274        <text string="  7 " state="0">
275            <bounds x="8" y="24" width="40" height="20"/>
276            <color red="1.0" green="1.0" blue="1.0" />
277        </text>
278        <rect state="1">
279            <bounds x="2" y="2" width="48" height="48"/>
280            <color red="0.0" green="0.0" blue="0.75" />
281        </rect>
282        <text string="  7 " state="1">
283            <bounds x="10" y="26" width="40" height="20"/>
284            <color red="1.0" green="1.0" blue="1.0" />
285        </text>
286    </element>
287
288    <element name="pushbutton8" defstate="1">
289        <rect>
290            <bounds x="2" y="2" width="48" height="48"/>
291            <color red="0.1" green="0.1" blue="0.1" />
292        </rect>
293        <rect state="0">
294            <bounds x="0" y="0" width="48" height="48"/>
295            <color red="0.0" green="0.0" blue="0.75" />
296        </rect>
297        <text string="  8 " state="0">
298            <bounds x="8" y="24" width="40" height="20"/>
299            <color red="1.0" green="1.0" blue="1.0" />
300        </text>
301        <rect state="1">
302            <bounds x="2" y="2" width="48" height="48"/>
303            <color red="0.0" green="0.0" blue="0.75" />
304        </rect>
305        <text string="  8 " state="1">
306            <bounds x="10" y="26" width="40" height="20"/>
307            <color red="1.0" green="1.0" blue="1.0" />
308        </text>
309    </element>
310
311    <element name="pushbutton9" defstate="1">
312        <rect>
313            <bounds x="2" y="2" width="48" height="48"/>
314            <color red="0.1" green="0.1" blue="0.1" />
315        </rect>
316        <rect state="0">
317            <bounds x="0" y="0" width="48" height="48"/>
318            <color red="0.0" green="0.0" blue="0.75" />
319        </rect>
320        <text string="  9 " state="0">
321            <bounds x="8" y="24" width="40" height="20"/>
322            <color red="1.0" green="1.0" blue="1.0" />
323        </text>
324        <rect state="1">
325            <bounds x="2" y="2" width="48" height="48"/>
326            <color red="0.0" green="0.0" blue="0.75" />
327        </rect>
328        <text string="  9 " state="1">
329            <bounds x="10" y="26" width="40" height="20"/>
330            <color red="1.0" green="1.0" blue="1.0" />
331        </text>
332    </element>
333
334    <element name="pushbuttonA" defstate="1">
335        <rect>
336            <bounds x="2" y="2" width="48" height="48"/>
337            <color red="0.1" green="0.1" blue="0.1" />
338        </rect>
339        <rect state="0">
340            <bounds x="0" y="0" width="48" height="48"/>
341            <color red="0.0" green="0.0" blue="0.75" />
342        </rect>
343        <text string="  A " state="0">
344            <bounds x="8" y="24" width="40" height="20"/>
345            <color red="1.0" green="1.0" blue="1.0" />
346        </text>
347        <rect state="1">
348            <bounds x="2" y="2" width="48" height="48"/>
349            <color red="0.0" green="0.0" blue="0.75" />
350        </rect>
351        <text string="  A " state="1">
352            <bounds x="10" y="26" width="40" height="20"/>
353            <color red="1.0" green="1.0" blue="1.0" />
354        </text>
355    </element>
356
357    <element name="pushbuttonB" defstate="1">
358        <rect>
359            <bounds x="2" y="2" width="48" height="48"/>
360            <color red="0.1" green="0.1" blue="0.1" />
361        </rect>
362        <rect state="0">
363            <bounds x="0" y="0" width="48" height="48"/>
364            <color red="0.0" green="0.0" blue="0.75" />
365        </rect>
366        <text string="  B " state="0">
367            <bounds x="8" y="24" width="40" height="20"/>
368            <color red="1.0" green="1.0" blue="1.0" />
369        </text>
370        <rect state="1">
371            <bounds x="2" y="2" width="48" height="48"/>
372            <color red="0.0" green="0.0" blue="0.75" />
373        </rect>
374        <text string="  B " state="1">
375            <bounds x="10" y="26" width="40" height="20"/>
376            <color red="1.0" green="1.0" blue="1.0" />
377        </text>
378    </element>
379
380    <element name="pushbuttonC" defstate="1">
381        <rect>
382            <bounds x="2" y="2" width="48" height="48"/>
383            <color red="0.1" green="0.1" blue="0.1" />
384        </rect>
385        <rect state="0">
386            <bounds x="0" y="0" width="48" height="48"/>
387            <color red="0.0" green="0.0" blue="0.75" />
388        </rect>
389        <text string="  C " state="0">
390            <bounds x="8" y="24" width="40" height="20"/>
391            <color red="1.0" green="1.0" blue="1.0" />
392        </text>
393        <rect state="1">
394            <bounds x="2" y="2" width="48" height="48"/>
395            <color red="0.0" green="0.0" blue="0.75" />
396        </rect>
397        <text string="  C " state="1">
398            <bounds x="10" y="26" width="40" height="20"/>
399            <color red="1.0" green="1.0" blue="1.0" />
400        </text>
401    </element>
402
403    <element name="pushbuttonD" defstate="1">
404        <rect>
405            <bounds x="2" y="2" width="48" height="48"/>
406            <color red="0.1" green="0.1" blue="0.1" />
407        </rect>
408        <rect state="0">
409            <bounds x="0" y="0" width="48" height="48"/>
410            <color red="0.0" green="0.0" blue="0.75" />
411        </rect>
412        <text string="  D " state="0">
413            <bounds x="8" y="24" width="40" height="20"/>
414            <color red="1.0" green="1.0" blue="1.0" />
415        </text>
416        <rect state="1">
417            <bounds x="2" y="2" width="48" height="48"/>
418            <color red="0.0" green="0.0" blue="0.75" />
419        </rect>
420        <text string="  D " state="1">
421            <bounds x="10" y="26" width="40" height="20"/>
422            <color red="1.0" green="1.0" blue="1.0" />
423        </text>
424    </element>
425
426    <element name="pushbuttonE" defstate="1">
427        <rect>
428            <bounds x="2" y="2" width="48" height="48"/>
429            <color red="0.1" green="0.1" blue="0.1" />
430        </rect>
431        <rect state="0">
432            <bounds x="0" y="0" width="48" height="48"/>
433            <color red="0.0" green="0.0" blue="0.75" />
434        </rect>
435        <text string="  E " state="0">
436            <bounds x="8" y="24" width="40" height="20"/>
437            <color red="1.0" green="1.0" blue="1.0" />
438        </text>
439        <rect state="1">
440            <bounds x="2" y="2" width="48" height="48"/>
441            <color red="0.0" green="0.0" blue="0.75" />
442        </rect>
443        <text string="  E " state="1">
444            <bounds x="10" y="26" width="40" height="20"/>
445            <color red="1.0" green="1.0" blue="1.0" />
446        </text>
447    </element>
448
449    <element name="pushbuttonF" defstate="1">
450        <rect>
451            <bounds x="2" y="2" width="48" height="48"/>
452            <color red="0.1" green="0.1" blue="0.1" />
453        </rect>
454        <rect state="0">
455            <bounds x="0" y="0" width="48" height="48"/>
456            <color red="0.0" green="0.0" blue="0.75" />
457        </rect>
458        <text string="  F " state="0">
459            <bounds x="8" y="24" width="40" height="20"/>
460            <color red="1.0" green="1.0" blue="1.0" />
461        </text>
462        <rect state="1">
463            <bounds x="2" y="2" width="48" height="48"/>
464            <color red="0.0" green="0.0" blue="0.75" />
465        </rect>
466        <text string="  F " state="1">
467            <bounds x="10" y="26" width="40" height="20"/>
468            <color red="1.0" green="1.0" blue="1.0" />
469        </text>
470    </element>
471
472    <element name="flatbackground">
473        <rect>
474            <bounds left="-10" top="-10" right="587" bottom="813" />
475            <color red="0.1" green="0.1" blue="0.1" />
476        </rect>
477        <rect>
478            <bounds left="5" top="5" right="577" bottom="803" />
479            <color red="0.1" green="0.2" blue="0.1" />
480        </rect>
481        <rect>
482            <bounds left="0" top="0" right="572" bottom="798" />
483            <color red="0.1" green="0.3" blue="0.1" />
484        </rect>
485    </element>
486
487    <element name="LX.384">
488        <text string="LX.384">
489            <bounds x="0" y="0" width="120" height="40"/>
490            <color red="1.0" green="1.0" blue="1.0" />
491        </text>
492    </element>
493
494    <view name="Standard">
495        <backdrop element="flatbackground">
496            <bounds x="704" y="50" width="420" height="400" />
497        </backdrop>
498
499        <backdrop element="gray">
500            <bounds x="724" y="74" width="375" height="350" />
501        </backdrop>
502
503        <bezel element="LX.384">
504            <bounds x="726" y="80" width="90" height="30" />
505        </bezel>
506
507        <!-- LEDs -->
508        <!-- LEDs --> <!-- x step = 40 -->
509        <bezel element="digit_back">
510            <bounds x="740" y="119" width="36" height="52" />
511        </bezel>
512        <bezel element="digit_back">
513            <bounds x="784" y="119" width="36" height="52" />
514        </bezel>
515        <bezel element="digit_back">
516            <bounds x="828" y="119" width="36" height="52" />
517        </bezel>
518        <bezel element="digit_back">
519            <bounds x="872" y="119" width="36" height="52" />
520        </bezel>
521        <bezel element="digit_back">
522            <bounds x="916" y="119" width="36" height="52" />
523        </bezel>
524        <bezel element="digit_back">
525            <bounds x="960" y="119" width="36" height="52" />
526        </bezel>
527        <bezel element="digit_back">
528            <bounds x="1004" y="119" width="36" height="52" />
529        </bezel>
530        <bezel element="digit_back">
531            <bounds x="1048" y="119" width="36" height="52" />
532        </bezel>
533        <bezel name="digit7" element="digit">
534            <bounds x="743" y="126" width="30" height="40" />
535        </bezel>
536        <bezel name="digit6" element="digit">
537            <bounds x="787" y="126" width="30" height="40" />
538        </bezel>
539        <bezel name="digit5" element="digit">
540            <bounds x="831" y="126" width="30" height="40" />
541        </bezel>
542        <bezel name="digit4" element="digit">
543            <bounds x="875" y="126" width="30" height="40" />
544        </bezel>
545        <bezel name="digit3" element="digit">
546            <bounds x="919" y="126" width="30" height="40" />
547        </bezel>
548        <bezel name="digit2" element="digit">
549            <bounds x="963" y="126" width="30" height="40" />
550        </bezel>
551        <bezel name="digit1" element="digit">
552            <bounds x="1007" y="126" width="30" height="40" />
553        </bezel>
554        <bezel name="digit0" element="digit">
555            <bounds x="1051" y="126" width="30" height="40" />
556        </bezel>
557
558
559        <!-- Buttons -->
560
561        <!-- "Control" -->
562        <bezel element="pushbuttonCTRL" inputtag="CTRL" inputmask="0x10">
563            <bounds x="765" y="338" width="40" height="40"/>
564        </bezel>
565
566        <!-- "Reset" -->
567        <bezel element="pushbuttonRST" inputtag="RST" inputmask="0x01">
568            <bounds x="765" y="210" width="40" height="40"/>
569        </bezel>
570
571
572        <!-- Row 0 :  0 1 2 3 4 5 6 7 --> <!-- xstep=45, ystep=43 -->
573        <!-- "0" -->
574        <bezel element="pushbutton0" inputtag="ROW0" inputmask="0x01">
575            <bounds x="886" y="339" width="40" height="40"/>
576        </bezel>
577
578        <!-- "1" -->
579        <bezel element="pushbutton1" inputtag="ROW0" inputmask="0x02">
580            <bounds x="886" y="296" width="40" height="40"/>
581        </bezel>
582
583        <!-- "2" -->
584        <bezel element="pushbutton2" inputtag="ROW0" inputmask="0x04">
585            <bounds x="931" y="296" width="40" height="40"/>
586        </bezel>
587
588        <!-- "3" -->
589        <bezel element="pushbutton3" inputtag="ROW0" inputmask="0x08">
590            <bounds x="976" y="296" width="40" height="40"/>
591        </bezel>
592
593        <!-- "4" -->
594        <bezel element="pushbutton4" inputtag="ROW0" inputmask="0x10">
595            <bounds x="886" y="253" width="40" height="40"/>
596        </bezel>
597
598        <!-- "5" -->
599        <bezel element="pushbutton5" inputtag="ROW0" inputmask="0x20">
600            <bounds x="931" y="253" width="40" height="40"/>
601        </bezel>
602
603        <!-- "6" -->
604        <bezel element="pushbutton6" inputtag="ROW0" inputmask="0x40">
605            <bounds x="976" y="253" width="40" height="40"/>
606        </bezel>
607
608        <!-- "7" -->
609        <bezel element="pushbutton7" inputtag="ROW0" inputmask="0x80">
610            <bounds x="886" y="210" width="40" height="40"/>
611        </bezel>
612
613
614
615        <!-- Buttons -->
616        <!-- Row 1 :  8 9 A B C D E F -->
617        <!-- "8" -->
618        <bezel element="pushbutton8" inputtag="ROW1" inputmask="0x01">
619            <bounds x="931" y="210" width="40" height="40"/>
620        </bezel>
621
622        <!-- "9" -->
623        <bezel element="pushbutton9" inputtag="ROW1" inputmask="0x02">
624            <bounds x="976" y="210" width="40" height="40"/>
625        </bezel>
626
627        <!-- "A" -->
628        <bezel element="pushbuttonA" inputtag="ROW1" inputmask="0x04">
629            <bounds x="1021" y="210" width="40" height="40"/>
630        </bezel>
631
632        <!-- "B" -->
633        <bezel element="pushbuttonB" inputtag="ROW1" inputmask="0x08">
634            <bounds x="1021" y="253" width="40" height="40"/>
635        </bezel>
636
637        <!-- "C" -->
638        <bezel element="pushbuttonC" inputtag="ROW1" inputmask="0x10">
639            <bounds x="1021" y="296" width="40" height="40"/>
640        </bezel>
641
642        <!-- "D" -->
643        <bezel element="pushbuttonD" inputtag="ROW1" inputmask="0x20">
644            <bounds x="1021" y="339" width="40" height="40"/>
645        </bezel>
646
647        <!-- "E" -->
648        <bezel element="pushbuttonE" inputtag="ROW1" inputmask="0x40">
649            <bounds x="976" y="339" width="40" height="40"/>
650        </bezel>
651
652        <!-- "F" -->
653        <bezel element="pushbuttonF" inputtag="ROW1" inputmask="0x80">
654            <bounds x="931" y="339" width="40" height="40"/>
655        </bezel>
656
657    </view>
658
659</mamelayout>
src/mess/layout/z80net.lay
r4517r4518
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4 
5<mamelayout version="2">
6 
7    <element name="gray">
8        <rect>
9            <bounds left="0" top="0" right="1" bottom="1" />
10            <color red="0.15" green="0.15" blue="0.15" />
11        </rect> 
12    </element>
13 
14    <element name="digit_back">
15        <rect>
16            <bounds left="0" top="0" right="1" bottom="1" />
17            <color red="0.584" green="0.631" blue="0.690" />
18        </rect> 
19    </element>
20 
21    <element name="digit" defstate="0">
22        <led7seg>
23            <color red="0.75" green="0.0" blue="0.0"/>
24        </led7seg>
25    </element>
26 
27    <element name="back">
28        <rect>
29            <bounds left="0" top="0" right="1" bottom="1" />
30            <color red="0.0" green="0.0" blue="0.0" />
31        </rect> 
32    </element>
33 
34    <element name="pushbutton" defstate="1">
35        <rect>
36            <bounds x="2" y="2" width="48" height="48"/>
37            <color red="0.1" green="0.1" blue="0.1" />
38        </rect>
39        <rect state="0">
40            <bounds x="0" y="0" width="48" height="48"/>
41            <color red="0.75" green="0.75" blue="0.0" />
42        </rect>
43        <rect state="1">
44            <bounds x="2" y="2" width="48" height="48"/>
45            <color red="0.75" green="0.75" blue="0.0" />
46        </rect>
47    </element>
48 
49    <element name="pushbuttonCTRL" defstate="1">
50        <rect>
51            <bounds x="2" y="2" width="48" height="48"/>
52            <color red="0.1" green="0.1" blue="0.1" />
53        </rect>
54        <rect state="0">
55            <bounds x="0" y="0" width="48" height="48"/>
56            <color red="0.25" green="0.25" blue="0.25" />
57        </rect>
58        <text string="CTRL" state="0">
59            <bounds x="8" y="24" width="40" height="20"/>
60            <color red="1.0" green="1.0" blue="1.0" />
61        </text>
62        <rect state="1">
63            <bounds x="2" y="2" width="48" height="48"/>
64            <color red="0.25" green="0.25" blue="0.25" />
65        </rect>
66        <text string="CTRL" state="1">
67            <bounds x="10" y="26" width="40" height="20"/>
68            <color red="1.0" green="1.0" blue="1.0" />
69        </text>
70    </element>
71 
72    <element name="pushbuttonRST" defstate="1">
73        <rect>
74            <bounds x="2" y="2" width="48" height="48"/>
75            <color red="0.1" green="0.1" blue="0.1" />
76        </rect>
77        <rect state="0">
78            <bounds x="0" y="0" width="48" height="48"/>
79            <color red="0.75" green="0" blue="0" />
80        </rect>
81        <text string="RST " state="0">
82            <bounds x="8" y="24" width="40" height="20"/>
83            <color red="1.0" green="1.0" blue="1.0" />
84        </text>
85        <rect state="1">
86            <bounds x="2" y="2" width="48" height="48"/>
87            <color red="0.75" green="0" blue="0" />
88        </rect>
89        <text string="RST " state="1">
90            <bounds x="10" y="26" width="40" height="20"/>
91            <color red="1.0" green="1.0" blue="1.0" />
92        </text>
93    </element>
94 
95    <element name="pushbutton0" defstate="1">
96        <rect>
97            <bounds x="2" y="2" width="48" height="48"/>
98            <color red="0.1" green="0.1" blue="0.1" />
99        </rect>
100        <rect state="0">
101            <bounds x="0" y="0" width="48" height="48"/>
102            <color red="0.0" green="0.0" blue="0.75" />
103        </rect>
104        <text string="  0 " state="0">
105            <bounds x="8" y="24" width="40" height="20"/>
106            <color red="1.0" green="1.0" blue="1.0" />
107        </text>
108        <rect state="1">
109            <bounds x="2" y="2" width="48" height="48"/>
110            <color red="0.0" green="0.0" blue="0.75" />
111        </rect>
112        <text string="  0 " state="1">
113            <bounds x="10" y="26" width="40" height="20"/>
114            <color red="1.0" green="1.0" blue="1.0" />
115        </text>
116    </element>
117 
118    <element name="pushbutton1" defstate="1">
119        <rect>
120            <bounds x="2" y="2" width="48" height="48"/>
121            <color red="0.1" green="0.1" blue="0.1" />
122        </rect>
123        <rect state="0">
124            <bounds x="0" y="0" width="48" height="48"/>
125            <color red="0.0" green="0.0" blue="0.75" />
126        </rect>
127        <text string="  1 " state="0">
128            <bounds x="8" y="24" width="40" height="20"/>
129            <color red="1.0" green="1.0" blue="1.0" />
130        </text>
131        <rect state="1">
132            <bounds x="2" y="2" width="48" height="48"/>
133            <color red="0.0" green="0.0" blue="0.75" />
134        </rect>
135        <text string="  1 " state="1">
136            <bounds x="10" y="26" width="40" height="20"/>
137            <color red="1.0" green="1.0" blue="1.0" />
138        </text>
139    </element>
140 
141    <element name="pushbutton2" defstate="1">
142        <rect>
143            <bounds x="2" y="2" width="48" height="48"/>
144            <color red="0.1" green="0.1" blue="0.1" />
145        </rect>
146        <rect state="0">
147            <bounds x="0" y="0" width="48" height="48"/>
148            <color red="0.0" green="0.0" blue="0.75" />
149        </rect>
150        <text string="  2 " state="0">
151            <bounds x="8" y="24" width="40" height="20"/>
152            <color red="1.0" green="1.0" blue="1.0" />
153        </text>
154        <rect state="1">
155            <bounds x="2" y="2" width="48" height="48"/>
156            <color red="0.0" green="0.0" blue="0.75" />
157        </rect>
158        <text string="  2 " state="1">
159            <bounds x="10" y="26" width="40" height="20"/>
160            <color red="1.0" green="1.0" blue="1.0" />
161        </text>
162    </element>
163 
164    <element name="pushbutton3" defstate="1">
165        <rect>
166            <bounds x="2" y="2" width="48" height="48"/>
167            <color red="0.1" green="0.1" blue="0.1" />
168        </rect>
169        <rect state="0">
170            <bounds x="0" y="0" width="48" height="48"/>
171            <color red="0.0" green="0.0" blue="0.75" />
172        </rect>
173        <text string="  3 " state="0">
174            <bounds x="8" y="24" width="40" height="20"/>
175            <color red="1.0" green="1.0" blue="1.0" />
176        </text>
177        <rect state="1">
178            <bounds x="2" y="2" width="48" height="48"/>
179            <color red="0.0" green="0.0" blue="0.75" />
180        </rect>
181        <text string="  3 " state="1">
182            <bounds x="10" y="26" width="40" height="20"/>
183            <color red="1.0" green="1.0" blue="1.0" />
184        </text>
185    </element>
186 
187    <element name="pushbutton4" defstate="1">
188        <rect>
189            <bounds x="2" y="2" width="48" height="48"/>
190            <color red="0.1" green="0.1" blue="0.1" />
191        </rect>
192        <rect state="0">
193            <bounds x="0" y="0" width="48" height="48"/>
194            <color red="0.0" green="0.0" blue="0.75" />
195        </rect>
196        <text string="  4 " state="0">
197            <bounds x="8" y="24" width="40" height="20"/>
198            <color red="1.0" green="1.0" blue="1.0" />
199        </text>
200        <rect state="1">
201            <bounds x="2" y="2" width="48" height="48"/>
202            <color red="0.0" green="0.0" blue="0.75" />
203        </rect>
204        <text string="  4 " state="1">
205            <bounds x="10" y="26" width="40" height="20"/>
206            <color red="1.0" green="1.0" blue="1.0" />
207        </text>
208    </element>
209 
210    <element name="pushbutton5" defstate="1">
211        <rect>
212            <bounds x="2" y="2" width="48" height="48"/>
213            <color red="0.1" green="0.1" blue="0.1" />
214        </rect>
215        <rect state="0">
216            <bounds x="0" y="0" width="48" height="48"/>
217            <color red="0.0" green="0.0" blue="0.75" />
218        </rect>
219        <text string="  5 " state="0">
220            <bounds x="8" y="24" width="40" height="20"/>
221            <color red="1.0" green="1.0" blue="1.0" />
222        </text>
223        <rect state="1">
224            <bounds x="2" y="2" width="48" height="48"/>
225            <color red="0.0" green="0.0" blue="0.75" />
226        </rect>
227        <text string="  5 " state="1">
228            <bounds x="10" y="26" width="40" height="20"/>
229            <color red="1.0" green="1.0" blue="1.0" />
230        </text>
231    </element>
232 
233    <element name="pushbutton6" defstate="1">
234        <rect>
235            <bounds x="2" y="2" width="48" height="48"/>
236            <color red="0.1" green="0.1" blue="0.1" />
237        </rect>
238        <rect state="0">
239            <bounds x="0" y="0" width="48" height="48"/>
240            <color red="0.0" green="0.0" blue="0.75" />
241        </rect>
242        <text string="  6 " state="0">
243            <bounds x="8" y="24" width="40" height="20"/>
244            <color red="1.0" green="1.0" blue="1.0" />
245        </text>
246        <rect state="1">
247            <bounds x="2" y="2" width="48" height="48"/>
248            <color red="0.0" green="0.0" blue="0.75" />
249        </rect>
250        <text string="  6 " state="1">
251            <bounds x="10" y="26" width="40" height="20"/>
252            <color red="1.0" green="1.0" blue="1.0" />
253        </text>
254    </element>
255 
256    <element name="pushbutton7" defstate="1">
257        <rect>
258            <bounds x="2" y="2" width="48" height="48"/>
259            <color red="0.1" green="0.1" blue="0.1" />
260        </rect>
261        <rect state="0">
262            <bounds x="0" y="0" width="48" height="48"/>
263            <color red="0.0" green="0.0" blue="0.75" />
264        </rect>
265        <text string="  7 " state="0">
266            <bounds x="8" y="24" width="40" height="20"/>
267            <color red="1.0" green="1.0" blue="1.0" />
268        </text>
269        <rect state="1">
270            <bounds x="2" y="2" width="48" height="48"/>
271            <color red="0.0" green="0.0" blue="0.75" />
272        </rect>
273        <text string="  7 " state="1">
274            <bounds x="10" y="26" width="40" height="20"/>
275            <color red="1.0" green="1.0" blue="1.0" />
276        </text>
277    </element>
278 
279    <element name="pushbutton8" defstate="1">
280        <rect>
281            <bounds x="2" y="2" width="48" height="48"/>
282            <color red="0.1" green="0.1" blue="0.1" />
283        </rect>
284        <rect state="0">
285            <bounds x="0" y="0" width="48" height="48"/>
286            <color red="0.0" green="0.0" blue="0.75" />
287        </rect>
288        <text string="  8 " state="0">
289            <bounds x="8" y="24" width="40" height="20"/>
290            <color red="1.0" green="1.0" blue="1.0" />
291        </text>
292        <rect state="1">
293            <bounds x="2" y="2" width="48" height="48"/>
294            <color red="0.0" green="0.0" blue="0.75" />
295        </rect>
296        <text string="  8 " state="1">
297            <bounds x="10" y="26" width="40" height="20"/>
298            <color red="1.0" green="1.0" blue="1.0" />
299        </text>
300    </element>
301 
302    <element name="pushbutton9" defstate="1">
303        <rect>
304            <bounds x="2" y="2" width="48" height="48"/>
305            <color red="0.1" green="0.1" blue="0.1" />
306        </rect>
307        <rect state="0">
308            <bounds x="0" y="0" width="48" height="48"/>
309            <color red="0.0" green="0.0" blue="0.75" />
310        </rect>
311        <text string="  9 " state="0">
312            <bounds x="8" y="24" width="40" height="20"/>
313            <color red="1.0" green="1.0" blue="1.0" />
314        </text>
315        <rect state="1">
316            <bounds x="2" y="2" width="48" height="48"/>
317            <color red="0.0" green="0.0" blue="0.75" />
318        </rect>
319        <text string="  9 " state="1">
320            <bounds x="10" y="26" width="40" height="20"/>
321            <color red="1.0" green="1.0" blue="1.0" />
322        </text>
323    </element>
324 
325    <element name="pushbuttonA" defstate="1">
326        <rect>
327            <bounds x="2" y="2" width="48" height="48"/>
328            <color red="0.1" green="0.1" blue="0.1" />
329        </rect>
330        <rect state="0">
331            <bounds x="0" y="0" width="48" height="48"/>
332            <color red="0.0" green="0.0" blue="0.75" />
333        </rect>
334        <text string="  A " state="0">
335            <bounds x="8" y="24" width="40" height="20"/>
336            <color red="1.0" green="1.0" blue="1.0" />
337        </text>
338        <rect state="1">
339            <bounds x="2" y="2" width="48" height="48"/>
340            <color red="0.0" green="0.0" blue="0.75" />
341        </rect>
342        <text string="  A " state="1">
343            <bounds x="10" y="26" width="40" height="20"/>
344            <color red="1.0" green="1.0" blue="1.0" />
345        </text>
346    </element>
347 
348    <element name="pushbuttonB" defstate="1">
349        <rect>
350            <bounds x="2" y="2" width="48" height="48"/>
351            <color red="0.1" green="0.1" blue="0.1" />
352        </rect>
353        <rect state="0">
354            <bounds x="0" y="0" width="48" height="48"/>
355            <color red="0.0" green="0.0" blue="0.75" />
356        </rect>
357        <text string="  B " state="0">
358            <bounds x="8" y="24" width="40" height="20"/>
359            <color red="1.0" green="1.0" blue="1.0" />
360        </text>
361        <rect state="1">
362            <bounds x="2" y="2" width="48" height="48"/>
363            <color red="0.0" green="0.0" blue="0.75" />
364        </rect>
365        <text string="  B " state="1">
366            <bounds x="10" y="26" width="40" height="20"/>
367            <color red="1.0" green="1.0" blue="1.0" />
368        </text>
369    </element>
370 
371    <element name="pushbuttonC" defstate="1">
372        <rect>
373            <bounds x="2" y="2" width="48" height="48"/>
374            <color red="0.1" green="0.1" blue="0.1" />
375        </rect>
376        <rect state="0">
377            <bounds x="0" y="0" width="48" height="48"/>
378            <color red="0.0" green="0.0" blue="0.75" />
379        </rect>
380        <text string="  C " state="0">
381            <bounds x="8" y="24" width="40" height="20"/>
382            <color red="1.0" green="1.0" blue="1.0" />
383        </text>
384        <rect state="1">
385            <bounds x="2" y="2" width="48" height="48"/>
386            <color red="0.0" green="0.0" blue="0.75" />
387        </rect>
388        <text string="  C " state="1">
389            <bounds x="10" y="26" width="40" height="20"/>
390            <color red="1.0" green="1.0" blue="1.0" />
391        </text>
392    </element>
393 
394    <element name="pushbuttonD" defstate="1">
395        <rect>
396            <bounds x="2" y="2" width="48" height="48"/>
397            <color red="0.1" green="0.1" blue="0.1" />
398        </rect>
399        <rect state="0">
400            <bounds x="0" y="0" width="48" height="48"/>
401            <color red="0.0" green="0.0" blue="0.75" />
402        </rect>
403        <text string="  D " state="0">
404            <bounds x="8" y="24" width="40" height="20"/>
405            <color red="1.0" green="1.0" blue="1.0" />
406        </text>
407        <rect state="1">
408            <bounds x="2" y="2" width="48" height="48"/>
409            <color red="0.0" green="0.0" blue="0.75" />
410        </rect>
411        <text string="  D " state="1">
412            <bounds x="10" y="26" width="40" height="20"/>
413            <color red="1.0" green="1.0" blue="1.0" />
414        </text>
415    </element>
416 
417    <element name="pushbuttonE" defstate="1">
418        <rect>
419            <bounds x="2" y="2" width="48" height="48"/>
420            <color red="0.1" green="0.1" blue="0.1" />
421        </rect>
422        <rect state="0">
423            <bounds x="0" y="0" width="48" height="48"/>
424            <color red="0.0" green="0.0" blue="0.75" />
425        </rect>
426        <text string="  E " state="0">
427            <bounds x="8" y="24" width="40" height="20"/>
428            <color red="1.0" green="1.0" blue="1.0" />
429        </text>
430        <rect state="1">
431            <bounds x="2" y="2" width="48" height="48"/>
432            <color red="0.0" green="0.0" blue="0.75" />
433        </rect>
434        <text string="  E " state="1">
435            <bounds x="10" y="26" width="40" height="20"/>
436            <color red="1.0" green="1.0" blue="1.0" />
437        </text>
438    </element>
439 
440    <element name="pushbuttonF" defstate="1">
441        <rect>
442            <bounds x="2" y="2" width="48" height="48"/>
443            <color red="0.1" green="0.1" blue="0.1" />
444        </rect>
445        <rect state="0">
446            <bounds x="0" y="0" width="48" height="48"/>
447            <color red="0.0" green="0.0" blue="0.75" />
448        </rect>
449        <text string="  F " state="0">
450            <bounds x="8" y="24" width="40" height="20"/>
451            <color red="1.0" green="1.0" blue="1.0" />
452        </text>
453        <rect state="1">
454            <bounds x="2" y="2" width="48" height="48"/>
455            <color red="0.0" green="0.0" blue="0.75" />
456        </rect>
457        <text string="  F " state="1">
458            <bounds x="10" y="26" width="40" height="20"/>
459            <color red="1.0" green="1.0" blue="1.0" />
460        </text>
461    </element>
462 
463    <element name="flatbackground">
464        <rect>
465            <bounds left="-10" top="-10" right="587" bottom="813" />
466            <color red="0.1" green="0.1" blue="0.1" />
467        </rect>
468        <rect>
469            <bounds left="5" top="5" right="577" bottom="803" />
470            <color red="0.1" green="0.2" blue="0.1" />
471        </rect>
472        <rect>
473            <bounds left="0" top="0" right="572" bottom="798" />
474            <color red="0.1" green="0.3" blue="0.1" />
475        </rect>
476    </element>
477 
478    <element name="LX.384">
479        <text string="LX.384">
480            <bounds x="0" y="0" width="120" height="40"/>
481            <color red="1.0" green="1.0" blue="1.0" />
482        </text>
483    </element>
484 
485    <element name="LX.388">
486        <text string="LX.388">
487            <bounds x="0" y="0" width="120" height="40"/>
488            <color red="1.0" green="1.0" blue="1.0" />
489        </text>
490    </element>
491 
492    <view name="Standard">
493        <backdrop element="flatbackground">
494            <bounds x="0" y="20" width="1175" height="590" />
495        </backdrop>
496 
497        <backdrop element="gray">
498            <bounds x="65" y="74" width="640" height="480" />
499        </backdrop>
500 
501        <bezel element="LX.388">
502            <bounds x="67" y="80" width="90" height="30" />
503        </bezel>
504 
505        <screen index="0">
506            <bounds x="65" y="74" width="640" height="480" />
507        </screen>
508 
509        <backdrop element="gray">
510            <bounds x="724" y="74" width="375" height="480" />
511        </backdrop>
512 
513        <bezel element="LX.384">
514            <bounds x="726" y="80" width="90" height="30" />
515        </bezel>
516 
517        <!-- LEDs -->
518        <!-- LEDs --> <!-- x step = 40 -->
519        <bezel element="digit_back">
520            <bounds x="740" y="119" width="36" height="52" />
521        </bezel>
522        <bezel element="digit_back">
523            <bounds x="784" y="119" width="36" height="52" />
524        </bezel>
525        <bezel element="digit_back">
526            <bounds x="828" y="119" width="36" height="52" />
527        </bezel>
528        <bezel element="digit_back">
529            <bounds x="872" y="119" width="36" height="52" />
530        </bezel>
531        <bezel element="digit_back">
532            <bounds x="916" y="119" width="36" height="52" />
533        </bezel>
534        <bezel element="digit_back">
535            <bounds x="960" y="119" width="36" height="52" />
536        </bezel>
537        <bezel element="digit_back">
538            <bounds x="1004" y="119" width="36" height="52" />
539        </bezel>
540        <bezel element="digit_back">
541            <bounds x="1048" y="119" width="36" height="52" />
542        </bezel>
543        <bezel name="digit7" element="digit">
544            <bounds x="743" y="126" width="30" height="40" />
545        </bezel>
546        <bezel name="digit6" element="digit">
547            <bounds x="787" y="126" width="30" height="40" />
548        </bezel>
549        <bezel name="digit5" element="digit">
550            <bounds x="831" y="126" width="30" height="40" />
551        </bezel>
552        <bezel name="digit4" element="digit">
553            <bounds x="875" y="126" width="30" height="40" />
554        </bezel>
555        <bezel name="digit3" element="digit">
556            <bounds x="919" y="126" width="30" height="40" />
557        </bezel>
558        <bezel name="digit2" element="digit">
559            <bounds x="963" y="126" width="30" height="40" />
560        </bezel>
561        <bezel name="digit1" element="digit">
562            <bounds x="1007" y="126" width="30" height="40" />
563        </bezel>
564        <bezel name="digit0" element="digit">
565            <bounds x="1051" y="126" width="30" height="40" />
566        </bezel>
567 
568 
569        <!-- Buttons -->
570 
571        <!-- "Control" -->
572        <bezel element="pushbuttonCTRL" inputtag="CTRL" inputmask="0x10">
573            <bounds x="765" y="338" width="40" height="40"/>
574        </bezel>
575 
576        <!-- "Reset" -->
577        <bezel element="pushbuttonRST" inputtag="RST" inputmask="0x01">
578            <bounds x="765" y="210" width="40" height="40"/>
579        </bezel>
580 
581 
582        <!-- Row 0 :  0 1 2 3 4 5 6 7 --> <!-- xstep=45, ystep=43 -->
583        <!-- "0" -->
584        <bezel element="pushbutton0" inputtag="ROW0" inputmask="0x01">
585            <bounds x="886" y="339" width="40" height="40"/>
586        </bezel>
587 
588        <!-- "1" -->
589        <bezel element="pushbutton1" inputtag="ROW0" inputmask="0x02">
590            <bounds x="886" y="296" width="40" height="40"/>
591        </bezel>
592 
593        <!-- "2" -->
594        <bezel element="pushbutton2" inputtag="ROW0" inputmask="0x04">
595            <bounds x="931" y="296" width="40" height="40"/>
596        </bezel>
597 
598        <!-- "3" -->
599        <bezel element="pushbutton3" inputtag="ROW0" inputmask="0x08">
600            <bounds x="976" y="296" width="40" height="40"/>
601        </bezel>
602 
603        <!-- "4" -->
604        <bezel element="pushbutton4" inputtag="ROW0" inputmask="0x10">
605            <bounds x="886" y="253" width="40" height="40"/>
606        </bezel>
607 
608        <!-- "5" -->
609        <bezel element="pushbutton5" inputtag="ROW0" inputmask="0x20">
610            <bounds x="931" y="253" width="40" height="40"/>
611        </bezel>
612 
613        <!-- "6" -->
614        <bezel element="pushbutton6" inputtag="ROW0" inputmask="0x40">
615            <bounds x="976" y="253" width="40" height="40"/>
616        </bezel>
617 
618        <!-- "7" -->
619        <bezel element="pushbutton7" inputtag="ROW0" inputmask="0x80">
620            <bounds x="886" y="210" width="40" height="40"/>
621        </bezel>
622 
623 
624 
625        <!-- Buttons -->
626        <!-- Row 1 :  8 9 A B C D E F -->
627        <!-- "8" -->
628        <bezel element="pushbutton8" inputtag="ROW1" inputmask="0x01">
629            <bounds x="931" y="210" width="40" height="40"/>
630        </bezel>
631 
632        <!-- "9" -->
633        <bezel element="pushbutton9" inputtag="ROW1" inputmask="0x02">
634            <bounds x="976" y="210" width="40" height="40"/>
635        </bezel>
636 
637        <!-- "A" -->
638        <bezel element="pushbuttonA" inputtag="ROW1" inputmask="0x04">
639            <bounds x="1021" y="210" width="40" height="40"/>
640        </bezel>
641 
642        <!-- "B" -->
643        <bezel element="pushbuttonB" inputtag="ROW1" inputmask="0x08">
644            <bounds x="1021" y="253" width="40" height="40"/>
645        </bezel>
646 
647        <!-- "C" -->
648        <bezel element="pushbuttonC" inputtag="ROW1" inputmask="0x10">
649            <bounds x="1021" y="296" width="40" height="40"/>
650        </bezel>
651 
652        <!-- "D" -->
653        <bezel element="pushbuttonD" inputtag="ROW1" inputmask="0x20">
654            <bounds x="1021" y="339" width="40" height="40"/>
655        </bezel>
656 
657        <!-- "E" -->
658        <bezel element="pushbuttonE" inputtag="ROW1" inputmask="0x40">
659            <bounds x="976" y="339" width="40" height="40"/>
660        </bezel>
661 
662        <!-- "F" -->
663        <bezel element="pushbuttonF" inputtag="ROW1" inputmask="0x80">
664            <bounds x="931" y="339" width="40" height="40"/>
665        </bezel>
666 
667    </view>
668 
669 
670</mamelayout>
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4
5<mamelayout version="2">
6
7    <element name="gray">
8        <rect>
9            <bounds left="0" top="0" right="1" bottom="1" />
10            <color red="0.15" green="0.15" blue="0.15" />
11        </rect>
12    </element>
13
14    <element name="digit_back">
15        <rect>
16            <bounds left="0" top="0" right="1" bottom="1" />
17            <color red="0.584" green="0.631" blue="0.690" />
18        </rect>
19    </element>
20
21    <element name="digit" defstate="0">
22        <led7seg>
23            <color red="0.75" green="0.0" blue="0.0"/>
24        </led7seg>
25    </element>
26
27    <element name="back">
28        <rect>
29            <bounds left="0" top="0" right="1" bottom="1" />
30            <color red="0.0" green="0.0" blue="0.0" />
31        </rect>
32    </element>
33
34    <element name="pushbutton" defstate="1">
35        <rect>
36            <bounds x="2" y="2" width="48" height="48"/>
37            <color red="0.1" green="0.1" blue="0.1" />
38        </rect>
39        <rect state="0">
40            <bounds x="0" y="0" width="48" height="48"/>
41            <color red="0.75" green="0.75" blue="0.0" />
42        </rect>
43        <rect state="1">
44            <bounds x="2" y="2" width="48" height="48"/>
45            <color red="0.75" green="0.75" blue="0.0" />
46        </rect>
47    </element>
48
49    <element name="pushbuttonCTRL" defstate="1">
50        <rect>
51            <bounds x="2" y="2" width="48" height="48"/>
52            <color red="0.1" green="0.1" blue="0.1" />
53        </rect>
54        <rect state="0">
55            <bounds x="0" y="0" width="48" height="48"/>
56            <color red="0.25" green="0.25" blue="0.25" />
57        </rect>
58        <text string="CTRL" state="0">
59            <bounds x="8" y="24" width="40" height="20"/>
60            <color red="1.0" green="1.0" blue="1.0" />
61        </text>
62        <rect state="1">
63            <bounds x="2" y="2" width="48" height="48"/>
64            <color red="0.25" green="0.25" blue="0.25" />
65        </rect>
66        <text string="CTRL" state="1">
67            <bounds x="10" y="26" width="40" height="20"/>
68            <color red="1.0" green="1.0" blue="1.0" />
69        </text>
70    </element>
71
72    <element name="pushbuttonRST" defstate="1">
73        <rect>
74            <bounds x="2" y="2" width="48" height="48"/>
75            <color red="0.1" green="0.1" blue="0.1" />
76        </rect>
77        <rect state="0">
78            <bounds x="0" y="0" width="48" height="48"/>
79            <color red="0.75" green="0" blue="0" />
80        </rect>
81        <text string="RST " state="0">
82            <bounds x="8" y="24" width="40" height="20"/>
83            <color red="1.0" green="1.0" blue="1.0" />
84        </text>
85        <rect state="1">
86            <bounds x="2" y="2" width="48" height="48"/>
87            <color red="0.75" green="0" blue="0" />
88        </rect>
89        <text string="RST " state="1">
90            <bounds x="10" y="26" width="40" height="20"/>
91            <color red="1.0" green="1.0" blue="1.0" />
92        </text>
93    </element>
94
95    <element name="pushbutton0" defstate="1">
96        <rect>
97            <bounds x="2" y="2" width="48" height="48"/>
98            <color red="0.1" green="0.1" blue="0.1" />
99        </rect>
100        <rect state="0">
101            <bounds x="0" y="0" width="48" height="48"/>
102            <color red="0.0" green="0.0" blue="0.75" />
103        </rect>
104        <text string="  0 " state="0">
105            <bounds x="8" y="24" width="40" height="20"/>
106            <color red="1.0" green="1.0" blue="1.0" />
107        </text>
108        <rect state="1">
109            <bounds x="2" y="2" width="48" height="48"/>
110            <color red="0.0" green="0.0" blue="0.75" />
111        </rect>
112        <text string="  0 " state="1">
113            <bounds x="10" y="26" width="40" height="20"/>
114            <color red="1.0" green="1.0" blue="1.0" />
115        </text>
116    </element>
117
118    <element name="pushbutton1" defstate="1">
119        <rect>
120            <bounds x="2" y="2" width="48" height="48"/>
121            <color red="0.1" green="0.1" blue="0.1" />
122        </rect>
123        <rect state="0">
124            <bounds x="0" y="0" width="48" height="48"/>
125            <color red="0.0" green="0.0" blue="0.75" />
126        </rect>
127        <text string="  1 " state="0">
128            <bounds x="8" y="24" width="40" height="20"/>
129            <color red="1.0" green="1.0" blue="1.0" />
130        </text>
131        <rect state="1">
132            <bounds x="2" y="2" width="48" height="48"/>
133            <color red="0.0" green="0.0" blue="0.75" />
134        </rect>
135        <text string="  1 " state="1">
136            <bounds x="10" y="26" width="40" height="20"/>
137            <color red="1.0" green="1.0" blue="1.0" />
138        </text>
139    </element>
140
141    <element name="pushbutton2" defstate="1">
142        <rect>
143            <bounds x="2" y="2" width="48" height="48"/>
144            <color red="0.1" green="0.1" blue="0.1" />
145        </rect>
146        <rect state="0">
147            <bounds x="0" y="0" width="48" height="48"/>
148            <color red="0.0" green="0.0" blue="0.75" />
149        </rect>
150        <text string="  2 " state="0">
151            <bounds x="8" y="24" width="40" height="20"/>
152            <color red="1.0" green="1.0" blue="1.0" />
153        </text>
154        <rect state="1">
155            <bounds x="2" y="2" width="48" height="48"/>
156            <color red="0.0" green="0.0" blue="0.75" />
157        </rect>
158        <text string="  2 " state="1">
159            <bounds x="10" y="26" width="40" height="20"/>
160            <color red="1.0" green="1.0" blue="1.0" />
161        </text>
162    </element>
163
164    <element name="pushbutton3" defstate="1">
165        <rect>
166            <bounds x="2" y="2" width="48" height="48"/>
167            <color red="0.1" green="0.1" blue="0.1" />
168        </rect>
169        <rect state="0">
170            <bounds x="0" y="0" width="48" height="48"/>
171            <color red="0.0" green="0.0" blue="0.75" />
172        </rect>
173        <text string="  3 " state="0">
174            <bounds x="8" y="24" width="40" height="20"/>
175            <color red="1.0" green="1.0" blue="1.0" />
176        </text>
177        <rect state="1">
178            <bounds x="2" y="2" width="48" height="48"/>
179            <color red="0.0" green="0.0" blue="0.75" />
180        </rect>
181        <text string="  3 " state="1">
182            <bounds x="10" y="26" width="40" height="20"/>
183            <color red="1.0" green="1.0" blue="1.0" />
184        </text>
185    </element>
186
187    <element name="pushbutton4" defstate="1">
188        <rect>
189            <bounds x="2" y="2" width="48" height="48"/>
190            <color red="0.1" green="0.1" blue="0.1" />
191        </rect>
192        <rect state="0">
193            <bounds x="0" y="0" width="48" height="48"/>
194            <color red="0.0" green="0.0" blue="0.75" />
195        </rect>
196        <text string="  4 " state="0">
197            <bounds x="8" y="24" width="40" height="20"/>
198            <color red="1.0" green="1.0" blue="1.0" />
199        </text>
200        <rect state="1">
201            <bounds x="2" y="2" width="48" height="48"/>
202            <color red="0.0" green="0.0" blue="0.75" />
203        </rect>
204        <text string="  4 " state="1">
205            <bounds x="10" y="26" width="40" height="20"/>
206            <color red="1.0" green="1.0" blue="1.0" />
207        </text>
208    </element>
209
210    <element name="pushbutton5" defstate="1">
211        <rect>
212            <bounds x="2" y="2" width="48" height="48"/>
213            <color red="0.1" green="0.1" blue="0.1" />
214        </rect>
215        <rect state="0">
216            <bounds x="0" y="0" width="48" height="48"/>
217            <color red="0.0" green="0.0" blue="0.75" />
218        </rect>
219        <text string="  5 " state="0">
220            <bounds x="8" y="24" width="40" height="20"/>
221            <color red="1.0" green="1.0" blue="1.0" />
222        </text>
223        <rect state="1">
224            <bounds x="2" y="2" width="48" height="48"/>
225            <color red="0.0" green="0.0" blue="0.75" />
226        </rect>
227        <text string="  5 " state="1">
228            <bounds x="10" y="26" width="40" height="20"/>
229            <color red="1.0" green="1.0" blue="1.0" />
230        </text>
231    </element>
232
233    <element name="pushbutton6" defstate="1">
234        <rect>
235            <bounds x="2" y="2" width="48" height="48"/>
236            <color red="0.1" green="0.1" blue="0.1" />
237        </rect>
238        <rect state="0">
239            <bounds x="0" y="0" width="48" height="48"/>
240            <color red="0.0" green="0.0" blue="0.75" />
241        </rect>
242        <text string="  6 " state="0">
243            <bounds x="8" y="24" width="40" height="20"/>
244            <color red="1.0" green="1.0" blue="1.0" />
245        </text>
246        <rect state="1">
247            <bounds x="2" y="2" width="48" height="48"/>
248            <color red="0.0" green="0.0" blue="0.75" />
249        </rect>
250        <text string="  6 " state="1">
251            <bounds x="10" y="26" width="40" height="20"/>
252            <color red="1.0" green="1.0" blue="1.0" />
253        </text>
254    </element>
255
256    <element name="pushbutton7" defstate="1">
257        <rect>
258            <bounds x="2" y="2" width="48" height="48"/>
259            <color red="0.1" green="0.1" blue="0.1" />
260        </rect>
261        <rect state="0">
262            <bounds x="0" y="0" width="48" height="48"/>
263            <color red="0.0" green="0.0" blue="0.75" />
264        </rect>
265        <text string="  7 " state="0">
266            <bounds x="8" y="24" width="40" height="20"/>
267            <color red="1.0" green="1.0" blue="1.0" />
268        </text>
269        <rect state="1">
270            <bounds x="2" y="2" width="48" height="48"/>
271            <color red="0.0" green="0.0" blue="0.75" />
272        </rect>
273        <text string="  7 " state="1">
274            <bounds x="10" y="26" width="40" height="20"/>
275            <color red="1.0" green="1.0" blue="1.0" />
276        </text>
277    </element>
278
279    <element name="pushbutton8" defstate="1">
280        <rect>
281            <bounds x="2" y="2" width="48" height="48"/>
282            <color red="0.1" green="0.1" blue="0.1" />
283        </rect>
284        <rect state="0">
285            <bounds x="0" y="0" width="48" height="48"/>
286            <color red="0.0" green="0.0" blue="0.75" />
287        </rect>
288        <text string="  8 " state="0">
289            <bounds x="8" y="24" width="40" height="20"/>
290            <color red="1.0" green="1.0" blue="1.0" />
291        </text>
292        <rect state="1">
293            <bounds x="2" y="2" width="48" height="48"/>
294            <color red="0.0" green="0.0" blue="0.75" />
295        </rect>
296        <text string="  8 " state="1">
297            <bounds x="10" y="26" width="40" height="20"/>
298            <color red="1.0" green="1.0" blue="1.0" />
299        </text>
300    </element>
301
302    <element name="pushbutton9" defstate="1">
303        <rect>
304            <bounds x="2" y="2" width="48" height="48"/>
305            <color red="0.1" green="0.1" blue="0.1" />
306        </rect>
307        <rect state="0">
308            <bounds x="0" y="0" width="48" height="48"/>
309            <color red="0.0" green="0.0" blue="0.75" />
310        </rect>
311        <text string="  9 " state="0">
312            <bounds x="8" y="24" width="40" height="20"/>
313            <color red="1.0" green="1.0" blue="1.0" />
314        </text>
315        <rect state="1">
316            <bounds x="2" y="2" width="48" height="48"/>
317            <color red="0.0" green="0.0" blue="0.75" />
318        </rect>
319        <text string="  9 " state="1">
320            <bounds x="10" y="26" width="40" height="20"/>
321            <color red="1.0" green="1.0" blue="1.0" />
322        </text>
323    </element>
324
325    <element name="pushbuttonA" defstate="1">
326        <rect>
327            <bounds x="2" y="2" width="48" height="48"/>
328            <color red="0.1" green="0.1" blue="0.1" />
329        </rect>
330        <rect state="0">
331            <bounds x="0" y="0" width="48" height="48"/>
332            <color red="0.0" green="0.0" blue="0.75" />
333        </rect>
334        <text string="  A " state="0">
335            <bounds x="8" y="24" width="40" height="20"/>
336            <color red="1.0" green="1.0" blue="1.0" />
337        </text>
338        <rect state="1">
339            <bounds x="2" y="2" width="48" height="48"/>
340            <color red="0.0" green="0.0" blue="0.75" />
341        </rect>
342        <text string="  A " state="1">
343            <bounds x="10" y="26" width="40" height="20"/>
344            <color red="1.0" green="1.0" blue="1.0" />
345        </text>
346    </element>
347
348    <element name="pushbuttonB" defstate="1">
349        <rect>
350            <bounds x="2" y="2" width="48" height="48"/>
351            <color red="0.1" green="0.1" blue="0.1" />
352        </rect>
353        <rect state="0">
354            <bounds x="0" y="0" width="48" height="48"/>
355            <color red="0.0" green="0.0" blue="0.75" />
356        </rect>
357        <text string="  B " state="0">
358            <bounds x="8" y="24" width="40" height="20"/>
359            <color red="1.0" green="1.0" blue="1.0" />
360        </text>
361        <rect state="1">
362            <bounds x="2" y="2" width="48" height="48"/>
363            <color red="0.0" green="0.0" blue="0.75" />
364        </rect>
365        <text string="  B " state="1">
366            <bounds x="10" y="26" width="40" height="20"/>
367            <color red="1.0" green="1.0" blue="1.0" />
368        </text>
369    </element>
370
371    <element name="pushbuttonC" defstate="1">
372        <rect>
373            <bounds x="2" y="2" width="48" height="48"/>
374            <color red="0.1" green="0.1" blue="0.1" />
375        </rect>
376        <rect state="0">
377            <bounds x="0" y="0" width="48" height="48"/>
378            <color red="0.0" green="0.0" blue="0.75" />
379        </rect>
380        <text string="  C " state="0">
381            <bounds x="8" y="24" width="40" height="20"/>
382            <color red="1.0" green="1.0" blue="1.0" />
383        </text>
384        <rect state="1">
385            <bounds x="2" y="2" width="48" height="48"/>
386            <color red="0.0" green="0.0" blue="0.75" />
387        </rect>
388        <text string="  C " state="1">
389            <bounds x="10" y="26" width="40" height="20"/>
390            <color red="1.0" green="1.0" blue="1.0" />
391        </text>
392    </element>
393
394    <element name="pushbuttonD" defstate="1">
395        <rect>
396            <bounds x="2" y="2" width="48" height="48"/>
397            <color red="0.1" green="0.1" blue="0.1" />
398        </rect>
399        <rect state="0">
400            <bounds x="0" y="0" width="48" height="48"/>
401            <color red="0.0" green="0.0" blue="0.75" />
402        </rect>
403        <text string="  D " state="0">
404            <bounds x="8" y="24" width="40" height="20"/>
405            <color red="1.0" green="1.0" blue="1.0" />
406        </text>
407        <rect state="1">
408            <bounds x="2" y="2" width="48" height="48"/>
409            <color red="0.0" green="0.0" blue="0.75" />
410        </rect>
411        <text string="  D " state="1">
412            <bounds x="10" y="26" width="40" height="20"/>
413            <color red="1.0" green="1.0" blue="1.0" />
414        </text>
415    </element>
416
417    <element name="pushbuttonE" defstate="1">
418        <rect>
419            <bounds x="2" y="2" width="48" height="48"/>
420            <color red="0.1" green="0.1" blue="0.1" />
421        </rect>
422        <rect state="0">
423            <bounds x="0" y="0" width="48" height="48"/>
424            <color red="0.0" green="0.0" blue="0.75" />
425        </rect>
426        <text string="  E " state="0">
427            <bounds x="8" y="24" width="40" height="20"/>
428            <color red="1.0" green="1.0" blue="1.0" />
429        </text>
430        <rect state="1">
431            <bounds x="2" y="2" width="48" height="48"/>
432            <color red="0.0" green="0.0" blue="0.75" />
433        </rect>
434        <text string="  E " state="1">
435            <bounds x="10" y="26" width="40" height="20"/>
436            <color red="1.0" green="1.0" blue="1.0" />
437        </text>
438    </element>
439
440    <element name="pushbuttonF" defstate="1">
441        <rect>
442            <bounds x="2" y="2" width="48" height="48"/>
443            <color red="0.1" green="0.1" blue="0.1" />
444        </rect>
445        <rect state="0">
446            <bounds x="0" y="0" width="48" height="48"/>
447            <color red="0.0" green="0.0" blue="0.75" />
448        </rect>
449        <text string="  F " state="0">
450            <bounds x="8" y="24" width="40" height="20"/>
451            <color red="1.0" green="1.0" blue="1.0" />
452        </text>
453        <rect state="1">
454            <bounds x="2" y="2" width="48" height="48"/>
455            <color red="0.0" green="0.0" blue="0.75" />
456        </rect>
457        <text string="  F " state="1">
458            <bounds x="10" y="26" width="40" height="20"/>
459            <color red="1.0" green="1.0" blue="1.0" />
460        </text>
461    </element>
462
463    <element name="flatbackground">
464        <rect>
465            <bounds left="-10" top="-10" right="587" bottom="813" />
466            <color red="0.1" green="0.1" blue="0.1" />
467        </rect>
468        <rect>
469            <bounds left="5" top="5" right="577" bottom="803" />
470            <color red="0.1" green="0.2" blue="0.1" />
471        </rect>
472        <rect>
473            <bounds left="0" top="0" right="572" bottom="798" />
474            <color red="0.1" green="0.3" blue="0.1" />
475        </rect>
476    </element>
477
478    <element name="LX.384">
479        <text string="LX.384">
480            <bounds x="0" y="0" width="120" height="40"/>
481            <color red="1.0" green="1.0" blue="1.0" />
482        </text>
483    </element>
484
485    <element name="LX.388">
486        <text string="LX.388">
487            <bounds x="0" y="0" width="120" height="40"/>
488            <color red="1.0" green="1.0" blue="1.0" />
489        </text>
490    </element>
491
492    <view name="Standard">
493        <backdrop element="flatbackground">
494            <bounds x="0" y="20" width="1175" height="590" />
495        </backdrop>
496
497        <backdrop element="gray">
498            <bounds x="65" y="74" width="640" height="480" />
499        </backdrop>
500
501        <bezel element="LX.388">
502            <bounds x="67" y="80" width="90" height="30" />
503        </bezel>
504
505        <screen index="0">
506            <bounds x="65" y="74" width="640" height="480" />
507        </screen>
508
509        <backdrop element="gray">
510            <bounds x="724" y="74" width="375" height="480" />
511        </backdrop>
512
513        <bezel element="LX.384">
514            <bounds x="726" y="80" width="90" height="30" />
515        </bezel>
516
517        <!-- LEDs -->
518        <!-- LEDs --> <!-- x step = 40 -->
519        <bezel element="digit_back">
520            <bounds x="740" y="119" width="36" height="52" />
521        </bezel>
522        <bezel element="digit_back">
523            <bounds x="784" y="119" width="36" height="52" />
524        </bezel>
525        <bezel element="digit_back">
526            <bounds x="828" y="119" width="36" height="52" />
527        </bezel>
528        <bezel element="digit_back">
529            <bounds x="872" y="119" width="36" height="52" />
530        </bezel>
531        <bezel element="digit_back">
532            <bounds x="916" y="119" width="36" height="52" />
533        </bezel>
534        <bezel element="digit_back">
535            <bounds x="960" y="119" width="36" height="52" />
536        </bezel>
537        <bezel element="digit_back">
538            <bounds x="1004" y="119" width="36" height="52" />
539        </bezel>
540        <bezel element="digit_back">
541            <bounds x="1048" y="119" width="36" height="52" />
542        </bezel>
543        <bezel name="digit7" element="digit">
544            <bounds x="743" y="126" width="30" height="40" />
545        </bezel>
546        <bezel name="digit6" element="digit">
547            <bounds x="787" y="126" width="30" height="40" />
548        </bezel>
549        <bezel name="digit5" element="digit">
550            <bounds x="831" y="126" width="30" height="40" />
551        </bezel>
552        <bezel name="digit4" element="digit">
553            <bounds x="875" y="126" width="30" height="40" />
554        </bezel>
555        <bezel name="digit3" element="digit">
556            <bounds x="919" y="126" width="30" height="40" />
557        </bezel>
558        <bezel name="digit2" element="digit">
559            <bounds x="963" y="126" width="30" height="40" />
560        </bezel>
561        <bezel name="digit1" element="digit">
562            <bounds x="1007" y="126" width="30" height="40" />
563        </bezel>
564        <bezel name="digit0" element="digit">
565            <bounds x="1051" y="126" width="30" height="40" />
566        </bezel>
567
568
569        <!-- Buttons -->
570
571        <!-- "Control" -->
572        <bezel element="pushbuttonCTRL" inputtag="CTRL" inputmask="0x10">
573            <bounds x="765" y="338" width="40" height="40"/>
574        </bezel>
575
576        <!-- "Reset" -->
577        <bezel element="pushbuttonRST" inputtag="RST" inputmask="0x01">
578            <bounds x="765" y="210" width="40" height="40"/>
579        </bezel>
580
581
582        <!-- Row 0 :  0 1 2 3 4 5 6 7 --> <!-- xstep=45, ystep=43 -->
583        <!-- "0" -->
584        <bezel element="pushbutton0" inputtag="ROW0" inputmask="0x01">
585            <bounds x="886" y="339" width="40" height="40"/>
586        </bezel>
587
588        <!-- "1" -->
589        <bezel element="pushbutton1" inputtag="ROW0" inputmask="0x02">
590            <bounds x="886" y="296" width="40" height="40"/>
591        </bezel>
592
593        <!-- "2" -->
594        <bezel element="pushbutton2" inputtag="ROW0" inputmask="0x04">
595            <bounds x="931" y="296" width="40" height="40"/>
596        </bezel>
597
598        <!-- "3" -->
599        <bezel element="pushbutton3" inputtag="ROW0" inputmask="0x08">
600            <bounds x="976" y="296" width="40" height="40"/>
601        </bezel>
602
603        <!-- "4" -->
604        <bezel element="pushbutton4" inputtag="ROW0" inputmask="0x10">
605            <bounds x="886" y="253" width="40" height="40"/>
606        </bezel>
607
608        <!-- "5" -->
609        <bezel element="pushbutton5" inputtag="ROW0" inputmask="0x20">
610            <bounds x="931" y="253" width="40" height="40"/>
611        </bezel>
612
613        <!-- "6" -->
614        <bezel element="pushbutton6" inputtag="ROW0" inputmask="0x40">
615            <bounds x="976" y="253" width="40" height="40"/>
616        </bezel>
617
618        <!-- "7" -->
619        <bezel element="pushbutton7" inputtag="ROW0" inputmask="0x80">
620            <bounds x="886" y="210" width="40" height="40"/>
621        </bezel>
622
623
624
625        <!-- Buttons -->
626        <!-- Row 1 :  8 9 A B C D E F -->
627        <!-- "8" -->
628        <bezel element="pushbutton8" inputtag="ROW1" inputmask="0x01">
629            <bounds x="931" y="210" width="40" height="40"/>
630        </bezel>
631
632        <!-- "9" -->
633        <bezel element="pushbutton9" inputtag="ROW1" inputmask="0x02">
634            <bounds x="976" y="210" width="40" height="40"/>
635        </bezel>
636
637        <!-- "A" -->
638        <bezel element="pushbuttonA" inputtag="ROW1" inputmask="0x04">
639            <bounds x="1021" y="210" width="40" height="40"/>
640        </bezel>
641
642        <!-- "B" -->
643        <bezel element="pushbuttonB" inputtag="ROW1" inputmask="0x08">
644            <bounds x="1021" y="253" width="40" height="40"/>
645        </bezel>
646
647        <!-- "C" -->
648        <bezel element="pushbuttonC" inputtag="ROW1" inputmask="0x10">
649            <bounds x="1021" y="296" width="40" height="40"/>
650        </bezel>
651
652        <!-- "D" -->
653        <bezel element="pushbuttonD" inputtag="ROW1" inputmask="0x20">
654            <bounds x="1021" y="339" width="40" height="40"/>
655        </bezel>
656
657        <!-- "E" -->
658        <bezel element="pushbuttonE" inputtag="ROW1" inputmask="0x40">
659            <bounds x="976" y="339" width="40" height="40"/>
660        </bezel>
661
662        <!-- "F" -->
663        <bezel element="pushbuttonF" inputtag="ROW1" inputmask="0x80">
664            <bounds x="931" y="339" width="40" height="40"/>
665        </bezel>
666
667    </view>
668
669
670</mamelayout>
src/mess/layout/z80netb.lay
r4517r4518
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4 
5<mamelayout version="2">
6 
7    <element name="gray">
8        <rect>
9            <bounds left="0" top="0" right="1" bottom="1" />
10            <color red="0.15" green="0.15" blue="0.15" />
11        </rect> 
12    </element>
13 
14    <element name="back">
15        <rect>
16            <bounds left="0" top="0" right="1" bottom="1" />
17            <color red="0.0" green="0.0" blue="0.0" />
18        </rect> 
19    </element>
20 
21    <element name="flatbackground">
22        <rect>
23            <bounds left="-10" top="-10" right="587" bottom="813" />
24            <color red="0.1" green="0.1" blue="0.1" />
25        </rect>
26        <rect>
27            <bounds left="5" top="5" right="577" bottom="803" />
28            <color red="0.1" green="0.2" blue="0.1" />
29        </rect>
30        <rect>
31            <bounds left="0" top="0" right="572" bottom="798" />
32            <color red="0.1" green="0.3" blue="0.1" />
33        </rect>
34    </element>
35 
36    <element name="LX.388">
37        <text string="LX.388">
38            <bounds x="0" y="0" width="120" height="40"/>
39            <color red="1.0" green="1.0" blue="1.0" />
40        </text>
41    </element>
42 
43    <view name="Standard">
44        <backdrop element="gray">
45            <bounds x="65" y="74" width="640" height="480" />
46        </backdrop>
47 
48        <bezel element="LX.388">
49            <bounds x="67" y="80" width="90" height="30" />
50        </bezel>
51 
52        <screen index="0">
53            <bounds x="65" y="74" width="640" height="480" />
54        </screen>
55 
56    </view>
57 
58 
59</mamelayout>
1<?xml version="1.0"?>
2<!-- z80ne.lay -->
3<!-- 2009-01-16: Initial version.  [Roberto Lavarone] -->
4
5<mamelayout version="2">
6
7    <element name="gray">
8        <rect>
9            <bounds left="0" top="0" right="1" bottom="1" />
10            <color red="0.15" green="0.15" blue="0.15" />
11        </rect>
12    </element>
13
14    <element name="back">
15        <rect>
16            <bounds left="0" top="0" right="1" bottom="1" />
17            <color red="0.0" green="0.0" blue="0.0" />
18        </rect>
19    </element>
20
21    <element name="flatbackground">
22        <rect>
23            <bounds left="-10" top="-10" right="587" bottom="813" />
24            <color red="0.1" green="0.1" blue="0.1" />
25        </rect>
26        <rect>
27            <bounds left="5" top="5" right="577" bottom="803" />
28            <color red="0.1" green="0.2" blue="0.1" />
29        </rect>
30        <rect>
31            <bounds left="0" top="0" right="572" bottom="798" />
32            <color red="0.1" green="0.3" blue="0.1" />
33        </rect>
34    </element>
35
36    <element name="LX.388">
37        <text string="LX.388">
38            <bounds x="0" y="0" width="120" height="40"/>
39            <color red="1.0" green="1.0" blue="1.0" />
40        </text>
41    </element>
42
43    <view name="Standard">
44        <backdrop element="gray">
45            <bounds x="65" y="74" width="640" height="480" />
46        </backdrop>
47
48        <bezel element="LX.388">
49            <bounds x="67" y="80" width="90" height="30" />
50        </bezel>
51
52        <screen index="0">
53            <bounds x="65" y="74" width="640" height="480" />
54        </screen>
55
56    </view>
57
58
59</mamelayout>
src/mess/drivers/kaypro2.c
r4517r4518
1/*************************************************************************************************
2 
3 
4   Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives.
5   Each disk was single sided, and could hold 191k. The computer had 2x pio
6   and 1x sio. One of the sio ports communicated with the keyboard with a coiled
7   telephone cord, complete with modular plug on each end. The keyboard carries
8   its own Intel 8748 processor and is an intelligent device.
9 
10   There are 2 major problems preventing this driver from working
11 
12   - MESS is not capable of conducting realtime serial communications between devices
13 
14   - MAME's z80sio implementation is lacking important deatures:
15   -- cannot change baud rate on the fly
16   -- cannot specify different rates for each channel
17   -- cannot specify different rates for Receive and Transmit
18   -- the callback doesn't appear to support channel B ??
19 
20 
21   Things that need doing:
22   - Floppy disks (I have no knowledge of how to set these up)
23   - Split this code to video, machine
24   - Add clones
25 
26 
27**************************************************************************************************/
28 
29 
30#include "driver.h"
31#include "cpu/z80/z80.h"
32#include "cpu/z80/z80daisy.h"
33#include "machine/z80pio.h"
34#include "machine/z80sio.h"
35#include "machine/ctronics.h"
36#include "machine/kay_kbd.h"
37#include "machine/wd17xx.h"
38#include "devices/basicdsk.h"
39#include "sound/beep.h"
40 
41 
42static const device_config *kaypro2_z80pio_g;
43static const device_config *kaypro2_z80pio_s;
44static const device_config *kaypro2_z80sio;
45static const device_config *kaypro2_printer;
46static const device_config *kaypro2_fdc;
47 
48 
49 
50/***********************************************************
51 
52   Video
53 
54************************************************************/
55 
56static PALETTE_INIT( kaypro2 )
57{
58   palette_set_color(machine,0,RGB_BLACK); /* black */
59   palette_set_color(machine,1,MAKE_RGB(0, 220, 0)); /* green */   
60}
61 
62static VIDEO_UPDATE( kaypro2 )
63{
64/* The display consists of 80 columns and 24 rows. Each row is allocated 128 bytes of ram,
65   but only the first 80 are used. The total video ram therefore is 0x0c00 bytes.
66   There is one video attribute: bit 7 causes blinking. The first half of the
67   character generator is blank, with the visible characters in the 2nd half.
68   During the "off" period of blanking, the first half is used. Only 5 pixels are
69   connected from the rom to the shift register, the remaining pixels are held high.
70   A high pixel is black and a low pixel is green. */
71 
72   static UINT8 framecnt=0;
73   UINT8 y,ra,chr,gfx;
74   UINT16 sy=0,ma=0,x;
75   UINT8 *FNT = memory_region(screen->machine, "gfx1");
76 
77   framecnt++;
78 
79   for (y = 0; y < 24; y++)
80   {
81      for (ra = 0; ra < 10; ra++)
82      {
83         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
84 
85         for (x = ma; x < ma + 80; x++)
86         {
87            if (ra < 8)
88            {
89               chr = videoram[x]^0x80;
90 
91               /* Take care of flashing characters */
92               if ((chr < 0x80) && (framecnt & 0x08))
93                  chr |= 0x80;
94 
95               /* get pattern of pixels for that character scanline */
96               gfx = FNT[(chr<<3) | ra ];
97            }
98            else
99               gfx = 0xff;
100 
101            /* Display a scanline of a character (7 pixels) */
102            *p = 0; p++;
103            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
104            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
105            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
106            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
107            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
108            *p = 0; p++;
109         }
110      }
111      ma+=128;
112   }
113   return 0;
114}
115 
116static VIDEO_UPDATE( omni2 )
117{
118   static UINT8 framecnt=0;
119   UINT8 y,ra,chr,gfx;
120   UINT16 sy=0,ma=0,x;
121   UINT8 *FNT = memory_region(screen->machine, "gfx1");
122 
123   framecnt++;
124 
125   for (y = 0; y < 24; y++)
126   {
127      for (ra = 0; ra < 10; ra++)
128      {
129         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
130 
131         for (x = ma; x < ma + 80; x++)
132         {
133            if (ra < 8)
134            {
135               chr = videoram[x];
136 
137               /* Take care of flashing characters */
138               if ((chr > 0x7f) && (framecnt & 0x08))
139                  chr |= 0x80;
140 
141               /* get pattern of pixels for that character scanline */
142               gfx = FNT[(chr<<3) | ra ];
143            }
144            else
145               gfx = 0xff;
146 
147            /* Display a scanline of a character (7 pixels) */
148            *p = ( gfx & 0x40 ) ? 0 : 1; p++;
149            *p = ( gfx & 0x20 ) ? 0 : 1; p++;
150            *p = ( gfx & 0x10 ) ? 0 : 1; p++;
151            *p = ( gfx & 0x08 ) ? 0 : 1; p++;
152            *p = ( gfx & 0x04 ) ? 0 : 1; p++;
153            *p = ( gfx & 0x02 ) ? 0 : 1; p++;
154            *p = ( gfx & 0x01 ) ? 0 : 1; p++;
155         }
156      }
157      ma+=128;
158   }
159   return 0;
160}
161 
162static READ8_HANDLER( kaypro2_videoram_r )
163{
164   return videoram[offset];
165}
166 
167static WRITE8_HANDLER( kaypro2_videoram_w )
168{
169   videoram[offset] = data;
170}
171 
172 
173/***********************************************************
174 
175   PIO
176 
177   It seems there must have been a bulk-purchase
178   special on pios - port B is unused on both of them
179 
180************************************************************/
181 
182static WRITE8_DEVICE_HANDLER( kaypro2_interrupt )
183{
184   cpu_set_input_line(device->machine->cpu[0], 0, data);
185}
186 
187static READ8_DEVICE_HANDLER( pio_system_r )
188{
189/*   d3 Centronics ready flag */
190 
191   return ~centronics_busy_r(kaypro2_printer) << 3;
192}
193 
194static WRITE8_DEVICE_HANDLER( pio_system_w )
195{
196/*   d7 bank select
197   d6 disk drive motors - not emulated
198   d5 double-density enable
199   d4 Centronics strobe
200   d1 drive B
201   d0 drive A */
202 
203   /* get address space */
204   const address_space *mem = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
205 
206   if (data & 0x80)
207   {
208      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
209      memory_install_read8_handler (mem, 0x0000, 0x0fff, 0, 0, SMH_BANK1);
210      memory_set_bankptr(mem->machine, 1, memory_region(mem->machine, "maincpu"));
211      memory_install_readwrite8_handler (mem, 0x3000, 0x3fff, 0, 0, kaypro2_videoram_r, kaypro2_videoram_w);
212   }
213   else
214   {
215      memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
216       memory_install_readwrite8_handler (mem, 0x0000, 0x3fff, 0, 0, SMH_BANK2, SMH_BANK3);
217      memory_set_bankptr(mem->machine, 2, memory_region(mem->machine, "rambank"));
218      memory_set_bankptr(mem->machine, 3, memory_region(mem->machine, "rambank"));
219   }
220 
221   wd17xx_set_density(kaypro2_fdc, (data & 0x20) ? 1 : 0);
222 
223   centronics_strobe_w(kaypro2_printer, BIT(data, 4));
224 
225   if (data & 1)
226      wd17xx_set_drive(kaypro2_fdc, 0);
227   else
228   if (data & 2)
229      wd17xx_set_drive(kaypro2_fdc, 1);
230 
231   if (data & 3)
232      wd17xx_set_side(kaypro2_fdc, 0);   /* only has 1 side */
233}
234 
235static const z80pio_interface kaypro2_pio_g_intf =
236{
237   DEVCB_HANDLER(kaypro2_interrupt),
238   DEVCB_NULL,
239   DEVCB_NULL,
240   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w),
241   DEVCB_NULL,
242   DEVCB_NULL,         /* portA ready active callback */
243   DEVCB_NULL         /* portB ready active callback */
244};
245 
246static const z80pio_interface kaypro2_pio_s_intf =
247{
248   DEVCB_HANDLER(kaypro2_interrupt),
249   DEVCB_HANDLER(pio_system_r),   /* read printer status */
250   DEVCB_NULL,
251   DEVCB_HANDLER(pio_system_w),   /* activate various internal devices */
252   DEVCB_NULL,
253   DEVCB_NULL,         /* portA ready active callback */
254   DEVCB_NULL         /* portB ready active callback */
255};
256 
257static READ8_DEVICE_HANDLER( kaypro2_pio_r )
258{
259   if (!offset)
260      return z80pio_d_r(device, 0);
261   else
262   if (offset == 1)
263      return z80pio_c_r(device, 0);
264   else
265   if (offset == 2)
266      return z80pio_d_r(device, 1);
267   else
268      return z80pio_c_r(device, 1);
269}
270       
271static WRITE8_DEVICE_HANDLER( kaypro2_pio_w )
272{
273   if (!offset)
274      z80pio_d_w(device, 0, data);
275   else
276   if (offset == 1)
277      z80pio_c_w(device, 0, data);
278   else
279   if (offset == 2)
280      z80pio_d_w(device, 1, data);
281   else
282      z80pio_c_w(device, 1, data);
283}
284 
285 
286/***********************************************************
287 
288   SIO
289   Baud rate setup commented out until MAME includes
290   the feature.
291 
292************************************************************/
293 
294/* Set baud rate. bits 0..3 Rx and Tx are tied together. Baud Rate Generator is a AY-5-8116, SMC8116, etc.
295   00h    50   
296   11h    75   
297   22h    110   
298   33h    134.5   
299   44h    150   
300   55h    300   
301   66h    600   
302   77h    1200   
303   88h    1800   
304   99h    2000   
305   AAh    2400   
306   BBh    3600   
307   CCh    4800   
308   DDh    7200   
309   EEh    9600   
310   FFh    19200 */
311 
312static const int baud_clock[]={ 800, 1200, 1760, 2152, 2400, 4800, 9600, 19200, 28800, 32000, 38400, 57600, 76800, 115200, 153600, 307200 };
313 
314static WRITE8_HANDLER( kaypro2_baud_a_w )   /* channel A - RS232C */
315{
316   data &= 0x0f;
317 
318//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 0);
319//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 0);
320}
321 
322static WRITE8_HANDLER( kaypro2_baud_b_w )   /* Channel B - Keyboard */
323{
324/* Only speed used is 300 baud */
325 
326   data &= 0x0f;
327 
328//   z80sio_set_rx_clock( kaypro2_z80sio, baud_clock[data], 1);
329//   z80sio_set_tx_clock( kaypro2_z80sio, baud_clock[data], 1);
330}
331 
332/* when sio devcb'ed like pio is, change to use pio's int handler */
333static void kaypro2_int_sio(const device_config *device, int state)
334{
335   cpu_set_input_line(device->machine->cpu[0], 0, state);
336}
337 
338static const z80sio_interface kaypro2_sio_intf =
339{
340   kaypro2_int_sio,   /* interrupt handler */
341   0,         /* DTR changed handler */
342   0,         /* RTS changed handler */
343   0,         /* BREAK changed handler */
344   0,         /* transmit handler - which channel is this for? */
345   0         /* receive handler - which channel is this for? */
346};
347 
348static const z80_daisy_chain kaypro2_daisy_chain[] =
349{
350/* Which order are these supposed to be in? assumed highest priority at the top */
351   { "z80sio" },      /* sio */
352   { "z80pio_s" },      /* System pio */
353   { "z80pio_g" },      /* General purpose pio */
354   { NULL }
355};
356 
357static READ8_DEVICE_HANDLER( kaypro2_sio_r )
358{
359   if (!offset)
360      return z80sio_d_r(device, 0);
361   else
362   if (offset == 1)
363//      return z80sio_d_r(device, 1);
364      return kay_kbd_d_r();
365   else
366   if (offset == 2)
367      return z80sio_c_r(device, 0);
368   else
369//      return z80sio_c_r(device, 1);
370      return kay_kbd_c_r();
371}
372       
373static WRITE8_DEVICE_HANDLER( kaypro2_sio_w )
374{
375   if (!offset)
376      z80sio_d_w(device, 0, data);
377   else
378   if (offset == 1)
379//      z80sio_d_w(device, 1, data);
380      kay_kbd_d_w(device->machine, data);
381   else
382   if (offset == 2)
383      z80sio_c_w(device, 0, data);
384   else
385      z80sio_c_w(device, 1, data);
386}
387 
388 
389/***********************************************************
390 
391   Floppy DIsk
392 
393   If there is no diskette in the drive, the cpu will
394   HALT, until the fdc does a NMI. NMI is deactivated
395   otherwise.
396 
397************************************************************/
398 
399static WD17XX_CALLBACK( kaypro2_fdc_callback )
400{
401   switch (state)
402   {
403      case WD17XX_DRQ_CLR:
404      case WD17XX_IRQ_CLR:
405         cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, 0);
406         break;
407      case WD17XX_DRQ_SET:
408      case WD17XX_IRQ_SET:
409         if (cpu_get_reg(device->machine->cpu[0], Z80_HALT))
410            cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
411         break;
412   }
413}
414 
415static const wd17xx_interface kaypro2_wd1793_interface = { kaypro2_fdc_callback, NULL };
416 
417/* I have no idea how to set up floppies - these ones have 40 tracks, 40 sectors, 128 bytes per track, single sided */
418 
419static void kaypro2_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
420{
421   /* floppy */
422   switch(state)
423   {
424      /* --- the following bits of info are returned as 64-bit signed integers --- */
425      case MESS_DEVINFO_INT_COUNT:         info->i = 2; break;
426 
427      /* --- the following bits of info are returned as pointers to data or functions --- */
428//      case MESS_DEVINFO_PTR_LOAD:         info->load = DEVICE_IMAGE_LOAD_NAME(kaypro2_floppy); break;
429 
430      /* --- the following bits of info are returned as NULL-terminated strings --- */
431      case MESS_DEVINFO_STR_FILE_EXTENSIONS:      strcpy(info->s = device_temp_str(), "dsk"); break;
432 
433      default:               legacybasicdsk_device_getinfo(devclass, state, info); break;
434   }
435}
436 
437 
438/***********************************************************
439 
440   Address Maps
441 
442************************************************************/
443 
444static ADDRESS_MAP_START( kaypro2_map, ADDRESS_SPACE_PROGRAM, 8 )
445   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0x0000)
446   AM_RANGE(0x3000, 0x3fff) AM_RAM AM_REGION("maincpu", 0x3000) AM_BASE(&videoram) AM_SIZE(&videoram_size)
447   AM_RANGE(0x4000, 0xffff) AM_RAM AM_REGION("rambank", 0x4000)
448ADDRESS_MAP_END
449 
450static ADDRESS_MAP_START( kaypro2_io, ADDRESS_SPACE_IO, 8 )
451   ADDRESS_MAP_GLOBAL_MASK(0xff)
452   ADDRESS_MAP_UNMAP_HIGH
453   AM_RANGE(0x00, 0x03) AM_WRITE(kaypro2_baud_a_w)
454   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80sio", kaypro2_sio_r, kaypro2_sio_w)
455   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", kaypro2_pio_r, kaypro2_pio_w)
456   AM_RANGE(0x0c, 0x0f) AM_WRITE(kaypro2_baud_b_w)
457   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("wd1793", wd17xx_status_r, wd17xx_command_w)
458   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("wd1793", wd17xx_track_r, wd17xx_track_w)
459   AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("wd1793", wd17xx_sector_r, wd17xx_sector_w)
460   AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("wd1793", wd17xx_data_r, wd17xx_data_w)
461   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_s", kaypro2_pio_r, kaypro2_pio_w)
462ADDRESS_MAP_END
463 
464 
465/***********************************************************
466 
467   Machine
468 
469************************************************************/
470 
471static MACHINE_RESET( kaypro2 )
472{
473   kaypro2_z80pio_g = devtag_get_device(machine, "z80pio_g");
474   kaypro2_z80pio_s = devtag_get_device(machine, "z80pio_s");
475   kaypro2_z80sio = devtag_get_device(machine, "z80sio");
476   kaypro2_printer = devtag_get_device(machine, "centronics");
477   kaypro2_fdc = devtag_get_device(machine, "wd1793");
478   pio_system_w(kaypro2_z80pio_s, 0, 0x80);
479   MACHINE_RESET_CALL(kay_kbd);
480}
481 
482 
483/***********************************************************
484 
485   Machine Driver
486 
487************************************************************/
488 
489static MACHINE_DRIVER_START( kaypro2 )
490   /* basic machine hardware */
491   MDRV_CPU_ADD("maincpu", Z80, 2500000)   /* 2.5 MHz */
492   MDRV_CPU_PROGRAM_MAP(kaypro2_map, 0)
493   MDRV_CPU_IO_MAP(kaypro2_io, 0)
494   MDRV_CPU_VBLANK_INT("screen", kay_kbd_interrupt)   /* this doesn't actually exist, it is to run the keyboard */
495 
496   MDRV_MACHINE_RESET( kaypro2 )
497 
498   /* video hardware */
499   MDRV_SCREEN_ADD("screen", RASTER)
500   MDRV_SCREEN_REFRESH_RATE(60)
501   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
502   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
503   MDRV_SCREEN_SIZE(80*7, 24*10)
504   MDRV_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1)
505   MDRV_PALETTE_LENGTH(2)
506   MDRV_PALETTE_INIT(kaypro2)
507 
508   MDRV_VIDEO_UPDATE( kaypro2 )
509 
510   /* sound hardware */
511   MDRV_SPEAKER_STANDARD_MONO("mono")
512   MDRV_SOUND_ADD("beep", BEEP, 0)
513   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
514 
515   /* devices */
516   MDRV_WD179X_ADD("wd1793", kaypro2_wd1793_interface )
517   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
518   MDRV_Z80PIO_ADD( "z80pio_g", kaypro2_pio_g_intf )
519   MDRV_Z80PIO_ADD( "z80pio_s", kaypro2_pio_s_intf )
520   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro2_sio_intf )   /* start at 300 baud */
521MACHINE_DRIVER_END
522 
523static MACHINE_DRIVER_START( omni2 )
524   MDRV_IMPORT_FROM( kaypro2 )
525   MDRV_VIDEO_UPDATE( omni2 )
526MACHINE_DRIVER_END
527 
528 
529/***********************************************************
530 
531   Game driver
532 
533************************************************************/
534 
535/* The roms need to be renamed to their part numbers (81-xxx) when known */
536 
537ROM_START(kayproii)
538   /* The board could take a 2716 or 2732 */
539   ROM_REGION(0x4000, "maincpu",0)
540   ROM_LOAD("kayproii.u47", 0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b) )
541//   ROM_LOAD("kayproii.u47", 0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) )
542 
543   ROM_REGION(0x10000, "rambank",0)
544   ROM_FILL( 0, 0x10000, 0xff)
545 
546   ROM_REGION(0x0800, "gfx1",0)
547   ROM_LOAD("kayproii.u43", 0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
548ROM_END
549 
550ROM_START(omni2)
551   ROM_REGION(0x4000, "maincpu",0)
552   ROM_LOAD("omni2.u47",    0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) )
553 
554   ROM_REGION(0x10000, "rambank",0)
555   ROM_FILL( 0, 0x10000, 0xff)
556 
557   ROM_REGION(0x0800, "gfx1",0)
558   ROM_LOAD("omni2.u43",    0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) )
559ROM_END
560 
561ROM_START(kaypro2x)
562   ROM_REGION(0x4000, "maincpu",0)
563   ROM_LOAD("kaypro2.u34",  0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) )
564 
565   ROM_REGION(0x10000, "rambank",0)
566   ROM_FILL( 0, 0x10000, 0xff)
567 
568   ROM_REGION(0x1000, "gfx1",0)
569   ROM_LOAD("kaypro2.u9",   0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
570ROM_END
571 
572ROM_START(kaypro10)
573   ROM_REGION(0x4000, "maincpu",0)
574   ROM_LOAD("kaypro10.u42", 0x0000, 0x1000, CRC(3f9bee20) SHA1(b29114a199e70afe46511119b77a662e97b093a0) )
575 
576   ROM_REGION(0x10000, "rambank",0)
577   ROM_FILL( 0, 0x10000, 0xff)
578 
579   ROM_REGION(0x1000, "gfx1",0)
580   ROM_LOAD("kaypro10.u31", 0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
581ROM_END
582 
583 
584static SYSTEM_CONFIG_START(kaypro2)
585   CONFIG_DEVICE(kaypro2_floppy_getinfo)
586SYSTEM_CONFIG_END
587 
588/*    YEAR  NAME      PARENT   COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
589COMP( 1983, kayproii, 0,       0,      kaypro2,   kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro II - 2/83" , GAME_NOT_WORKING )
590COMP( 198?, omni2,    0,       0,      omni2,     kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
591COMP( 1984, kaypro2x, 0,       0,      kaypro2,   kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )
592COMP( 198?, kaypro10, 0,       0,      kaypro2,   kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 10" , GAME_NOT_WORKING )
src/mess/drivers/z80ne.c
r4517r4518
1/******************************************************************************
2   Nuova Elettronica Z80NE system driver
3 
4   Preliminary driver
5 
6   Roberto Lavarone, 2009-01-05
7 
8   Thanks go to:
9      Roberto Bazzano: www.z80ne.com
10 
11   Z80NE memory map
12 
13      LX.382 CPU board
14         range     short     description
15         0000-03FF RAM
16         8000-83FF EPROM     firmware
17 
18      LX.383 HEX keyboard and display controller for LX.384 hex keyboard and display
19         range     short     description
20         F0-F7     I/O       7-segment LED dual-port RAM write
21         F0        I/O       keyboard read
22         F8        I/O       enable single step for next instruction
23 
24      LX.385 Cassette interface
25         range     short     description
26         EE        I/O       UART Data Read/Write
27         EF        I/O       UART Status/Control - Cassette Tape Control
28 
29      LX.392 32K Memory expansion board
30         range     short     description
31 
32 
33      LX.389 Printer Interface
34         range     short     description
35         02-03
36         06-07
37         0A-0B
38         0E-0F
39         12-13
40         16-17
41         1A-1B
42         1E-1F
43 
44      LX.548 16K Basic eprom
45         range     short     description
46         0000-3FFF EPROM     firmware
47 
48      LX.388 Video Interface
49         range     short     description
50         EC00-EDFF RAM
51         EA        I/O       keyboard
52         EB        I/O       video retrace
53 
54      LX.529 Graphics Video and Printer Interface
55         range     short     description
56         80        I/O       PIO 0 port A data (ram 0)
57         81        I/O       PIO 0 port A control (ram 0)
58         82        I/O       PIO 0 port B data (printer)
59         83        I/O       PIO 0 port B control (printer)
60         84        I/O       PIO 1 port A data (ram 1)
61         85        I/O       PIO 1 port A control (ram 1)
62         86        I/O       PIO 1 port B data (keyboard)
63         87        I/O       PIO 1 port B control (keyboard)
64         88        I/O       PIO 2 port A data (ram 2)
65         89        I/O       PIO 2 port A control (ram 2)
66         8A        I/O       PIO 2 port B data (printer busy + 40/80 video chars)
67         8B        I/O       PIO 2 port B control (printer busy + 40/40 video chars)
68         8C        I/O       SY6845 address and status register
69         8D        I/O       SY6845 data register
70         8E        I/O       RAM 3 character attribute
71         8F        I/O       beeper
72 
73      LX.390 Floppy Interface
74         range     short     description
75         F000-F3FF EPROM     firmware
76         D0        I/O       command/status register
77         D1        I/O       trace register
78         D2        I/O       sector register
79         D3        I/O       data register (write only if controller idle)
80         D6        I/O       drive select / drive side one select
81         D7        I/O       data register (write always)
82 
83      LX.394-395 EPROM Programmer
84         range     short     description
85         9000-9FFF EPROM     EPROM to be written
86         8400-8FFF EPROM     firmware
87 
88 
89******************************************************************************/
90 
91/* Core includes */
92#include "driver.h"
93#include "cpu/z80/z80.h"
94#include "includes/z80ne.h"
95#include "devices/cassette.h"
96 
97/* peripheral chips */
98#include "machine/ay31015.h"
99#include "machine/kr2376.h"
100#include "video/m6847.h"
101#include "machine/wd17xx.h"
102 
103/* Layout */
104#include "z80ne.lh"
105#include "z80net.lh"
106#include "z80netb.lh"
107 
108 
109/******************************************************************************
110 Memory Maps
111******************************************************************************/
112 
113 
114/* LX.382 CPU Board RAM */
115/* LX.382 CPU Board EPROM */
116#if 0
117static ADDRESS_MAP_START( z80ne_mem, ADDRESS_SPACE_PROGRAM, 8 )
118   AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK(1)
119   AM_RANGE( 0x0400, 0x7fff ) AM_READWRITE(SMH_NOP, SMH_NOP)
120   AM_RANGE( 0x8000, 0x83ff ) AM_ROM
121   AM_RANGE( 0x8400, 0xebff ) AM_READWRITE(SMH_NOP, SMH_NOP)
122   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
123   AM_RANGE( 0xee00, 0xffff ) AM_READWRITE(SMH_NOP, SMH_NOP)
124 
125ADDRESS_MAP_END
126#endif
127 
128static ADDRESS_MAP_START( z80ne_mem, ADDRESS_SPACE_PROGRAM, 8 )
129   AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK(1)
130   AM_RANGE( 0x8000, 0x83ff ) AM_ROM
131//   AM_RANGE( 0x8400, 0xebff ) AM_READWRITE(SMH_NOP, SMH_NOP)
132   AM_RANGE( 0x8400, 0xebff ) AM_RAM
133   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
134//   AM_RANGE( 0xee00, 0xffff ) AM_READWRITE(SMH_NOP, SMH_NOP)
135   AM_RANGE( 0xee00, 0xffff ) AM_RAM
136ADDRESS_MAP_END
137 
138static ADDRESS_MAP_START( z80netb_mem, ADDRESS_SPACE_PROGRAM, 8 )
139   AM_RANGE( 0x0000, 0x3fff ) AM_ROM
140   AM_RANGE( 0x4000, 0xebff ) AM_RAM
141   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
142   AM_RANGE( 0xee00, 0xffff ) AM_RAM
143ADDRESS_MAP_END
144 
145static ADDRESS_MAP_START( z80ne_io, ADDRESS_SPACE_IO, 8 )
146   ADDRESS_MAP_GLOBAL_MASK(0xff)
147   AM_RANGE(0xee, 0xee) AM_READWRITE( lx385_data_r, lx385_data_w )
148   AM_RANGE(0xef, 0xef) AM_READWRITE( lx385_ctrl_r, lx385_ctrl_w )
149   AM_RANGE(0xf0, 0xff) AM_READWRITE( lx383_r, lx383_w )
150ADDRESS_MAP_END
151 
152static ADDRESS_MAP_START( z80net_io, ADDRESS_SPACE_IO, 8 )
153   ADDRESS_MAP_GLOBAL_MASK(0xff)
154   AM_RANGE(0xea, 0xea) AM_READ( lx388_data_r )
155   AM_RANGE(0xeb, 0xeb) AM_READ( lx388_read_field_sync )
156   AM_RANGE(0xee, 0xee) AM_READWRITE( lx385_data_r, lx385_data_w )
157   AM_RANGE(0xef, 0xef) AM_READWRITE( lx385_ctrl_r, lx385_ctrl_w )
158   AM_RANGE(0xf0, 0xff) AM_READWRITE( lx383_r, lx383_w )
159ADDRESS_MAP_END
160 
161 
162 
163/******************************************************************************
164 Input Ports
165******************************************************************************/
166 
167 
168static INPUT_PORTS_START( z80ne )
169/* LX.384 Hex Keyboard and Display */
170PORT_START("ROW0")         /* IN0 keys row 0 */
171PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0)
172PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1)
173PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2)
174PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3)
175PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4)
176PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5)
177PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6)
178PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7)
179 
180PORT_START("ROW1")         /* IN1 keys row 1 */
181PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8)
182PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9)
183PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A)
184PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B)
185PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C)
186PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D)
187PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E)
188PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F)
189 
190PORT_START("CTRL")         /* CONTROL key */
191PORT_BIT( 0x80, 0x80, IPT_UNUSED )
192PORT_BIT( 0x40, 0x40, IPT_UNUSED )
193PORT_BIT( 0x20, 0x20, IPT_UNUSED )
194PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
195PORT_BIT( 0x08, 0x08, IPT_UNUSED )
196PORT_BIT( 0x04, 0x04, IPT_UNUSED )
197PORT_BIT( 0x02, 0x02, IPT_UNUSED )
198PORT_BIT( 0x01, 0x01, IPT_UNUSED )
199 
200PORT_START("RST")         /* RESET key */
201PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED(z80ne_reset, NULL)
202 
203/* Settings */
204PORT_START("LX.385")
205PORT_DIPNAME(0x07, 0x01   , "LX.385: P1,P3 Data Rate")
206PORT_DIPSETTING( 0x01, "A-B: 300 bps")
207PORT_DIPSETTING( 0x02, "A-C: 600 bps")
208PORT_DIPSETTING( 0x04, "A-D: 1200 bps")
209PORT_DIPNAME( 0x08, 0x00, "LX.385: P4 Parity Check")
210PORT_DIPSETTING( 0x00, "Parity Check Enabled")
211PORT_DIPSETTING( 0x08, "Parity Check Disabled")
212 
213INPUT_PORTS_END
214 
215 
216static INPUT_PORTS_START( z80net )
217 
218PORT_INCLUDE( z80ne )
219 
220/* LX.388 Keyboard BREAK key */
221PORT_START("LX388_BRK")
222PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_STOP) PORT_CHANGED(z80ne_nmi, NULL)
223 
224/* LX.388 Keyboard (Encoded by KR2376) */
225PORT_START("X0")
226PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
227PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
228PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
229PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
230PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
232PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
233PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
234PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
235PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
236PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
237 
238PORT_START("X1")
239PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
240PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
241PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
242PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
243PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
244PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
245PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
246PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
247PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
248PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
249PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
250 
251 
252PORT_START("X2")
253PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
254PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
255PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
256PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
257PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
258PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
259PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
260PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
261PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
262PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
263PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
264 
265PORT_START("X3")
266PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
267PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
268PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
269PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- Delete") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_')
270PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`')
271PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
272PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
273PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
274PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Carriage Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
275PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10)
276PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL)
277 
278PORT_START("X4")
279PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+')
280PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
281PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
282PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
283PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
284PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
285PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
286PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
287PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
288PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
289PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
290 
291 
292PORT_START("X5")
293PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
294PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
295PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
296PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
297PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
298PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
299PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
300PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
301PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
302PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
303PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
304 
305 
306PORT_START("X6")
307PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
308PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
309PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
310PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
311PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
312PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
313PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
314PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
315PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
316 
317PORT_START("X7")
318PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
319PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
320PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xFFFD)
321PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
322PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
323PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
324PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
325PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
326PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
327PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~')
328PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
329 
330PORT_START("MODIFIERS")
331PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
332PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
333PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
334 
335INPUT_PORTS_END
336 
337/******************************************************************************
338 Machine Drivers
339******************************************************************************/
340 
341 
342static const ay31015_config z80ne_ay31015_config =
343{
344   AY_3_1015,
345   4800.0,
346   4800.0,
347   NULL,
348   NULL,
349   NULL
350};
351 
352static const cassette_config z80ne_cassettea_config =
353{
354   cassette_default_formats,
355   NULL,
356   CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED
357};
358 
359static const cassette_config z80ne_cassetteb_config =
360{
361   cassette_default_formats,
362   NULL,
363   CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED
364};
365 
366static const kr2376_interface lx388_kr2376_interface =
367{
368   50000,
369   NULL
370};
371 
372static MACHINE_DRIVER_START( z80ne )
373   /* basic machine hardware */
374   MDRV_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ)
375   MDRV_CPU_PROGRAM_MAP(z80ne_mem, 0)
376   MDRV_CPU_IO_MAP(z80ne_io, 0)
377 
378   MDRV_MACHINE_START(z80ne)
379   MDRV_MACHINE_RESET(z80ne)
380 
381   MDRV_AY31015_ADD( "ay_3_1015", z80ne_ay31015_config )
382 
383   MDRV_CASSETTE_ADD( "cassettea", z80ne_cassettea_config )
384   MDRV_CASSETTE_ADD( "cassetteb", z80ne_cassetteb_config )
385 
386   MDRV_DEFAULT_LAYOUT(layout_z80ne)
387MACHINE_DRIVER_END
388 
389static MACHINE_DRIVER_START( z80net )
390   MDRV_IMPORT_FROM( z80ne )
391 
392   MDRV_CPU_MODIFY("z80ne")
393   MDRV_CPU_IO_MAP(z80net_io, 0)
394 
395   MDRV_MACHINE_START( z80net )
396   MDRV_MACHINE_RESET( z80net )
397 
398   MDRV_KR2376_ADD( "lx388_kr2376", lx388_kr2376_interface)
399 
400   /* video hardware */
401   MDRV_SCREEN_ADD("lx388", RASTER)
402   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
403 
404   MDRV_VIDEO_START(lx388)
405   MDRV_VIDEO_UPDATE(m6847)
406   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
407   MDRV_SCREEN_SIZE(320, 25+192+26)
408   MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
409 
410   MDRV_DEFAULT_LAYOUT(layout_z80net)
411   //MDRV_WD179X_ADD("wd179x", z80ne_wd17xx_interface )
412 
413MACHINE_DRIVER_END
414 
415static MACHINE_DRIVER_START( z80netb )
416   /* basic machine hardware */
417   MDRV_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ)
418   MDRV_CPU_PROGRAM_MAP(z80netb_mem, 0)
419   MDRV_CPU_IO_MAP(z80net_io, 0)
420 
421   MDRV_MACHINE_START(z80netb)
422   MDRV_MACHINE_RESET(z80netb)
423 
424   MDRV_AY31015_ADD( "ay_3_1015", z80ne_ay31015_config )
425 
426   MDRV_CASSETTE_ADD( "cassettea", z80ne_cassettea_config )
427   MDRV_CASSETTE_ADD( "cassetteb", z80ne_cassetteb_config )
428 
429   MDRV_KR2376_ADD( "lx388_kr2376", lx388_kr2376_interface)
430 
431   /* video hardware */
432   MDRV_SCREEN_ADD("lx388", RASTER)
433   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
434 
435   MDRV_VIDEO_START(lx388)
436   MDRV_VIDEO_UPDATE(m6847)
437   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
438   MDRV_SCREEN_SIZE(320, 25+192+26)
439   MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
440   MDRV_DEFAULT_LAYOUT(layout_z80netb)
441MACHINE_DRIVER_END
442 
443/******************************************************************************
444 ROM Definitions
445******************************************************************************/
446 
447 
448ROM_START( z80ne )
449   ROM_REGION(0x10000, "z80ne", 0)
450   ROM_LOAD( "ep382.ic5", 0x8000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) )
451ROM_END
452 
453ROM_START( z80net )
454   ROM_REGION(0x10000, "z80ne", 0)
455   ROM_LOAD( "ep382.ic5", 0x8000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) )
456ROM_END
457 
458ROM_START( z80netb )
459/*
460 * 16k Basic
461 */
462   ROM_REGION(0x10000, "z80ne", 0)
463   ROM_LOAD( "548-1.ic1", 0x0000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) )
464   ROM_LOAD( "548-2.ic2", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) )
465   ROM_LOAD( "548-3.ic3", 0x1000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) )
466   ROM_LOAD( "548-4.ic4", 0x1800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) )
467   ROM_LOAD( "548-5.ic5", 0x2000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) )
468   ROM_LOAD( "548-6.ic6", 0x2800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) )
469   ROM_LOAD( "548-7.ic7", 0x3000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) )
470   ROM_LOAD( "548-8.ic8", 0x3800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) )
471ROM_END
472 
473 
474/******************************************************************************
475 System Config
476******************************************************************************/
477 
478 
479static SYSTEM_CONFIG_START( z80ne )
480   CONFIG_RAM_DEFAULT( 32 * 1024 )
481   CONFIG_RAM( 1 * 1024 )
482SYSTEM_CONFIG_END
483 
484static SYSTEM_CONFIG_START( z80net )
485   CONFIG_RAM_DEFAULT( 32 * 1024 )
486   CONFIG_RAM( 1 * 1024 )
487SYSTEM_CONFIG_END
488 
489static SYSTEM_CONFIG_START( z80netb )
490   CONFIG_RAM_DEFAULT( 32 * 1024 )
491   CONFIG_RAM( 1 * 1024 )
492SYSTEM_CONFIG_END
493 
494 
495/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT     CONFIG   COMPANY               FULLNAME                      FLAGS */
496COMP( 1980,   z80ne,    0,        0,      z80ne,    z80ne,    z80ne,   z80ne,   "Nuova Elettronica",   "Z80NE",                      GAME_NO_SOUND )
497COMP( 1980,   z80net,   z80ne,    0,      z80net,   z80net,   z80net,  z80net,  "Nuova Elettronica",   "Z80NE + LX.388",             GAME_NO_SOUND | GAME_COMPUTER)
498COMP( 1980,   z80netb,  z80ne,    0,      z80netb,  z80net,   z80netb, z80netb, "Nuova Elettronica",   "Z80NE + LX.388 + Basic 16k", GAME_NO_SOUND | GAME_COMPUTER)
1/******************************************************************************
2   Nuova Elettronica Z80NE system driver
3
4   Preliminary driver
5
6   Roberto Lavarone, 2009-01-05
7
8   Thanks go to:
9      Roberto Bazzano: www.z80ne.com
10
11   Z80NE memory map
12
13      LX.382 CPU board
14         range     short     description
15         0000-03FF RAM
16         8000-83FF EPROM     firmware
17
18      LX.383 HEX keyboard and display controller for LX.384 hex keyboard and display
19         range     short     description
20         F0-F7     I/O       7-segment LED dual-port RAM write
21         F0        I/O       keyboard read
22         F8        I/O       enable single step for next instruction
23
24      LX.385 Cassette interface
25         range     short     description
26         EE        I/O       UART Data Read/Write
27         EF        I/O       UART Status/Control - Cassette Tape Control
28
29      LX.392 32K Memory expansion board
30         range     short     description
31
32
33      LX.389 Printer Interface
34         range     short     description
35         02-03
36         06-07
37         0A-0B
38         0E-0F
39         12-13
40         16-17
41         1A-1B
42         1E-1F
43
44      LX.548 16K Basic eprom
45         range     short     description
46         0000-3FFF EPROM     firmware
47
48      LX.388 Video Interface
49         range     short     description
50         EC00-EDFF RAM
51         EA        I/O       keyboard
52         EB        I/O       video retrace
53
54      LX.529 Graphics Video and Printer Interface
55         range     short     description
56         80        I/O       PIO 0 port A data (ram 0)
57         81        I/O       PIO 0 port A control (ram 0)
58         82        I/O       PIO 0 port B data (printer)
59         83        I/O       PIO 0 port B control (printer)
60         84        I/O       PIO 1 port A data (ram 1)
61         85        I/O       PIO 1 port A control (ram 1)
62         86        I/O       PIO 1 port B data (keyboard)
63         87        I/O       PIO 1 port B control (keyboard)
64         88        I/O       PIO 2 port A data (ram 2)
65         89        I/O       PIO 2 port A control (ram 2)
66         8A        I/O       PIO 2 port B data (printer busy + 40/80 video chars)
67         8B        I/O       PIO 2 port B control (printer busy + 40/40 video chars)
68         8C        I/O       SY6845 address and status register
69         8D        I/O       SY6845 data register
70         8E        I/O       RAM 3 character attribute
71         8F        I/O       beeper
72
73      LX.390 Floppy Interface
74         range     short     description
75         F000-F3FF EPROM     firmware
76         D0        I/O       command/status register
77         D1        I/O       trace register
78         D2        I/O       sector register
79         D3        I/O       data register (write only if controller idle)
80         D6        I/O       drive select / drive side one select
81         D7        I/O       data register (write always)
82
83      LX.394-395 EPROM Programmer
84         range     short     description
85         9000-9FFF EPROM     EPROM to be written
86         8400-8FFF EPROM     firmware
87
88
89******************************************************************************/
90
91/* Core includes */
92#include "driver.h"
93#include "cpu/z80/z80.h"
94#include "includes/z80ne.h"
95#include "devices/cassette.h"
96
97/* peripheral chips */
98#include "machine/ay31015.h"
99#include "machine/kr2376.h"
100#include "video/m6847.h"
101#include "machine/wd17xx.h"
102
103/* Layout */
104#include "z80ne.lh"
105#include "z80net.lh"
106#include "z80netb.lh"
107
108
109/******************************************************************************
110 Memory Maps
111******************************************************************************/
112
113
114/* LX.382 CPU Board RAM */
115/* LX.382 CPU Board EPROM */
116#if 0
117static ADDRESS_MAP_START( z80ne_mem, ADDRESS_SPACE_PROGRAM, 8 )
118   AM_RANGE( 0x0000, 0x03ff ) AM_RAMBANK(1)
119   AM_RANGE( 0x0400, 0x7fff ) AM_READWRITE(SMH_NOP, SMH_NOP)
120   AM_RANGE( 0x8000, 0x83ff ) AM_ROM
121   AM_RANGE( 0x8400, 0xebff ) AM_READWRITE(SMH_NOP, SMH_NOP)
122   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
123   AM_RANGE( 0xee00, 0xffff ) AM_READWRITE(SMH_NOP, SMH_NOP)
124
125ADDRESS_MAP_END
126#endif
127
128static ADDRESS_MAP_START( z80ne_mem, ADDRESS_SPACE_PROGRAM, 8 )
129   AM_RANGE( 0x0000, 0x7fff ) AM_RAMBANK(1)
130   AM_RANGE( 0x8000, 0x83ff ) AM_ROM
131//   AM_RANGE( 0x8400, 0xebff ) AM_READWRITE(SMH_NOP, SMH_NOP)
132   AM_RANGE( 0x8400, 0xebff ) AM_RAM
133   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
134//   AM_RANGE( 0xee00, 0xffff ) AM_READWRITE(SMH_NOP, SMH_NOP)
135   AM_RANGE( 0xee00, 0xffff ) AM_RAM
136ADDRESS_MAP_END
137
138static ADDRESS_MAP_START( z80netb_mem, ADDRESS_SPACE_PROGRAM, 8 )
139   AM_RANGE( 0x0000, 0x3fff ) AM_ROM
140   AM_RANGE( 0x4000, 0xebff ) AM_RAM
141   AM_RANGE( 0xec00, 0xedff ) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* (6847) */
142   AM_RANGE( 0xee00, 0xffff ) AM_RAM
143ADDRESS_MAP_END
144
145static ADDRESS_MAP_START( z80ne_io, ADDRESS_SPACE_IO, 8 )
146   ADDRESS_MAP_GLOBAL_MASK(0xff)
147   AM_RANGE(0xee, 0xee) AM_READWRITE( lx385_data_r, lx385_data_w )
148   AM_RANGE(0xef, 0xef) AM_READWRITE( lx385_ctrl_r, lx385_ctrl_w )
149   AM_RANGE(0xf0, 0xff) AM_READWRITE( lx383_r, lx383_w )
150ADDRESS_MAP_END
151
152static ADDRESS_MAP_START( z80net_io, ADDRESS_SPACE_IO, 8 )
153   ADDRESS_MAP_GLOBAL_MASK(0xff)
154   AM_RANGE(0xea, 0xea) AM_READ( lx388_data_r )
155   AM_RANGE(0xeb, 0xeb) AM_READ( lx388_read_field_sync )
156   AM_RANGE(0xee, 0xee) AM_READWRITE( lx385_data_r, lx385_data_w )
157   AM_RANGE(0xef, 0xef) AM_READWRITE( lx385_ctrl_r, lx385_ctrl_w )
158   AM_RANGE(0xf0, 0xff) AM_READWRITE( lx383_r, lx383_w )
159ADDRESS_MAP_END
160
161
162
163/******************************************************************************
164 Input Ports
165******************************************************************************/
166
167
168static INPUT_PORTS_START( z80ne )
169/* LX.384 Hex Keyboard and Display */
170PORT_START("ROW0")         /* IN0 keys row 0 */
171PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0)
172PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1)
173PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2)
174PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3)
175PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4)
176PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5)
177PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6)
178PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7)
179
180PORT_START("ROW1")         /* IN1 keys row 1 */
181PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8)
182PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9)
183PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("A") PORT_CODE(KEYCODE_A)
184PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("B") PORT_CODE(KEYCODE_B)
185PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("C") PORT_CODE(KEYCODE_C)
186PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("D") PORT_CODE(KEYCODE_D)
187PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("E") PORT_CODE(KEYCODE_E)
188PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F") PORT_CODE(KEYCODE_F)
189
190PORT_START("CTRL")         /* CONTROL key */
191PORT_BIT( 0x80, 0x80, IPT_UNUSED )
192PORT_BIT( 0x40, 0x40, IPT_UNUSED )
193PORT_BIT( 0x20, 0x20, IPT_UNUSED )
194PORT_BIT( 0x10, 0x10, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL)
195PORT_BIT( 0x08, 0x08, IPT_UNUSED )
196PORT_BIT( 0x04, 0x04, IPT_UNUSED )
197PORT_BIT( 0x02, 0x02, IPT_UNUSED )
198PORT_BIT( 0x01, 0x01, IPT_UNUSED )
199
200PORT_START("RST")         /* RESET key */
201PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CHANGED(z80ne_reset, NULL)
202
203/* Settings */
204PORT_START("LX.385")
205PORT_DIPNAME(0x07, 0x01   , "LX.385: P1,P3 Data Rate")
206PORT_DIPSETTING( 0x01, "A-B: 300 bps")
207PORT_DIPSETTING( 0x02, "A-C: 600 bps")
208PORT_DIPSETTING( 0x04, "A-D: 1200 bps")
209PORT_DIPNAME( 0x08, 0x00, "LX.385: P4 Parity Check")
210PORT_DIPSETTING( 0x00, "Parity Check Enabled")
211PORT_DIPSETTING( 0x08, "Parity Check Disabled")
212
213INPUT_PORTS_END
214
215
216static INPUT_PORTS_START( z80net )
217
218PORT_INCLUDE( z80ne )
219
220/* LX.388 Keyboard BREAK key */
221PORT_START("LX388_BRK")
222PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Break") PORT_CODE(KEYCODE_STOP) PORT_CHANGED(z80ne_nmi, NULL)
223
224/* LX.388 Keyboard (Encoded by KR2376) */
225PORT_START("X0")
226PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
227PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
228PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
229PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
230PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
232PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
233PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
234PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
235PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
236PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
237
238PORT_START("X1")
239PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD )
240PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
241PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
242PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
243PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
244PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
245PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
246PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
247PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD )
248PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
249PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
250
251
252PORT_START("X2")
253PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
254PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD )
255PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD )
256PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD )
257PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD )
258PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD )
259PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD )
260PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD )
261PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
262PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
263PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD )
264
265PORT_START("X3")
266PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
267PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
268PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
269PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- Delete") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('_')
270PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`')
271PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Delete") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
272PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
273PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
274PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Carriage Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
275PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CHAR(10)
276PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL)
277
278PORT_START("X4")
279PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(';') PORT_CHAR('+')
280PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
281PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
282PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
283PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
284PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
285PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
286PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
287PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
288PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
289PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
290
291
292PORT_START("X5")
293PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
294PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
295PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
296PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
297PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
298PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
299PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
300PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
301PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
302PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD )
303PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Escape") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
304
305
306PORT_START("X6")
307PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
308PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
309PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
310PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
311PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
312PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
313PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
314PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
315PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
316
317PORT_START("X7")
318PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
319PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
320PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(0xFFFD)
321PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
322PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
323PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
324PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
325PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"')
326PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
327PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_CHAR('~')
328PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
329
330PORT_START("MODIFIERS")
331PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
332PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
333PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alpha Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
334
335INPUT_PORTS_END
336
337/******************************************************************************
338 Machine Drivers
339******************************************************************************/
340
341
342static const ay31015_config z80ne_ay31015_config =
343{
344   AY_3_1015,
345   4800.0,
346   4800.0,
347   NULL,
348   NULL,
349   NULL
350};
351
352static const cassette_config z80ne_cassettea_config =
353{
354   cassette_default_formats,
355   NULL,
356   CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED
357};
358
359static const cassette_config z80ne_cassetteb_config =
360{
361   cassette_default_formats,
362   NULL,
363   CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED
364};
365
366static const kr2376_interface lx388_kr2376_interface =
367{
368   50000,
369   NULL
370};
371
372static MACHINE_DRIVER_START( z80ne )
373   /* basic machine hardware */
374   MDRV_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ)
375   MDRV_CPU_PROGRAM_MAP(z80ne_mem, 0)
376   MDRV_CPU_IO_MAP(z80ne_io, 0)
377
378   MDRV_MACHINE_START(z80ne)
379   MDRV_MACHINE_RESET(z80ne)
380
381   MDRV_AY31015_ADD( "ay_3_1015", z80ne_ay31015_config )
382
383   MDRV_CASSETTE_ADD( "cassettea", z80ne_cassettea_config )
384   MDRV_CASSETTE_ADD( "cassetteb", z80ne_cassetteb_config )
385
386   MDRV_DEFAULT_LAYOUT(layout_z80ne)
387MACHINE_DRIVER_END
388
389static MACHINE_DRIVER_START( z80net )
390   MDRV_IMPORT_FROM( z80ne )
391
392   MDRV_CPU_MODIFY("z80ne")
393   MDRV_CPU_IO_MAP(z80net_io, 0)
394
395   MDRV_MACHINE_START( z80net )
396   MDRV_MACHINE_RESET( z80net )
397
398   MDRV_KR2376_ADD( "lx388_kr2376", lx388_kr2376_interface)
399
400   /* video hardware */
401   MDRV_SCREEN_ADD("lx388", RASTER)
402   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
403
404   MDRV_VIDEO_START(lx388)
405   MDRV_VIDEO_UPDATE(m6847)
406   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
407   MDRV_SCREEN_SIZE(320, 25+192+26)
408   MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
409
410   MDRV_DEFAULT_LAYOUT(layout_z80net)
411   //MDRV_WD179X_ADD("wd179x", z80ne_wd17xx_interface )
412
413MACHINE_DRIVER_END
414
415static MACHINE_DRIVER_START( z80netb )
416   /* basic machine hardware */
417   MDRV_CPU_ADD("z80ne", Z80, Z80NE_CPU_SPEED_HZ)
418   MDRV_CPU_PROGRAM_MAP(z80netb_mem, 0)
419   MDRV_CPU_IO_MAP(z80net_io, 0)
420
421   MDRV_MACHINE_START(z80netb)
422   MDRV_MACHINE_RESET(z80netb)
423
424   MDRV_AY31015_ADD( "ay_3_1015", z80ne_ay31015_config )
425
426   MDRV_CASSETTE_ADD( "cassettea", z80ne_cassettea_config )
427   MDRV_CASSETTE_ADD( "cassetteb", z80ne_cassetteb_config )
428
429   MDRV_KR2376_ADD( "lx388_kr2376", lx388_kr2376_interface)
430
431   /* video hardware */
432   MDRV_SCREEN_ADD("lx388", RASTER)
433   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
434
435   MDRV_VIDEO_START(lx388)
436   MDRV_VIDEO_UPDATE(m6847)
437   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
438   MDRV_SCREEN_SIZE(320, 25+192+26)
439   MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
440   MDRV_DEFAULT_LAYOUT(layout_z80netb)
441MACHINE_DRIVER_END
442
443/******************************************************************************
444 ROM Definitions
445******************************************************************************/
446
447
448ROM_START( z80ne )
449   ROM_REGION(0x10000, "z80ne", 0)
450   ROM_LOAD( "ep382.ic5", 0x8000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) )
451ROM_END
452
453ROM_START( z80net )
454   ROM_REGION(0x10000, "z80ne", 0)
455   ROM_LOAD( "ep382.ic5", 0x8000, 0x0400, CRC(61bc5f39) SHA1(a93779a598736302a2fdd94be2fb0bbddea7a72c) )
456ROM_END
457
458ROM_START( z80netb )
459/*
460 * 16k Basic
461 */
462   ROM_REGION(0x10000, "z80ne", 0)
463   ROM_LOAD( "548-1.ic1", 0x0000, 0x0800, CRC(868cad39) SHA1(0ea8af010786a080f823a879a4211f5712d260da) )
464   ROM_LOAD( "548-2.ic2", 0x0800, 0x0800, CRC(ac297d99) SHA1(ccf31d3f9d02c3b68a0ee3be4984424df0e83ab0) )
465   ROM_LOAD( "548-3.ic3", 0x1000, 0x0800, CRC(9c1fe511) SHA1(ff5b6e49a137c2ff9cb760c39bfd85ce4b52bb7d) )
466   ROM_LOAD( "548-4.ic4", 0x1800, 0x0800, CRC(cb5e0de3) SHA1(0beaa8927faaf61f6c3fc0ea1d3d5670f901aae3) )
467   ROM_LOAD( "548-5.ic5", 0x2000, 0x0800, CRC(0bd4559c) SHA1(e736a3124819ffb43e96a8114cd188f18d538053) )
468   ROM_LOAD( "548-6.ic6", 0x2800, 0x0800, CRC(6d663034) SHA1(57588be4e360658dbb313946d7a608e36c1fdd68) )
469   ROM_LOAD( "548-7.ic7", 0x3000, 0x0800, CRC(0bab06c0) SHA1(d52f1519c798e91f25648e996b1db174d90ce0f5) )
470   ROM_LOAD( "548-8.ic8", 0x3800, 0x0800, CRC(f381b594) SHA1(2de7a8941ba48d463974c73d62e994d3cbe2868d) )
471ROM_END
472
473
474/******************************************************************************
475 System Config
476******************************************************************************/
477
478
479static SYSTEM_CONFIG_START( z80ne )
480   CONFIG_RAM_DEFAULT( 32 * 1024 )
481   CONFIG_RAM( 1 * 1024 )
482SYSTEM_CONFIG_END
483
484static SYSTEM_CONFIG_START( z80net )
485   CONFIG_RAM_DEFAULT( 32 * 1024 )
486   CONFIG_RAM( 1 * 1024 )
487SYSTEM_CONFIG_END
488
489static SYSTEM_CONFIG_START( z80netb )
490   CONFIG_RAM_DEFAULT( 32 * 1024 )
491   CONFIG_RAM( 1 * 1024 )
492SYSTEM_CONFIG_END
493
494
495/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT     CONFIG   COMPANY               FULLNAME                      FLAGS */
496COMP( 1980,   z80ne,    0,        0,      z80ne,    z80ne,    z80ne,   z80ne,   "Nuova Elettronica",   "Z80NE",                      GAME_NO_SOUND )
497COMP( 1980,   z80net,   z80ne,    0,      z80net,   z80net,   z80net,  z80net,  "Nuova Elettronica",   "Z80NE + LX.388",             GAME_NO_SOUND | GAME_COMPUTER)
498COMP( 1980,   z80netb,  z80ne,    0,      z80netb,  z80net,   z80netb, z80netb, "Nuova Elettronica",   "Z80NE + LX.388 + Basic 16k", GAME_NO_SOUND | GAME_COMPUTER)
src/mess/drivers/kaypro.c
r4517r4518
1/*************************************************************************************************
2 
3 
4   Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives.
5   Each disk was single sided, and could hold 191k. The computer had 2x pio
6   and 1x sio. One of the sio ports communicated with the keyboard with a coiled
7   telephone cord, complete with modular plug on each end. The keyboard carries
8   its own Intel 8748 processor and is an intelligent device.
9 
10   There are 2 major problems preventing this driver from working
11 
12   - MESS is not capable of conducting realtime serial communications between devices
13 
14   - MAME's z80sio implementation is lacking important deatures:
15   -- cannot change baud rate on the fly
16   -- cannot specify different rates for each channel
17   -- cannot specify different rates for Receive and Transmit
18   -- the callback doesn't appear to support channel B ??
19 
20 
21   Things that need doing:
22   - Floppy disks (I have no knowledge of how to set these up)
23 
24 
25**************************************************************************************************/
26 
27 
28#include "driver.h"
29#include "cpu/z80/z80.h"
30#include "machine/z80pio.h"
31#include "machine/z80sio.h"
32#include "machine/ctronics.h"
33#include "machine/kay_kbd.h"
34#include "machine/wd17xx.h"
35#include "sound/beep.h"
36#include "includes/kaypro.h"
37 
38 
39 
40/***********************************************************
41 
42   Address Maps
43 
44************************************************************/
45 
46static ADDRESS_MAP_START( kaypro2_map, ADDRESS_SPACE_PROGRAM, 8 )
47   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0x0000)
48   AM_RANGE(0x3000, 0x3fff) AM_RAM AM_REGION("maincpu", 0x3000) AM_BASE(&videoram) AM_SIZE(&videoram_size)
49   AM_RANGE(0x4000, 0xffff) AM_RAM AM_REGION("rambank", 0x4000)
50ADDRESS_MAP_END
51 
52static ADDRESS_MAP_START( kaypro2_io, ADDRESS_SPACE_IO, 8 )
53   ADDRESS_MAP_GLOBAL_MASK(0xff)
54   ADDRESS_MAP_UNMAP_HIGH
55   AM_RANGE(0x00, 0x03) AM_WRITE(kaypro2_baud_a_w)
56   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80sio", kaypro2_sio_r, kaypro2_sio_w)
57   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", kaypro2_pio_r, kaypro2_pio_w)
58   AM_RANGE(0x0c, 0x0f) AM_WRITE(kaypro2_baud_b_w)
59   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("wd1793", wd17xx_status_r, wd17xx_command_w)
60   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("wd1793", wd17xx_track_r, wd17xx_track_w)
61   AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("wd1793", wd17xx_sector_r, wd17xx_sector_w)
62   AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("wd1793", wd17xx_data_r, wd17xx_data_w)
63   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_s", kaypro2_pio_r, kaypro2_pio_w)
64ADDRESS_MAP_END
65 
66 
67 
68/***********************************************************
69 
70   Machine Driver
71 
72************************************************************/
73 
74static MACHINE_DRIVER_START( kayproii )
75   /* basic machine hardware */
76   MDRV_CPU_ADD("maincpu", Z80, 2500000)   /* 2.5 MHz */
77   MDRV_CPU_PROGRAM_MAP(kaypro2_map, 0)
78   MDRV_CPU_IO_MAP(kaypro2_io, 0)
79   MDRV_CPU_VBLANK_INT("screen", kay_kbd_interrupt)   /* this doesn't actually exist, it is to run the keyboard */
80 
81   MDRV_MACHINE_RESET( kayproii )
82 
83   /* video hardware */
84   MDRV_SCREEN_ADD("screen", RASTER)
85   MDRV_SCREEN_REFRESH_RATE(60)
86   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
87   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
88   MDRV_SCREEN_SIZE(80*7, 24*10)
89   MDRV_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1)
90   MDRV_PALETTE_LENGTH(2)
91   MDRV_PALETTE_INIT(kaypro)
92 
93   MDRV_VIDEO_UPDATE( kayproii )
94 
95   /* sound hardware */
96   MDRV_SPEAKER_STANDARD_MONO("mono")
97   MDRV_SOUND_ADD("beep", BEEP, 0)
98   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
99 
100   /* devices */
101   MDRV_WD179X_ADD("wd1793", kaypro2_wd1793_interface )
102   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
103   MDRV_Z80PIO_ADD( "z80pio_g", kaypro2_pio_g_intf )
104   MDRV_Z80PIO_ADD( "z80pio_s", kaypro2_pio_s_intf )
105   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro2_sio_intf )   /* start at 300 baud */
106MACHINE_DRIVER_END
107 
108static MACHINE_DRIVER_START( omni2 )
109   MDRV_IMPORT_FROM( kayproii )
110   MDRV_VIDEO_UPDATE( omni2 )
111MACHINE_DRIVER_END
112 
113 
114/***********************************************************
115 
116   Game driver
117 
118************************************************************/
119 
120/* The roms need to be renamed to their part numbers (81-xxx) when known */
121 
122ROM_START(kayproii)
123   /* The board could take a 2716 or 2732 */
124   ROM_REGION(0x4000, "maincpu",0)
125   ROM_LOAD("81-149.u47",   0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b) )
126 
127   ROM_REGION(0x10000, "rambank",0)
128   ROM_FILL( 0, 0x10000, 0xff)
129 
130   ROM_REGION(0x0800, "gfx1",0)
131   ROM_LOAD("81-146.u43",   0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
132ROM_END
133 
134ROM_START(kaypro4)
135   ROM_REGION(0x4000, "maincpu",0)
136   ROM_LOAD("81-232.u47",   0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) )
137 
138   ROM_REGION(0x10000, "rambank",0)
139   ROM_FILL( 0, 0x10000, 0xff)
140 
141   ROM_REGION(0x0800, "gfx1",0)
142   ROM_LOAD("81-146.u43",   0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
143ROM_END
144 
145ROM_START(omni2)
146   ROM_REGION(0x4000, "maincpu",0)
147   ROM_LOAD("omni2.u47",    0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) )
148 
149   ROM_REGION(0x10000, "rambank",0)
150   ROM_FILL( 0, 0x10000, 0xff)
151 
152   ROM_REGION(0x0800, "gfx1",0)
153   ROM_LOAD("omni2.u43",    0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) )
154ROM_END
155 
156ROM_START(kaypro2x)
157   ROM_REGION(0x4000, "maincpu",0)
158   ROM_LOAD("81-292.u34",   0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) )
159 
160   ROM_REGION(0x10000, "rambank",0)
161   ROM_FILL( 0, 0x10000, 0xff)
162 
163   ROM_REGION(0x1000, "gfx1",0)
164   ROM_LOAD("81-817.u9",    0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
165ROM_END
166 
167ROM_START(kaypro10)
168   ROM_REGION(0x4000, "maincpu",0)
169   ROM_LOAD("81-302.u42",   0x0000, 0x1000, CRC(3f9bee20) SHA1(b29114a199e70afe46511119b77a662e97b093a0) )
170 
171   ROM_REGION(0x10000, "rambank",0)
172   ROM_FILL( 0, 0x10000, 0xff)
173 
174   ROM_REGION(0x1000, "gfx1",0)
175   ROM_LOAD("81-817.u31",   0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
176ROM_END
177 
178 
179static SYSTEM_CONFIG_START(kaypro2)
180   CONFIG_DEVICE(kaypro2_floppy_getinfo)
181SYSTEM_CONFIG_END
182 
183/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
184COMP( 1983, kayproii, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro II - 2/83" , GAME_NOT_WORKING )
185COMP( 198?, kaypro4,  kayproii, 0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING )
186COMP( 198?, omni2,    kayproii, 0,      omni2,    kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
187COMP( 1984, kaypro2x, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )
188COMP( 198?, kaypro10, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 10" , GAME_NOT_WORKING )
1/*************************************************************************************************
2
3
4   Kaypro 2/83 computer - the very first Kaypro II - 2 full size floppy drives.
5   Each disk was single sided, and could hold 191k. The computer had 2x pio
6   and 1x sio. One of the sio ports communicated with the keyboard with a coiled
7   telephone cord, complete with modular plug on each end. The keyboard carries
8   its own Intel 8748 processor and is an intelligent device.
9
10   There are 2 major problems preventing this driver from working
11
12   - MESS is not capable of conducting realtime serial communications between devices
13
14   - MAME's z80sio implementation is lacking important deatures:
15   -- cannot change baud rate on the fly
16   -- cannot specify different rates for each channel
17   -- cannot specify different rates for Receive and Transmit
18   -- the callback doesn't appear to support channel B ??
19
20
21   Things that need doing:
22   - Floppy disks (I have no knowledge of how to set these up)
23
24
25**************************************************************************************************/
26
27
28#include "driver.h"
29#include "cpu/z80/z80.h"
30#include "machine/z80pio.h"
31#include "machine/z80sio.h"
32#include "machine/ctronics.h"
33#include "machine/kay_kbd.h"
34#include "machine/wd17xx.h"
35#include "sound/beep.h"
36#include "video/mc6845.h"
37#include "includes/kaypro.h"
38
39
40
41/***********************************************************
42
43   Address Maps
44
45************************************************************/
46
47static ADDRESS_MAP_START( kayproii_map, ADDRESS_SPACE_PROGRAM, 8 )
48   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("maincpu", 0x0000)
49   AM_RANGE(0x3000, 0x3fff) AM_RAM AM_REGION("maincpu", 0x3000) AM_BASE(&videoram) AM_SIZE(&videoram_size)
50   AM_RANGE(0x4000, 0xffff) AM_RAM AM_REGION("rambank", 0x4000)
51ADDRESS_MAP_END
52
53static ADDRESS_MAP_START( kayproii_io, ADDRESS_SPACE_IO, 8 )
54   ADDRESS_MAP_GLOBAL_MASK(0xff)
55   ADDRESS_MAP_UNMAP_HIGH
56   AM_RANGE(0x00, 0x03) AM_WRITE(kaypro2_baud_a_w)
57   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("z80sio", kaypro2_sio_r, kaypro2_sio_w)
58   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", kaypro2_pio_r, kaypro2_pio_w)
59   AM_RANGE(0x0c, 0x0f) AM_WRITE(kaypro2_baud_b_w)
60   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("wd1793", wd17xx_status_r, wd17xx_command_w)
61   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("wd1793", wd17xx_track_r, wd17xx_track_w)
62   AM_RANGE(0x12, 0x12) AM_DEVREADWRITE("wd1793", wd17xx_sector_r, wd17xx_sector_w)
63   AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("wd1793", wd17xx_data_r, wd17xx_data_w)
64   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_s", kaypro2_pio_r, kaypro2_pio_w)
65ADDRESS_MAP_END
66
67
68
69/***********************************************************
70
71   Machine Driver
72
73************************************************************/
74
75static MACHINE_DRIVER_START( kayproii )
76   /* basic machine hardware */
77   MDRV_CPU_ADD("maincpu", Z80, 2500000)   /* 2.5 MHz */
78   MDRV_CPU_PROGRAM_MAP(kayproii_map, 0)
79   MDRV_CPU_IO_MAP(kayproii_io, 0)
80   MDRV_CPU_VBLANK_INT("screen", kay_kbd_interrupt)   /* this doesn't actually exist, it is to run the keyboard */
81
82   MDRV_MACHINE_RESET( kayproii )
83
84   /* video hardware */
85   MDRV_SCREEN_ADD("screen", RASTER)
86   MDRV_SCREEN_REFRESH_RATE(60)
87   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
88   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
89   MDRV_SCREEN_SIZE(80*7, 24*10)
90   MDRV_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1)
91   MDRV_PALETTE_LENGTH(2)
92   MDRV_PALETTE_INIT(kaypro)
93
94   MDRV_VIDEO_UPDATE( kayproii )
95
96   /* sound hardware */
97   MDRV_SPEAKER_STANDARD_MONO("mono")
98   MDRV_SOUND_ADD("beep", BEEP, 0)
99   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
100
101   /* devices */
102   MDRV_WD179X_ADD("wd1793", kaypro2_wd1793_interface )
103   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
104   MDRV_Z80PIO_ADD( "z80pio_g", kaypro2_pio_g_intf )
105   MDRV_Z80PIO_ADD( "z80pio_s", kaypro2_pio_s_intf )
106   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro2_sio_intf )   /* start at 300 baud */
107MACHINE_DRIVER_END
108
109static MACHINE_DRIVER_START( omni2 )
110   MDRV_IMPORT_FROM( kayproii )
111   MDRV_VIDEO_UPDATE( omni2 )
112MACHINE_DRIVER_END
113#if 0
114static MACHINE_DRIVER_START( kaypro2x )
115   /* basic machine hardware */
116   MDRV_CPU_ADD("maincpu", Z80, 4000000)   /* 4 MHz */
117   MDRV_CPU_PROGRAM_MAP(kaypro2x_map, 0)
118   MDRV_CPU_IO_MAP(kaypro2x_io, 0)
119   MDRV_CPU_VBLANK_INT("screen", kay_kbd_interrupt)   /* this doesn't actually exist, it is to run the keyboard */
120
121   MDRV_MACHINE_RESET( kaypro2x )
122
123   /* video hardware */
124   MDRV_SCREEN_ADD("screen", RASTER)
125   MDRV_SCREEN_REFRESH_RATE(60)
126   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
127   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
128   MDRV_SCREEN_SIZE(80*7, 24*10)
129   MDRV_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1)
130   MDRV_PALETTE_LENGTH(2)
131   MDRV_PALETTE_INIT(kaypro)
132
133   MDRV_VIDEO_UPDATE( kaypro2x )
134
135   /* sound hardware */
136   MDRV_SPEAKER_STANDARD_MONO("mono")
137   MDRV_SOUND_ADD("beep", BEEP, 0)
138   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
139
140   /* devices */
141   MDRV_WD179X_ADD("wd1793", kaypro2_wd1793_interface )
142   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
143   MDRV_Z80SIO_ADD( "z80sio", 4800, kaypro2_sio_intf )   /* same job as in kayproii */
144   MDRV_Z80SIO_ADD( "z80sio_2", 4800, kaypro2_sio_2_intf )   /* extra sio for the modem */
145MACHINE_DRIVER_END
146#endif
147/***********************************************************
148
149   Game driver
150
151************************************************************/
152
153/* The roms need to be renamed to their part numbers (81-xxx) when known */
154
155ROM_START(kayproii)
156   /* The board could take a 2716 or 2732 */
157   ROM_REGION(0x4000, "maincpu",0)
158   ROM_LOAD("81-149.u47",   0x0000, 0x0800, CRC(28264bc1) SHA1(a12afb11a538fc0217e569bc29633d5270dfa51b) )
159
160   ROM_REGION(0x10000, "rambank",0)
161   ROM_FILL( 0, 0x10000, 0xff)
162
163   ROM_REGION(0x0800, "gfx1",0)
164   ROM_LOAD("81-146.u43",   0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
165ROM_END
166
167ROM_START(kaypro4)
168   ROM_REGION(0x4000, "maincpu",0)
169   ROM_LOAD("81-232.u47",   0x0000, 0x1000, CRC(4918fb91) SHA1(cd9f45cc3546bcaad7254b92c5d501c40e2ef0b2) )
170
171   ROM_REGION(0x10000, "rambank",0)
172   ROM_FILL( 0, 0x10000, 0xff)
173
174   ROM_REGION(0x0800, "gfx1",0)
175   ROM_LOAD("81-146.u43",   0x0000, 0x0800, CRC(4cc7d206) SHA1(5cb880083b94bd8220aac1f87d537db7cfeb9013) )
176ROM_END
177
178ROM_START(omni2)
179   ROM_REGION(0x4000, "maincpu",0)
180   ROM_LOAD("omni2.u47",    0x0000, 0x1000, CRC(2883f9e0) SHA1(d98c784e62853582d298bf7ca84c75872847ac9b) )
181
182   ROM_REGION(0x10000, "rambank",0)
183   ROM_FILL( 0, 0x10000, 0xff)
184
185   ROM_REGION(0x0800, "gfx1",0)
186   ROM_LOAD("omni2.u43",    0x0000, 0x0800, CRC(049b3381) SHA1(46f1d4f038747ba9048b075dc617361be088f82a) )
187ROM_END
188
189ROM_START(kaypro2x)
190   ROM_REGION(0x4000, "maincpu",0)
191   ROM_LOAD("81-292.u34",   0x0000, 0x2000, CRC(5eb69aec) SHA1(525f955ca002976e2e30ac7ee37e4a54f279fe96) )
192
193   ROM_REGION(0x10000, "rambank",0)
194   ROM_FILL( 0, 0x10000, 0xff)
195
196   ROM_REGION(0x1000, "gfx1",0)
197   ROM_LOAD("81-817.u9",    0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
198ROM_END
199
200ROM_START(kaypro10)
201   ROM_REGION(0x4000, "maincpu",0)
202   ROM_LOAD("81-302.u42",   0x0000, 0x1000, CRC(3f9bee20) SHA1(b29114a199e70afe46511119b77a662e97b093a0) )
203
204   ROM_REGION(0x10000, "rambank",0)
205   ROM_FILL( 0, 0x10000, 0xff)
206
207   ROM_REGION(0x1000, "gfx1",0)
208   ROM_LOAD("81-817.u31",   0x0000, 0x1000, CRC(5f72da5b) SHA1(8a597000cce1a7e184abfb7bebcb564c6bf24fb7) )
209ROM_END
210
211
212static SYSTEM_CONFIG_START(kaypro2)
213   CONFIG_DEVICE(kaypro2_floppy_getinfo)
214SYSTEM_CONFIG_END
215
216/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
217COMP( 1983, kayproii, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro II - 2/83" , GAME_NOT_WORKING )
218COMP( 198?, kaypro4,  kayproii, 0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING )
219COMP( 198?, omni2,    kayproii, 0,      omni2,    kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
220COMP( 1984, kaypro2x, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )
221COMP( 198?, kaypro10, 0,        0,      kayproii, kay_kbd, 0,        kaypro2,     "Non Linear Systems",  "Kaypro 10" , GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team