src/mess/machine/svi318.c
| r1826 | r1827 | |
| 11 | 11 | #include "driver.h" |
| 12 | 12 | #include "deprecat.h" |
| 13 | 13 | #include "mslegacy.h" |
| 14 | #include "video/mc6845.h" |
| 14 | 15 | #include "includes/svi318.h" |
| 15 | 16 | #include "cpu/z80/z80.h" |
| 16 | | #include "video/mc6845.h" |
| 17 | 17 | #include "video/tms9928a.h" |
| 18 | 18 | #include "machine/8255ppi.h" |
| 19 | 19 | #include "machine/uart8250.h" |
| r1826 | r1827 | |
| 60 | 60 | static SVI_318 svi; |
| 61 | 61 | static UINT8 *pcart; |
| 62 | 62 | static UINT32 pcart_rom_size; |
| 63 | static mc6845_t *mc6845; |
| 63 | 64 | |
| 64 | 65 | static void svi318_set_banks (void); |
| 65 | 66 | |
| r1826 | r1827 | |
| 429 | 430 | return INIT_PASS; |
| 430 | 431 | } |
| 431 | 432 | |
| 432 | | static MC6845_UPDATE_ROW( svi806_crtc6845_update_row ) |
| 433 | MC6845_UPDATE_ROW( svi806_crtc6845_update_row ) |
| 433 | 434 | { |
| 434 | 435 | int i; |
| 435 | 436 | |
| r1826 | r1827 | |
| 446 | 447 | } |
| 447 | 448 | } |
| 448 | 449 | |
| 449 | | static const mc6845_interface svi806_crtc6845_interface = { |
| 450 | | 1, |
| 451 | | 3579545 /*?*/, |
| 452 | | 8 /*?*/, |
| 453 | | NULL, |
| 454 | | svi806_crtc6845_update_row, |
| 455 | | NULL, |
| 456 | | NULL |
| 457 | | }; |
| 458 | | |
| 459 | 450 | static void svi806_set_crtc_register(UINT8 reg, UINT8 data) { |
| 460 | | crtc6845_0_address_w(0, reg); |
| 461 | | crtc6845_0_register_w(0, data); |
| 451 | mc6845_address_w(mc6845, reg); |
| 452 | mc6845_register_w(mc6845, data); |
| 462 | 453 | } |
| 463 | 454 | |
| 464 | | /* 80 column card init */ |
| 465 | | static void svi318_80col_init(void) |
| 466 | | { |
| 467 | | /* 2K RAM, but allocating 4KB to make banking easier */ |
| 468 | | /* The upper 2KB will be set to FFs and will never be written to */ |
| 469 | | svi.svi806_ram = new_memory_region( Machine, REGION_GFX2, 0x1000, 0 ); |
| 470 | | memset( svi.svi806_ram, 0x00, 0x800 ); |
| 471 | | memset( svi.svi806_ram + 0x800, 0xFF, 0x800 ); |
| 472 | | svi.svi806_gfx = memory_region(REGION_GFX1); |
| 473 | | /* initialise 6845 */ |
| 474 | | crtc6845_config( 0, &svi806_crtc6845_interface); |
| 455 | static TIMER_CALLBACK(svi318_80col_init_registers) { |
| 456 | cpuintrf_push_context( 0 ); |
| 475 | 457 | /* set some default values for the 6845 controller */ |
| 476 | 458 | svi806_set_crtc_register( 0, 109 ); |
| 477 | 459 | svi806_set_crtc_register( 1, 80 ); |
| r1826 | r1827 | |
| 489 | 471 | svi806_set_crtc_register( 13, 0 ); |
| 490 | 472 | svi806_set_crtc_register( 14, 0 ); |
| 491 | 473 | svi806_set_crtc_register( 15, 0 ); |
| 474 | cpuintrf_pop_context(); |
| 492 | 475 | } |
| 493 | 476 | |
| 477 | /* 80 column card init */ |
| 478 | static void svi318_80col_init(void) |
| 479 | { |
| 480 | /* 2K RAM, but allocating 4KB to make banking easier */ |
| 481 | /* The upper 2KB will be set to FFs and will never be written to */ |
| 482 | svi.svi806_ram = new_memory_region( Machine, REGION_GFX2, 0x1000, 0 ); |
| 483 | memset( svi.svi806_ram, 0x00, 0x800 ); |
| 484 | memset( svi.svi806_ram + 0x800, 0xFF, 0x800 ); |
| 485 | svi.svi806_gfx = memory_region(REGION_GFX1); |
| 486 | |
| 487 | timer_set( attotime_zero, NULL, 0, svi318_80col_init_registers ); |
| 488 | } |
| 489 | |
| 494 | 490 | READ8_HANDLER( svi806_r ) |
| 495 | 491 | { |
| 496 | | return crtc6845_0_register_r( offset ); |
| 492 | return mc6845_register_r( mc6845 ); |
| 497 | 493 | } |
| 498 | 494 | |
| 499 | 495 | WRITE8_HANDLER( svi806_w ) |
| 500 | 496 | { |
| 501 | 497 | switch( offset ) { |
| 502 | 498 | case 0: |
| 503 | | crtc6845_0_address_w( offset, data ); |
| 499 | mc6845_address_w( mc6845, data ); |
| 504 | 500 | break; |
| 505 | 501 | case 1: |
| 506 | | crtc6845_0_register_w( offset, data ); |
| 502 | mc6845_register_w( mc6845, data ); |
| 507 | 503 | break; |
| 508 | 504 | } |
| 509 | 505 | } |
| r1826 | r1827 | |
| 514 | 510 | svi318_set_banks(); |
| 515 | 511 | } |
| 516 | 512 | |
| 513 | VIDEO_START( svi328_806 ) { |
| 514 | VIDEO_START_CALL(tms9928a); |
| 515 | mc6845 = devtag_get_token(machine, MC6845, "crtc"); |
| 516 | } |
| 517 | |
| 517 | 518 | VIDEO_UPDATE( svi328_806 ) |
| 518 | 519 | { |
| 519 | 520 | if ( screen == 0 ) |
| 520 | 521 | VIDEO_UPDATE_CALL(tms9928a); |
| 521 | | if ( screen == 1 ) |
| 522 | | VIDEO_UPDATE_CALL(crtc6845); |
| 522 | if ( screen == 1 ) { |
| 523 | mc6845_update(mc6845, bitmap, cliprect); |
| 524 | } |
| 523 | 525 | return 0; |
| 524 | 526 | } |
| 525 | 527 | |
src/mess/drivers/svi318.c
| r1826 | r1827 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | #include "driver.h" |
| 13 | #include "video/mc6845.h" |
| 13 | 14 | #include "includes/svi318.h" |
| 14 | 15 | #include "video/tms9928a.h" |
| 15 | 16 | #include "machine/8255ppi.h" |
| r1826 | r1827 | |
| 352 | 353 | MDRV_MACHINE_RESET( svi318 ) |
| 353 | 354 | MACHINE_DRIVER_END |
| 354 | 355 | |
| 356 | static const mc6845_interface svi806_crtc6845_interface = { |
| 357 | 1, |
| 358 | 3579545 /*?*/, |
| 359 | 8 /*?*/, |
| 360 | NULL, |
| 361 | svi806_crtc6845_update_row, |
| 362 | NULL, |
| 363 | NULL, |
| 364 | NULL, |
| 365 | NULL |
| 366 | }; |
| 367 | |
| 355 | 368 | static MACHINE_DRIVER_START( svi328_806 ) |
| 356 | 369 | /* Basic machine hardware */ |
| 357 | 370 | MDRV_CPU_ADD_TAG( "main", Z80, 3579545 ) /* 3.579545 Mhz */ |
| r1826 | r1827 | |
| 379 | 392 | MDRV_SCREEN_SIZE(640, 400) |
| 380 | 393 | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 381 | 394 | |
| 395 | MDRV_DEVICE_ADD("crtc", MC6845) |
| 396 | MDRV_DEVICE_CONFIG( svi806_crtc6845_interface ) |
| 397 | |
| 398 | MDRV_VIDEO_START( svi328_806 ) |
| 382 | 399 | MDRV_VIDEO_UPDATE( svi328_806 ) |
| 383 | 400 | |
| 384 | 401 | /* Sound hardware */ |