src/mess/drivers/tvc.c
| r15134 | r15135 | |
| 5 | 5 | 12/05/2009 Skeleton driver. |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | | - cassette load/save |
| 8 | - centronics |
| 9 | - russian version has a different keyboard layout |
| 9 | 10 | - floppy interface |
| 10 | 11 | - expansion ports |
| 11 | 12 | |
| r15134 | r15135 | |
| 130 | 131 | -x-- ---- colour |
| 131 | 132 | --x- ---- cassette input |
| 132 | 133 | ---x ---- vblank or tone interrupt |
| 133 | | ---- xxxx expansions interrupt |
| 134 | ---- xxxx expansions interrupt (active low) |
| 134 | 135 | */ |
| 135 | 136 | |
| 136 | | return 0x40 | (m_flipflop << 4); |
| 137 | double level = m_cassette->input(); |
| 138 | |
| 139 | return 0x4f | (m_flipflop << 4) | (level > 0.01 ? 0x20 : 0x00); |
| 137 | 140 | } |
| 138 | 141 | |
| 139 | 142 | WRITE8_MEMBER(tvc_state::tvc_flipflop_w) |
| r15134 | r15135 | |
| 161 | 164 | { |
| 162 | 165 | case 1: |
| 163 | 166 | // bit 6-7 - cassette motors |
| 167 | m_cassette->change_state(BIT(data, 6) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 168 | //m_cassette2->change_state(BIT(data, 7) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); |
| 169 | m_cassette->output(m_cassette_ff ? +1 : -1); |
| 164 | 170 | break; |
| 165 | 171 | case 2: |
| 166 | 172 | // bit 0-1 - video mode |
| 173 | // bit 7 - centronics STROBE |
| 167 | 174 | m_video_mode = data & 0x03; |
| 168 | 175 | break; |
| 169 | 176 | } |
| r15134 | r15135 | |
| 172 | 179 | m_sound->write(space, offset, data); |
| 173 | 180 | } |
| 174 | 181 | |
| 182 | READ8_MEMBER(tvc_state::tvc_5b_r) |
| 183 | { |
| 184 | m_sound->reset_divider(); |
| 185 | return 0xff; |
| 186 | } |
| 175 | 187 | |
| 188 | WRITE8_MEMBER(tvc_state::tvc_cassette_w) |
| 189 | { |
| 190 | // writig here cause the toggle of the cassette flipflop |
| 191 | m_cassette_ff = !m_cassette_ff; |
| 192 | m_cassette->output(m_cassette_ff ? +1 : -1); |
| 193 | } |
| 194 | |
| 176 | 195 | static ADDRESS_MAP_START(tvc_mem, AS_PROGRAM, 8, tvc_state ) |
| 177 | 196 | AM_RANGE(0x0000, 0x3fff) AM_RAMBANK("bank1") |
| 178 | 197 | AM_RANGE(0x4000, 0x7fff) AM_RAMBANK("bank2") |
| r15134 | r15135 | |
| 188 | 207 | AM_RANGE(0x03, 0x03) AM_WRITE(tvc_keyboard_w) |
| 189 | 208 | AM_RANGE(0x04, 0x06) AM_WRITE(tvc_sound_w) |
| 190 | 209 | AM_RANGE(0x07, 0x07) AM_WRITE(tvc_flipflop_w) |
| 210 | AM_RANGE(0x50, 0x50) AM_WRITE(tvc_cassette_w) |
| 191 | 211 | AM_RANGE(0x58, 0x58) AM_READ(tvc_keyboard_r) |
| 192 | 212 | AM_RANGE(0x59, 0x59) AM_READ(tvc_int_state_r) |
| 193 | 213 | AM_RANGE(0x5a, 0x5a) AM_READ(tvc_exp_id_r) |
| 214 | AM_RANGE(0x5b, 0x5b) AM_READ(tvc_5b_r) |
| 194 | 215 | AM_RANGE(0x60, 0x63) AM_WRITE(tvc_palette_w) |
| 195 | 216 | AM_RANGE(0x70, 0x70) AM_DEVWRITE("crtc", mc6845_device, address_w) |
| 196 | 217 | AM_RANGE(0x71, 0x71) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) |
| r15134 | r15135 | |
| 204 | 225 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 205 | 226 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 206 | 227 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 207 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I'") PORT_CODE(KEYCODE_TILDE) |
| 228 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x8d") PORT_CODE(KEYCODE_1_PAD) |
| 208 | 229 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 209 | 230 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 210 | 231 | PORT_START("LINE1") |
| 211 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_TILDE) |
| 232 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_MINUS_PAD) |
| 212 | 233 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 213 | 234 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 214 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u''") PORT_CODE(KEYCODE_TILDE) |
| 215 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_TILDE) |
| 216 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O'") PORT_CODE(KEYCODE_TILDE) |
| 217 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O''") PORT_CODE(KEYCODE_TILDE) |
| 235 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xbc") PORT_CODE(KEYCODE_2_PAD) |
| 236 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) |
| 237 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb3") PORT_CODE(KEYCODE_3_PAD) |
| 238 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xb6") PORT_CODE(KEYCODE_4_PAD) |
| 218 | 239 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 219 | 240 | PORT_START("LINE2") |
| 220 | 241 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) |
| r15134 | r15135 | |
| 222 | 243 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) |
| 223 | 244 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) |
| 224 | 245 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) |
| 225 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_TILDE) |
| 246 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_HOME) |
| 226 | 247 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) |
| 227 | 248 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) |
| 228 | 249 | PORT_START("LINE3") |
| 229 | 250 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_CLOSEBRACE) |
| 230 | 251 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) |
| 231 | 252 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) |
| 232 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?") PORT_CODE(KEYCODE_SLASH) |
| 253 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\x91") PORT_CODE(KEYCODE_5_PAD) |
| 233 | 254 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE) |
| 234 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U'") PORT_CODE(KEYCODE_TILDE) |
| 255 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xba") PORT_CODE(KEYCODE_6_PAD) |
| 235 | 256 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) |
| 236 | 257 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) |
| 237 | 258 | PORT_START("LINE4") |
| r15134 | r15135 | |
| 240 | 261 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) |
| 241 | 262 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\\") PORT_CODE(KEYCODE_BACKSLASH) |
| 242 | 263 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) |
| 243 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_TILDE) |
| 264 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<") PORT_CODE(KEYCODE_END) |
| 244 | 265 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) |
| 245 | 266 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) |
| 246 | 267 | PORT_START("LINE5") |
| 247 | 268 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) |
| 248 | 269 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) |
| 249 | 270 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) |
| 250 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A'") PORT_CODE(KEYCODE_TILDE) |
| 271 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa1") PORT_CODE(KEYCODE_7_PAD) |
| 251 | 272 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) |
| 252 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("u''") PORT_CODE(KEYCODE_TILDE) |
| 253 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("e'") PORT_CODE(KEYCODE_TILDE) |
| 273 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc5\xb1") PORT_CODE(KEYCODE_8_PAD) |
| 274 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\xa9") PORT_CODE(KEYCODE_9_PAD) |
| 254 | 275 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) |
| 255 | 276 | PORT_START("LINE6") |
| 256 | 277 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) |
| r15134 | r15135 | |
| 268 | 289 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) |
| 269 | 290 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) |
| 270 | 291 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) |
| 271 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("=") PORT_CODE(KEYCODE_EQUALS) |
| 292 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) |
| 272 | 293 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) |
| 273 | 294 | PORT_START("LINE8") |
| 274 | 295 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Insert") PORT_CODE(KEYCODE_INSERT) |
| 275 | 296 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Up") PORT_CODE(KEYCODE_UP) |
| 276 | 297 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Down") PORT_CODE(KEYCODE_DOWN) |
| 277 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fire") PORT_CODE(KEYCODE_F1) |
| 278 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Acc") PORT_CODE(KEYCODE_F2) |
| 298 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Fire") PORT_CODE(KEYCODE_PGUP) |
| 299 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Acc") PORT_CODE(KEYCODE_PGDN) |
| 279 | 300 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 280 | 301 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 281 | 302 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| r15134 | r15135 | |
| 309 | 330 | memset(m_ram->pointer(), 0, m_ram->size()); |
| 310 | 331 | tvc_set_mem_page(0); |
| 311 | 332 | m_video_mode = 0; |
| 333 | m_cassette_ff = 1; |
| 312 | 334 | } |
| 313 | 335 | |
| 314 | 336 | static MC6845_UPDATE_ROW( tvc_update_row ) |
| r15134 | r15135 | |
| 402 | 424 | palette_set_color_rgb(machine, i, tvc_palette[i][0], tvc_palette[i][1], tvc_palette[i][2]); |
| 403 | 425 | } |
| 404 | 426 | |
| 427 | WRITE_LINE_MEMBER(tvc_state::tvc_int_ff_set) |
| 428 | { |
| 429 | if (state) |
| 430 | { |
| 431 | m_flipflop = 0; |
| 432 | device_set_input_line(m_maincpu, 0, ASSERT_LINE); |
| 433 | } |
| 434 | } |
| 435 | |
| 405 | 436 | static const mc6845_interface tvc_crtc6845_interface = |
| 406 | 437 | { |
| 407 | 438 | "screen", |
| r15134 | r15135 | |
| 410 | 441 | tvc_update_row, |
| 411 | 442 | NULL, |
| 412 | 443 | DEVCB_NULL, |
| 444 | DEVCB_DRIVER_LINE_MEMBER(tvc_state, tvc_int_ff_set), |
| 413 | 445 | DEVCB_NULL, |
| 414 | 446 | DEVCB_NULL, |
| 415 | | DEVCB_NULL, |
| 416 | 447 | NULL |
| 417 | 448 | }; |
| 418 | 449 | |
| 419 | | static INTERRUPT_GEN( tvc_interrupt ) |
| 450 | static const cassette_interface tvc_cassette_interface = |
| 420 | 451 | { |
| 421 | | tvc_state *state = device->machine().driver_data<tvc_state>(); |
| 422 | | state->m_flipflop = 0; |
| 423 | | device_set_input_line(device, 0, ASSERT_LINE); |
| 424 | | } |
| 452 | cassette_default_formats, |
| 453 | NULL, |
| 454 | (cassette_state)(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED), |
| 455 | "tvc_cass", |
| 456 | NULL |
| 457 | }; |
| 425 | 458 | |
| 459 | static tvc_sound_interface tvc_sound_intf = |
| 460 | { |
| 461 | DEVCB_DRIVER_LINE_MEMBER(tvc_state, tvc_int_ff_set), |
| 462 | }; |
| 463 | |
| 464 | |
| 426 | 465 | static MACHINE_CONFIG_START( tvc, tvc_state ) |
| 427 | 466 | /* basic machine hardware */ |
| 428 | 467 | MCFG_CPU_ADD("maincpu",Z80, 3125000) |
| 429 | 468 | MCFG_CPU_PROGRAM_MAP(tvc_mem) |
| 430 | 469 | MCFG_CPU_IO_MAP(tvc_io) |
| 431 | 470 | |
| 432 | | MCFG_CPU_VBLANK_INT("screen", tvc_interrupt) |
| 433 | | |
| 434 | 471 | /* video hardware */ |
| 435 | 472 | MCFG_SCREEN_ADD("screen", RASTER) |
| 436 | 473 | MCFG_SCREEN_REFRESH_RATE(50) |
| r15134 | r15135 | |
| 451 | 488 | /* sound hardware */ |
| 452 | 489 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 453 | 490 | MCFG_SOUND_ADD("custom", TVC_SOUND, 0) |
| 491 | MCFG_SOUND_CONFIG(tvc_sound_intf) |
| 454 | 492 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 455 | 493 | |
| 456 | 494 | /* cartridge */ |
| r15134 | r15135 | |
| 459 | 497 | MCFG_CARTSLOT_NOT_MANDATORY |
| 460 | 498 | MCFG_CARTSLOT_INTERFACE("tvc_cart") |
| 461 | 499 | |
| 500 | /* cassette */ |
| 501 | MCFG_CASSETTE_ADD( CASSETTE_TAG, tvc_cassette_interface ) |
| 502 | |
| 462 | 503 | /* Software lists */ |
| 463 | 504 | MCFG_SOFTWARE_LIST_ADD("cart_list", "tvc_cart") |
| 464 | 505 | MACHINE_CONFIG_END |