src/mess/video/tmc1800.c
| r2596 | r2597 | |
| 65 | 65 | {
|
| 66 | 66 | SCREEN_TAG,
|
| 67 | 67 | CDP1864_CLK_FREQ,
|
| 68 | CDP1864_INTERLACED,
|
| 68 | 69 | tmc2000_int_w,
|
| 69 | 70 | tmc2000_dmao_w,
|
| 70 | 71 | tmc2000_efx_w,
|
| 71 | | RES_K(2.2), // unverified
|
| 72 | | RES_K(1), // unverified
|
| 73 | | RES_K(5.1), // unverified
|
| 74 | | RES_K(4.7) // unverified
|
| 72 | RES_K(1.21), // RL64
|
| 73 | RES_K(2.05), // RL63
|
| 74 | RES_K(2.26), // RL61
|
| 75 | RES_K(3.92) // RL65 (also RH62 (2K pot) in series, but ignored here)
|
| 75 | 76 | };
|
| 76 | 77 | |
| 77 | 78 | static VIDEO_UPDATE( tmc2000 )
|
| r2596 | r2597 | |
| 125 | 126 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 126 | 127 | MDRV_SCREEN_RAW_PARAMS(CDP1864_CLK_FREQ, CDP1864_SCREEN_WIDTH, CDP1864_HBLANK_END, CDP1864_HBLANK_START, CDP1864_TOTAL_SCANLINES, CDP1864_SCANLINE_VBLANK_END, CDP1864_SCANLINE_VBLANK_START)
|
| 127 | 128 | |
| 128 | | MDRV_PALETTE_LENGTH(8)
|
| 129 | MDRV_PALETTE_LENGTH(8+8)
|
| 129 | 130 | MDRV_VIDEO_UPDATE(tmc2000)
|
| 130 | 131 | |
| 131 | 132 | MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
|
| r2596 | r2597 | |
| 137 | 138 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 138 | 139 | MDRV_SCREEN_RAW_PARAMS(CDP1864_CLK_FREQ, CDP1864_SCREEN_WIDTH, CDP1864_HBLANK_END, CDP1864_HBLANK_START, CDP1864_TOTAL_SCANLINES, CDP1864_SCANLINE_VBLANK_END, CDP1864_SCANLINE_VBLANK_START)
|
| 139 | 140 | |
| 140 | | MDRV_PALETTE_LENGTH(8)
|
| 141 | MDRV_PALETTE_LENGTH(8+8)
|
| 141 | 142 | MDRV_VIDEO_UPDATE(tmc2000)
|
| 142 | 143 | |
| 143 | 144 | MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
|
src/mess/video/cdp1864.c
| r2596 | r2597 | |
| 9 | 9 | |
| 10 | 10 | TODO: |
| 11 | 11 | |
| 12 | - interlace mode |
| 12 | 13 | - connect to sound system when possible |
| 13 | 14 | |
| 14 | 15 | */ |
| r2596 | r2597 | |
| 152 | 153 | } |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | | |
| 156 | 156 | /* Palette Initialization */ |
| 157 | 157 | |
| 158 | | static void cdp1864_init_palette(running_machine *machine, double res_r, double res_g, double res_b, double res_bkg) |
| 158 | static void cdp1864_init_palette(const device_config *device) |
| 159 | 159 | { |
| 160 | | int i, r, g, b, luma; |
| 160 | cdp1864_t *cdp1864 = get_safe_token(device); |
| 161 | int i; |
| 161 | 162 | |
| 162 | | double res_total = res_r + res_g + res_b; |
| 163 | double res_total = cdp1864->intf->res_r + cdp1864->intf->res_g + cdp1864->intf->res_b + cdp1864->intf->res_bkg; |
| 163 | 164 | |
| 164 | | int weight_r = (res_r / res_total) * 100; |
| 165 | | int weight_g = (res_g / res_total) * 100; |
| 166 | | int weight_b = (res_b / res_total) * 100; |
| 165 | int weight_r = (cdp1864->intf->res_r / res_total) * 100; |
| 166 | int weight_g = (cdp1864->intf->res_g / res_total) * 100; |
| 167 | int weight_b = (cdp1864->intf->res_b / res_total) * 100; |
| 168 | int weight_bkg = (cdp1864->intf->res_bkg / res_total) * 100; |
| 167 | 169 | |
| 168 | | for (i = 0; i < 8; i++) |
| 170 | for (i = 0; i < 16; i++) |
| 169 | 171 | { |
| 170 | | luma = (i & 4) ? weight_r : 0; |
| 172 | int r, g, b, luma = 0; |
| 173 | |
| 174 | luma += (i & 4) ? weight_r : 0; |
| 171 | 175 | luma += (i & 1) ? weight_g : 0; |
| 172 | 176 | luma += (i & 2) ? weight_b : 0; |
| 177 | luma += (i & 8) ? 0 : weight_bkg; |
| 173 | 178 | |
| 179 | luma = (luma * 0xff) / 100; |
| 180 | |
| 174 | 181 | r = (i & 4) ? luma : 0; |
| 175 | 182 | g = (i & 1) ? luma : 0; |
| 176 | 183 | b = (i & 2) ? luma : 0; |
| 177 | 184 | |
| 178 | | luma = (luma * 0xff) / 100; |
| 179 | | |
| 180 | | palette_set_color_rgb( machine, i, r, g, b ); |
| 185 | palette_set_color_rgb( device->machine, i, r, g, b ); |
| 181 | 186 | } |
| 182 | 187 | } |
| 183 | 188 | |
| r2596 | r2597 | |
| 253 | 258 | |
| 254 | 259 | for (x = 0; x < 8; x++) |
| 255 | 260 | { |
| 256 | | int color = CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor]; |
| 261 | int color = CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8; |
| 257 | 262 | |
| 258 | 263 | if (BIT(data, 7)) |
| 259 | 264 | { |
| r2596 | r2597 | |
| 322 | 327 | |
| 323 | 328 | if (cdp1864->disp) |
| 324 | 329 | { |
| 325 | | fillbitmap(bitmap, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor], cliprect); |
| 326 | | copybitmap_trans(bitmap, cdp1864->bitmap, 0, 0, 0, 0, cliprect, cdp1864->bgcolor); |
| 330 | copybitmap(bitmap, cdp1864->bitmap, 0, 0, 0, 0, cliprect); |
| 331 | fillbitmap(cdp1864->bitmap, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8, cliprect); |
| 327 | 332 | } |
| 328 | 333 | else |
| 329 | 334 | { |
| r2596 | r2597 | |
| 357 | 362 | |
| 358 | 363 | /* allocate the temporary bitmap */ |
| 359 | 364 | cdp1864->bitmap = auto_bitmap_alloc(video_screen_get_width(cdp1864->screen), video_screen_get_height(cdp1864->screen), video_screen_get_format(cdp1864->screen)); |
| 365 | fillbitmap(cdp1864->bitmap, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8, 0); |
| 360 | 366 | |
| 361 | 367 | /* initialize the palette */ |
| 362 | | cdp1864_init_palette(device->machine, cdp1864->intf->res_r, cdp1864->intf->res_g, cdp1864->intf->res_b, cdp1864->intf->res_bkg); |
| 368 | cdp1864_init_palette(device); |
| 363 | 369 | |
| 364 | 370 | /* create the timers */ |
| 365 | 371 | cdp1864->int_timer = timer_alloc(cdp1864_int_tick, (void *)device); |
src/mess/drivers/tmc1800.c
| r2596 | r2597 | |
| 87 | 87 | |
| 88 | 88 | /* Read/Write Handlers */ |
| 89 | 89 | |
| 90 | | static int keylatch; |
| 91 | | |
| 92 | 90 | static WRITE8_HANDLER( tmc1800_keylatch_w ) |
| 93 | 91 | { |
| 94 | | keylatch = data; |
| 92 | tmc1800_state *state = machine->driver_data; |
| 93 | |
| 94 | state->keylatch = data; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | static WRITE8_HANDLER( tmc2000_keylatch_w ) |
| r2596 | r2597 | |
| 111 | 111 | |
| 112 | 112 | */ |
| 113 | 113 | |
| 114 | | keylatch = data & 0x3f; |
| 114 | tmc2000_state *state = machine->driver_data; |
| 115 | |
| 116 | state->keylatch = data & 0x3f; |
| 115 | 117 | } |
| 116 | 118 | |
| 117 | 119 | static WRITE8_DEVICE_HANDLER( tmc2000_bankswitch_w ) |
| r2596 | r2597 | |
| 338 | 340 | |
| 339 | 341 | // keyboard |
| 340 | 342 | |
| 341 | | sprintf(port, "IN%d", keylatch / 8); |
| 342 | | if (~input_port_read(machine, port) & (1 << (keylatch % 8))) flags -= EF3; |
| 343 | sprintf(port, "IN%d", state->keylatch / 8); |
| 344 | if (~input_port_read(machine, port) & (1 << (state->keylatch % 8))) flags -= EF3; |
| 343 | 345 | |
| 344 | 346 | return flags; |
| 345 | 347 | } |
| r2596 | r2597 | |
| 418 | 420 | |
| 419 | 421 | // keyboard |
| 420 | 422 | |
| 421 | | sprintf(port, "IN%d", keylatch / 8); |
| 422 | | if (~input_port_read(machine, port) & (1 << (keylatch % 8))) flags -= EF3; |
| 423 | sprintf(port, "IN%d", state->keylatch / 8); |
| 424 | if (~input_port_read(machine, port) & (1 << (state->keylatch % 8))) flags -= EF3; |
| 423 | 425 | |
| 424 | 426 | return flags; |
| 425 | 427 | } |
| r2596 | r2597 | |
| 506 | 508 | |
| 507 | 509 | // keyboard |
| 508 | 510 | |
| 509 | | sprintf(port, "IN%d", keylatch / 8); |
| 510 | | if (~input_port_read(machine, port) & (1 << (keylatch % 8))) flags -= EF3; |
| 511 | sprintf(port, "IN%d", state->keylatch / 8); |
| 512 | if (~input_port_read(machine, port) & (1 << (state->keylatch % 8))) flags -= EF3; |
| 511 | 513 | |
| 512 | 514 | // monitor |
| 513 | 515 | |
| r2596 | r2597 | |
| 562 | 564 | |
| 563 | 565 | static MACHINE_START( tmc1800 ) |
| 564 | 566 | { |
| 565 | | state_save_register_global(keylatch); |
| 567 | tmc1800_state *state = machine->driver_data; |
| 568 | |
| 569 | state_save_register_global(state->keylatch); |
| 566 | 570 | } |
| 567 | 571 | |
| 568 | 572 | static MACHINE_RESET( tmc1800 ) |
| r2596 | r2597 | |
| 584 | 588 | |
| 585 | 589 | static MACHINE_START( tmc2000 ) |
| 586 | 590 | { |
| 587 | | state_save_register_global(keylatch); |
| 591 | tmc2000_state *state = machine->driver_data; |
| 592 | UINT16 addr; |
| 588 | 593 | |
| 594 | state_save_register_global(state->keylatch); |
| 595 | |
| 589 | 596 | // RAM banking |
| 590 | 597 | |
| 591 | 598 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + 0x8000, 0); |
| r2596 | r2597 | |
| 608 | 615 | break; |
| 609 | 616 | } |
| 610 | 617 | |
| 618 | for (addr = 0; addr < mess_ram_size; addr++) |
| 619 | { |
| 620 | mess_ram[addr] = mame_rand(machine) & 0xff; |
| 621 | } |
| 622 | |
| 611 | 623 | // ROM/ColorRAM banking |
| 612 | 624 | |
| 613 | 625 | colorram = auto_malloc(0x200); |
| r2596 | r2597 | |
| 616 | 628 | memory_configure_bank(2, 1, 1, &colorram, 0); |
| 617 | 629 | |
| 618 | 630 | memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x81ff, 0, 0x0e00, SMH_BANK2, SMH_UNMAP); |
| 631 | |
| 632 | for (addr = 0; addr < 0x200; addr++) |
| 633 | { |
| 634 | colorram[addr] = mame_rand(machine) & 0xff; |
| 635 | } |
| 619 | 636 | } |
| 620 | 637 | |
| 621 | 638 | static MACHINE_RESET( tmc2000 ) |
| r2596 | r2597 | |
| 633 | 650 | |
| 634 | 651 | static MACHINE_START( oscnano ) |
| 635 | 652 | { |
| 636 | | state_save_register_global(keylatch); |
| 653 | tmc2000_state *state = machine->driver_data; |
| 637 | 654 | |
| 655 | state_save_register_global(state->keylatch); |
| 656 | |
| 638 | 657 | // RAM banking |
| 639 | 658 | |
| 640 | 659 | memory_configure_bank(1, 0, 1, memory_region(REGION_CPU1) + 0x8000, 0); |
| r2596 | r2597 | |
| 758 | 777 | ROM_START( tmc2000 ) |
| 759 | 778 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 760 | 779 | ROM_SYSTEM_BIOS( 0, "default", "PROM N:o 200" ) |
| 761 | | ROMX_LOAD( "200.m5", 0x8000, 0x0200, BAD_DUMP CRC(6af8e362) SHA1(ebc11e110ec355defb0a4fcbd0063eb3ad4ba23b), ROM_BIOS(1) ) // typed in from the manual |
| 780 | ROMX_LOAD( "200.m5", 0x8000, 0x0200, BAD_DUMP CRC(79da3221) SHA1(008da3ef4f69ab1a493362dfca856375b19c94bd), ROM_BIOS(1) ) // typed in from the manual |
| 762 | 781 | ROM_SYSTEM_BIOS( 1, "prom202", "PROM N:o 202" ) |
| 763 | 782 | ROMX_LOAD( "202.m5", 0x8000, 0x0200, NO_DUMP, ROM_BIOS(2) ) |
| 764 | 783 | ROM_SYSTEM_BIOS( 2, "tool2000", "TOOL-2000" ) |