src/mess/drivers/smc777.c
| r8570 | r8571 | |
| 9 | 9 | guesses ... |
| 10 | 10 | - video emulation is just hacked up together to show something simple, |
| 11 | 11 | dunno yet how it really works. |
| 12 | | - Drop M6845 support and write custom code in place of it. |
| 12 | - BEEP pitch is horrible |
| 13 | 13 | |
| 14 | 14 | ****************************************************************************/ |
| 15 | 15 | |
| 16 | 16 | #include "emu.h" |
| 17 | 17 | #include "cpu/z80/z80.h" |
| 18 | 18 | #include "sound/sn76496.h" |
| 19 | #include "sound/beep.h" |
| 19 | 20 | #include "video/mc6845.h" |
| 20 | 21 | |
| 21 | 22 | #include "machine/wd17xx.h" |
| r8570 | r8571 | |
| 48 | 49 | { |
| 49 | 50 | for(y=0;y<200;y+=8) |
| 50 | 51 | { |
| 51 | | for(x=0;x<640;x+=4) |
| 52 | for(x=0;x<160;x++) |
| 52 | 53 | { |
| 53 | 54 | static UINT16 color; |
| 54 | 55 | |
| 55 | 56 | color = (gram[count] & 0xf0) >> 4; |
| 56 | | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+0+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 57 | | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+1+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 57 | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 58 | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 58 | 59 | |
| 59 | 60 | color = (gram[count] & 0x0f) >> 0; |
| 60 | | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+2+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 61 | | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x+3+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 61 | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 62 | *BITMAP_ADDR16(bitmap, y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = screen->machine->pens[color+0x10]; |
| 62 | 63 | |
| 63 | 64 | count++; |
| 65 | |
| 64 | 66 | } |
| 65 | 67 | } |
| 66 | | // count+= 48; |
| 67 | | |
| 68 | count+= 0x60; |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | count = 0x0000; |
| r8570 | r8571 | |
| 286 | 287 | backdrop_pen = data & 0xf; |
| 287 | 288 | } |
| 288 | 289 | |
| 290 | static UINT8 system_data; |
| 289 | 291 | |
| 292 | static READ8_HANDLER( system_input_r ) |
| 293 | { |
| 294 | return system_data; |
| 295 | } |
| 296 | |
| 297 | static WRITE8_HANDLER( system_output_w ) |
| 298 | { |
| 299 | /* |
| 300 | ---x --- beep |
| 301 | all the rest is unknown at current time |
| 302 | */ |
| 303 | system_data = data; |
| 304 | beep_set_state(space->machine->device("beeper"),data & 0x10); |
| 305 | } |
| 306 | |
| 307 | static READ8_HANDLER( unk_r ) |
| 308 | { |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | static WRITE8_HANDLER( smc777_ramdac_w ) |
| 313 | { |
| 314 | static UINT8 pal_index,gradient_index,r,g,b; |
| 315 | pal_index = cpu_get_reg(space->machine->device("maincpu"), Z80_B) & 0xf; |
| 316 | gradient_index = (cpu_get_reg(space->machine->device("maincpu"), Z80_B) & 0x30) >> 4; |
| 317 | |
| 318 | switch(gradient_index) |
| 319 | { |
| 320 | case 0: r = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break; |
| 321 | case 1: g = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break; |
| 322 | case 2: b = data; palette_set_color_rgb(space->machine, pal_index+0x10, r,g,b); break; |
| 323 | } |
| 324 | } |
| 325 | |
| 290 | 326 | static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 291 | 327 | ADDRESS_MAP_UNMAP_HIGH |
| 292 | 328 | AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITE(smc777_rom_w) |
| r8570 | r8571 | |
| 301 | 337 | AM_RANGE(0x10, 0x17) AM_READWRITE(smc777_pcg_r, smc777_pcg_w) |
| 302 | 338 | AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w) |
| 303 | 339 | AM_RANGE(0x1a, 0x1b) AM_READ(key_r) AM_WRITENOP//keyboard data |
| 304 | | // AM_RANGE(0x1c, 0x1c) AM_WRITENOP //status and control data / Printer strobe |
| 340 | AM_RANGE(0x1c, 0x1c) AM_READWRITE(system_input_r,system_output_w) //status and control data / Printer strobe |
| 305 | 341 | // AM_RANGE(0x1d, 0x1d) AM_WRITENOP //status and control data / Printer status / strobe |
| 306 | 342 | // AM_RANGE(0x1e, 0x1f) AM_WRITENOP //RS232C irq control |
| 307 | 343 | // AM_RANGE(0x20, 0x20) AM_WRITENOP //display mode switching |
| r8570 | r8571 | |
| 321 | 357 | // AM_RANGE(0x3c, 0x3d) AM_NOP //RGB Superimposer |
| 322 | 358 | // AM_RANGE(0x40, 0x47) AM_NOP //IEEE-488 interface unit |
| 323 | 359 | // AM_RANGE(0x48, 0x50) AM_NOP //HDD (Winchester) |
| 360 | AM_RANGE(0x51, 0x51) AM_READ(unk_r) |
| 361 | AM_RANGE(0x52, 0x52) AM_WRITE(smc777_ramdac_w) |
| 324 | 362 | // AM_RANGE(0x54, 0x59) AM_NOP //VTR Controller |
| 325 | 363 | AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn1", sn76496_w) //not in the datasheet ... almost certainly SMC-777 specific |
| 326 | 364 | // AM_RANGE(0x5a, 0x5b) AM_WRITENOP //RAM banking |
| r8570 | r8571 | |
| 477 | 515 | static MACHINE_START(smc777) |
| 478 | 516 | { |
| 479 | 517 | timer_pulse(machine, ATTOTIME_IN_HZ(240/32), NULL, 0, keyboard_callback); |
| 518 | beep_set_frequency(machine->device("beeper"),300); //guesswork |
| 519 | beep_set_state(machine->device("beeper"),0); |
| 480 | 520 | } |
| 481 | 521 | |
| 482 | 522 | static MACHINE_RESET(smc777) |
| r8570 | r8571 | |
| 512 | 552 | NULL /* update address callback */ |
| 513 | 553 | }; |
| 514 | 554 | |
| 555 | #if 0 |
| 515 | 556 | static const rgb_t defcolors[]= |
| 516 | 557 | { |
| 517 | 558 | MAKE_RGB(0x00,0x00,0x00), |
| r8570 | r8571 | |
| 532 | 573 | MAKE_RGB(0xf0,0x70,0x90), //pink |
| 533 | 574 | MAKE_RGB(0x80,0x80,0x80) //gray |
| 534 | 575 | }; |
| 576 | #endif |
| 535 | 577 | |
| 536 | 578 | static PALETTE_INIT( smc777 ) |
| 537 | 579 | { |
| r8570 | r8571 | |
| 552 | 594 | palette_set_color_rgb(machine, i, r,g,b); |
| 553 | 595 | } |
| 554 | 596 | |
| 555 | | for(i=0;i<0x10;i++) |
| 556 | | palette_set_color(machine, 0x10+i,defcolors[i]); |
| 597 | // for(i=0;i<0x10;i++) |
| 598 | // palette_set_color(machine, 0x10+i,defcolors[i]); |
| 557 | 599 | } |
| 558 | 600 | |
| 559 | 601 | static const wd17xx_interface smc777_mb8876_interface = |
| r8570 | r8571 | |
| 618 | 660 | |
| 619 | 661 | MDRV_SOUND_ADD("sn1", SN76489A, 1996800) // unknown clock / divider |
| 620 | 662 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 663 | |
| 664 | MDRV_SOUND_ADD("beeper", BEEP, 0) |
| 665 | MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50) |
| 621 | 666 | MACHINE_DRIVER_END |
| 622 | 667 | |
| 623 | 668 | /* ROM definition */ |
| r8570 | r8571 | |
| 637 | 682 | /* Driver */ |
| 638 | 683 | |
| 639 | 684 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 640 | | COMP( 1983, smc777, 0, 0, smc777, smc777, 0, "Sony", "SMC-777", GAME_NOT_WORKING | GAME_NO_SOUND) |
| 685 | COMP( 1983, smc777, 0, 0, smc777, smc777, 0, "Sony", "SMC-777", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND) |
| 641 | 686 | |