src/mess/drivers/sdk85.c
| r12025 | r12026 | |
| 4 | 4 | |
| 5 | 5 | 09/12/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | 22/06/2011 Working [Robbbert] |
| 8 | |
| 9 | This is an evaluation kit for the 8085 cpu. |
| 10 | |
| 11 | There is no speaker or storage facility in the standard kit. |
| 12 | |
| 13 | Download the User Manual to get the operating procedures. |
| 14 | |
| 15 | An example is Press SUBST key, enter an address, press NEXT key, enter data, |
| 16 | then press NEXT to increment the address. |
| 17 | |
| 18 | ToDo: |
| 19 | - Artwork |
| 20 | - Proper emulation of the 8279 chip (there's only just enough to get this |
| 21 | driver to work atm) |
| 22 | |
| 7 | 23 | ****************************************************************************/ |
| 24 | #define ADDRESS_MAP_MODERN |
| 8 | 25 | |
| 9 | 26 | #include "emu.h" |
| 10 | 27 | #include "cpu/i8085/i8085.h" |
| 28 | #include "sdk85.lh" |
| 11 | 29 | |
| 30 | #define MACHINE_RESET_MEMBER(name) void name::machine_reset() |
| 12 | 31 | |
| 13 | 32 | class sdk85_state : public driver_device |
| 14 | 33 | { |
| r12025 | r12026 | |
| 16 | 35 | sdk85_state(const machine_config &mconfig, device_type type, const char *tag) |
| 17 | 36 | : driver_device(mconfig, type, tag) { } |
| 18 | 37 | |
| 38 | DECLARE_READ8_MEMBER(keyboard_r); |
| 39 | DECLARE_READ8_MEMBER(status_r); |
| 40 | DECLARE_WRITE8_MEMBER(command_w); |
| 41 | DECLARE_WRITE8_MEMBER(data_w); |
| 42 | UINT8 m_digit; // next digit to display |
| 43 | UINT8 m_kbd; // keyscan code being returned |
| 44 | UINT8 m_keytemp; // to see when key gets released |
| 45 | bool m_kbd_ready; // get ready to return keyscan code |
| 46 | virtual void machine_reset(); |
| 19 | 47 | }; |
| 20 | 48 | |
| 49 | READ8_MEMBER( sdk85_state::keyboard_r ) |
| 50 | { |
| 51 | if (m_kbd_ready) |
| 52 | { |
| 53 | UINT8 ret = m_kbd; |
| 54 | m_kbd_ready = FALSE; |
| 55 | m_kbd = 0xff; |
| 56 | return ret; |
| 57 | } |
| 58 | else |
| 59 | return 0; |
| 60 | } |
| 21 | 61 | |
| 22 | | static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8) |
| 62 | READ8_MEMBER( sdk85_state::status_r ) |
| 63 | { |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | WRITE8_MEMBER( sdk85_state::command_w ) |
| 68 | { |
| 69 | if ((data & 0x90)==0x90) |
| 70 | m_digit = data & 7; |
| 71 | else |
| 72 | if (data==0x40) |
| 73 | m_kbd_ready = TRUE; |
| 74 | } |
| 75 | |
| 76 | WRITE8_MEMBER( sdk85_state::data_w ) |
| 77 | { |
| 78 | if (m_digit < 6) |
| 79 | { |
| 80 | output_set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff); |
| 81 | m_digit++; |
| 82 | } |
| 83 | else |
| 84 | m_digit = 15; |
| 85 | } |
| 86 | |
| 87 | |
| 88 | static ADDRESS_MAP_START(sdk85_mem, AS_PROGRAM, 8, sdk85_state) |
| 23 | 89 | ADDRESS_MAP_UNMAP_HIGH |
| 24 | 90 | AM_RANGE(0x0000, 0x07ff) AM_ROM // Monitor rom (A14) |
| 25 | 91 | AM_RANGE(0x0800, 0x0fff) AM_ROM // Expansion rom (A15) |
| 26 | | AM_RANGE(0x1800, 0x1fff) AM_RAM // i8279 (A13) |
| 92 | AM_RANGE(0x1800, 0x1800) AM_READWRITE(keyboard_r,data_w) |
| 93 | AM_RANGE(0x1900, 0x1900) AM_READWRITE(status_r,command_w) |
| 94 | //AM_RANGE(0x1800, 0x1fff) AM_RAM // i8279 (A13) |
| 27 | 95 | AM_RANGE(0x2000, 0x27ff) AM_RAM // i8155 (A16) |
| 28 | 96 | AM_RANGE(0x2800, 0x2fff) AM_RAM // i8155 (A17) |
| 29 | 97 | ADDRESS_MAP_END |
| 30 | 98 | |
| 31 | | static ADDRESS_MAP_START( sdk85_io , AS_IO, 8) |
| 99 | static ADDRESS_MAP_START(sdk85_io, AS_IO, 8, sdk85_state) |
| 32 | 100 | ADDRESS_MAP_UNMAP_HIGH |
| 33 | 101 | ADDRESS_MAP_END |
| 34 | 102 | |
| 35 | 103 | /* Input ports */ |
| 36 | 104 | static INPUT_PORTS_START( sdk85 ) |
| 105 | PORT_START("X0") |
| 106 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 107 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 108 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 109 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 110 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 111 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 112 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 113 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 114 | |
| 115 | PORT_START("X1") |
| 116 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 117 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 118 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 119 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 120 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 121 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 122 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 123 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 124 | |
| 125 | PORT_START("X2") |
| 126 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXEC") PORT_CODE(KEYCODE_Q) |
| 127 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NEXT") PORT_CODE(KEYCODE_W) |
| 128 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("GO") PORT_CODE(KEYCODE_R) |
| 129 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SUBST") PORT_CODE(KEYCODE_T) |
| 130 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("EXAM") PORT_CODE(KEYCODE_Y) |
| 131 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SINGLE") PORT_CODE(KEYCODE_U) |
| 132 | PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) |
| 37 | 133 | INPUT_PORTS_END |
| 38 | 134 | |
| 39 | 135 | |
| 40 | | static MACHINE_RESET(sdk85) |
| 136 | MACHINE_RESET_MEMBER( sdk85_state ) |
| 41 | 137 | { |
| 138 | m_digit = 15; |
| 139 | m_kbd_ready = FALSE; |
| 140 | m_kbd = 0xff; |
| 141 | m_keytemp = 0xfe; |
| 42 | 142 | } |
| 43 | 143 | |
| 44 | | static VIDEO_START( sdk85 ) |
| 144 | // This is an internal function of the 8279 chip |
| 145 | static TIMER_DEVICE_CALLBACK( sdk85_keyscan ) |
| 45 | 146 | { |
| 46 | | } |
| 147 | sdk85_state *state = timer.machine().driver_data<sdk85_state>(); |
| 148 | UINT8 keyscan, keytemp = 0xff,i; |
| 149 | keyscan = input_port_read(timer.machine(), "X0"); |
| 150 | if (keyscan < 0xff) |
| 151 | { |
| 152 | for (i = 0; i < 8; i++) |
| 153 | { |
| 154 | if (!BIT(keyscan, i)) |
| 155 | { |
| 156 | keytemp = i; |
| 157 | i = 9; |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | keyscan = input_port_read(timer.machine(), "X1"); |
| 164 | if (keyscan < 0xff) |
| 165 | { |
| 166 | for (i = 0; i < 8; i++) |
| 167 | { |
| 168 | if (!BIT(keyscan, i)) |
| 169 | { |
| 170 | keytemp = i+8; |
| 171 | i = 9; |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | else |
| 176 | { |
| 177 | keyscan = input_port_read(timer.machine(), "X2"); |
| 178 | if (keyscan < 0xff) |
| 179 | { |
| 180 | for (i = 0; i < 6; i++) |
| 181 | { |
| 182 | if (!BIT(keyscan, i)) |
| 183 | { |
| 184 | keytemp = i+16; |
| 185 | i = 9; |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
| 47 | 191 | |
| 48 | | static SCREEN_UPDATE( sdk85 ) |
| 49 | | { |
| 50 | | return 0; |
| 192 | device_t *cpu = timer.machine().device( "maincpu" ); |
| 193 | |
| 194 | if ((state->m_kbd == 0xff) && (keytemp < 0xff) && (keytemp != state->m_keytemp)) |
| 195 | { |
| 196 | state->m_kbd = keytemp; |
| 197 | state->m_keytemp = keytemp; |
| 198 | device_set_input_line(cpu, I8085_RST55_LINE, HOLD_LINE); |
| 199 | } |
| 200 | else |
| 201 | if (keytemp==0xff) |
| 202 | { |
| 203 | state->m_keytemp = 0xfe; |
| 204 | device_set_input_line(cpu, I8085_RST55_LINE, CLEAR_LINE); |
| 205 | } |
| 51 | 206 | } |
| 52 | 207 | |
| 208 | |
| 53 | 209 | static MACHINE_CONFIG_START( sdk85, sdk85_state ) |
| 54 | | /* basic machine hardware */ |
| 55 | | MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) |
| 56 | | MCFG_CPU_PROGRAM_MAP(sdk85_mem) |
| 57 | | MCFG_CPU_IO_MAP(sdk85_io) |
| 210 | /* basic machine hardware */ |
| 211 | MCFG_CPU_ADD("maincpu", I8085A, XTAL_2MHz) |
| 212 | MCFG_CPU_PROGRAM_MAP(sdk85_mem) |
| 213 | MCFG_CPU_IO_MAP(sdk85_io) |
| 58 | 214 | |
| 59 | | MCFG_MACHINE_RESET(sdk85) |
| 215 | /* video hardware */ |
| 216 | MCFG_DEFAULT_LAYOUT(layout_sdk85) |
| 60 | 217 | |
| 61 | | /* video hardware */ |
| 62 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 63 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 64 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 65 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 66 | | MCFG_SCREEN_SIZE(640, 480) |
| 67 | | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 68 | | MCFG_SCREEN_UPDATE(sdk85) |
| 69 | | |
| 70 | | MCFG_PALETTE_LENGTH(2) |
| 71 | | MCFG_PALETTE_INIT(black_and_white) |
| 72 | | |
| 73 | | MCFG_VIDEO_START(sdk85) |
| 218 | MCFG_TIMER_ADD_PERIODIC("keyscan", sdk85_keyscan, attotime::from_hz(15)) |
| 74 | 219 | MACHINE_CONFIG_END |
| 75 | 220 | |
| 76 | 221 | /* ROM definition */ |
| r12025 | r12026 | |
| 82 | 227 | /* Driver */ |
| 83 | 228 | |
| 84 | 229 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 85 | | COMP( 1977, sdk85, 0, 0, sdk85, sdk85, 0, "Intel", "SDK-85", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 230 | COMP( 1977, sdk85, 0, 0, sdk85, sdk85, 0, "Intel", "SDK-85", GAME_NO_SOUND_HW) |
| 86 | 231 | |