src/mess/layout/sc1.lay
| r0 | r13773 | |
| 1 | <?xml version="1.0"?>
|
| 2 | <mamelayout version="2">
|
| 3 | <element name="g_led" defstate="0">
|
| 4 | <disk>
|
| 5 | <color red="0.0" green="0.75" blue="0.0" />
|
| 6 | </disk>
|
| 7 | </element>
|
| 8 | <element name="g_digit" defstate="0">
|
| 9 | <led7seg>
|
| 10 | <color red="0.75" green="0.5" blue="0.0" />
|
| 11 | </led7seg>
|
| 12 | </element>
|
| 13 | <element name="r_digit" defstate="0">
|
| 14 | <led7seg>
|
| 15 | <color red="0.75" green="0.0" blue="0.0" />
|
| 16 | </led7seg>
|
| 17 | </element>
|
| 18 | <element name="background">
|
| 19 | <rect>
|
| 20 | <bounds left="0" top="0" right="1" bottom="1" />
|
| 21 | <color red="0.0" green="0.0" blue="0.0" />
|
| 22 | </rect>
|
| 23 | </element>
|
| 24 | |
| 25 | <view name="Default Layout">
|
| 26 | <!-- Black background -->
|
| 27 | <bezel element="background">
|
| 28 | <bounds left="64" top="95" right="453" bottom="195" />
|
| 29 | </bezel>
|
| 30 | <bezel name="busy_led" element="g_led">
|
| 31 | <bounds left="76" right="96" top="130" bottom="150" />
|
| 32 | </bezel>
|
| 33 | |
| 34 | <bezel name="digit0" element="r_digit">
|
| 35 | <bounds left="107" top="105" right="155" bottom="185" />
|
| 36 | </bezel>
|
| 37 | <bezel name="digit6" element="r_digit">
|
| 38 | <bounds left="155" top="105" right="203" bottom="185" />
|
| 39 | </bezel>
|
| 40 | <bezel name="digit5" element="r_digit">
|
| 41 | <bounds left="203" top="105" right="251" bottom="185" />
|
| 42 | </bezel>
|
| 43 | <bezel name="digit4" element="r_digit">
|
| 44 | <bounds left="251" top="105" right="299" bottom="185" />
|
| 45 | </bezel>
|
| 46 | <bezel name="digit3" element="g_digit">
|
| 47 | <bounds left="347" top="105" right="395" bottom="185" />
|
| 48 | </bezel>
|
| 49 | <bezel name="digit1" element="g_digit">
|
| 50 | <bounds left="395" top="105" right="443" bottom="185" />
|
| 51 | </bezel>
|
| 52 | </view>
|
| 53 | </mamelayout>
|
src/mess/drivers/sc1.c
| r13772 | r13773 | |
| 10 | 10 | #include "emu.h" |
| 11 | 11 | #include "cpu/z80/z80.h" |
| 12 | 12 | #include "sound/speaker.h" |
| 13 | #include "sc1.lh" |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | class sc1_state : public driver_device |
| r13772 | r13773 | |
| 25 | 26 | required_device<device_t> m_speaker; |
| 26 | 27 | DECLARE_WRITE8_MEMBER(sc1_fc_w); |
| 27 | 28 | DECLARE_WRITE8_MEMBER(sc1v2_07_w); |
| 29 | DECLARE_WRITE8_MEMBER(sc1v2_io_w); |
| 30 | DECLARE_READ8_MEMBER(sc1v2_io_r); |
| 31 | private: |
| 32 | UINT8 m_digit; |
| 28 | 33 | }; |
| 29 | 34 | |
| 35 | /*************************************************************************** |
| 36 | |
| 37 | Display |
| 38 | |
| 39 | ***************************************************************************/ |
| 40 | |
| 41 | WRITE8_MEMBER( sc1_state::sc1v2_io_w ) |
| 42 | { |
| 43 | bool segonoff = BIT(data, 7); |
| 44 | //bool busyled = BIT(data, 4); |
| 45 | data &= 15; |
| 46 | |
| 47 | if (data < 8) |
| 48 | m_digit = data; |
| 49 | else |
| 50 | if (data < 12) |
| 51 | { |
| 52 | speaker_level_w(m_speaker, BIT(data, 1) ); |
| 53 | return; |
| 54 | } |
| 55 | else |
| 56 | if (offset == 0x2f07) |
| 57 | return; |
| 58 | |
| 59 | UINT8 segdata = output_get_digit_value(m_digit); |
| 60 | UINT8 segnum = offset & 7; |
| 61 | UINT8 segmask = 1 << segnum; |
| 62 | |
| 63 | if (segonoff) |
| 64 | segdata |= segmask; |
| 65 | else |
| 66 | segdata &= ~segmask; |
| 67 | |
| 68 | output_set_digit_value(m_digit, segdata); |
| 69 | |
| 70 | //output_set_value("busyled", busyled); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | /*************************************************************************** |
| 75 | |
| 76 | Keyboard |
| 77 | |
| 78 | ***************************************************************************/ |
| 79 | |
| 80 | READ8_MEMBER( sc1_state::sc1v2_io_r ) |
| 81 | { |
| 82 | UINT8 data = 0xff, upper = (offset >> 8) & 7; |
| 83 | |
| 84 | if (upper == 3) |
| 85 | data &= input_port_read(machine(), "X0"); |
| 86 | else |
| 87 | if (upper == 4) |
| 88 | data &= input_port_read(machine(), "X1"); |
| 89 | else |
| 90 | if (upper == 5) |
| 91 | data &= input_port_read(machine(), "X2"); |
| 92 | |
| 93 | return data; |
| 94 | } |
| 95 | |
| 30 | 96 | WRITE8_MEMBER( sc1_state::sc1_fc_w ) |
| 31 | 97 | { |
| 32 | 98 | // if (BIT(data, 3)) |
| r13772 | r13773 | |
| 54 | 120 | |
| 55 | 121 | static ADDRESS_MAP_START(sc1v2_io, AS_IO, 8, sc1_state) |
| 56 | 122 | ADDRESS_MAP_UNMAP_HIGH |
| 57 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 58 | | AM_RANGE( 0x07, 0x07) AM_WRITE(sc1v2_07_w) |
| 123 | //ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 124 | AM_RANGE( 0x0000, 0xffff) AM_WRITE(sc1v2_io_w) |
| 59 | 125 | ADDRESS_MAP_END |
| 60 | 126 | |
| 61 | 127 | /* Input ports */ |
| 62 | 128 | static INPUT_PORTS_START( sc1 ) |
| 129 | PORT_START("X0") |
| 130 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 131 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4 T") PORT_CODE(KEYCODE_4) |
| 132 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3 L") PORT_CODE(KEYCODE_3) |
| 133 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2 S") PORT_CODE(KEYCODE_2) |
| 134 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1 B") PORT_CODE(KEYCODE_1) |
| 135 | |
| 136 | PORT_START("X1") |
| 137 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 138 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5 D") PORT_CODE(KEYCODE_5) |
| 139 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6 K") PORT_CODE(KEYCODE_6) |
| 140 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7) |
| 141 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8) |
| 142 | |
| 143 | PORT_START("X2") |
| 144 | PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 145 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) |
| 146 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 147 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("St") PORT_CODE(KEYCODE_S) |
| 148 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 63 | 149 | INPUT_PORTS_END |
| 64 | 150 | |
| 65 | 151 | |
| r13772 | r13773 | |
| 67 | 153 | { |
| 68 | 154 | } |
| 69 | 155 | |
| 70 | | static VIDEO_START( sc1 ) |
| 71 | | { |
| 72 | | } |
| 73 | | |
| 74 | | static SCREEN_UPDATE( sc1 ) |
| 75 | | { |
| 76 | | return 0; |
| 77 | | } |
| 78 | | |
| 79 | 156 | static MACHINE_CONFIG_START( sc1, sc1_state ) |
| 80 | 157 | /* basic machine hardware */ |
| 81 | 158 | MCFG_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| r13772 | r13773 | |
| 85 | 162 | MCFG_MACHINE_RESET(sc1) |
| 86 | 163 | |
| 87 | 164 | /* video hardware */ |
| 88 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 89 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 90 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 91 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 92 | | MCFG_SCREEN_SIZE(640, 480) |
| 93 | | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 94 | | MCFG_VIDEO_START(sc1) |
| 95 | | MCFG_SCREEN_UPDATE(sc1) |
| 96 | | MCFG_PALETTE_LENGTH(2) |
| 97 | | MCFG_PALETTE_INIT(black_and_white) |
| 165 | MCFG_DEFAULT_LAYOUT(layout_sc1) |
| 98 | 166 | |
| 99 | 167 | /* sound hardware */ |
| 100 | 168 | MCFG_SPEAKER_STANDARD_MONO("mono") |