src/mess/drivers/smc777.c
| r8571 | r8572 | |
| 7 | 7 | TODO: |
| 8 | 8 | - no documentation, the entire driver is just a bunch of educated |
| 9 | 9 | guesses ... |
| 10 | | - video emulation is just hacked up together to show something simple, |
| 11 | | dunno yet how it really works. |
| 12 | 10 | - BEEP pitch is horrible |
| 11 | - 1dd disk support |
| 13 | 12 | |
| 14 | 13 | ****************************************************************************/ |
| 15 | 14 | |
| r8571 | r8572 | |
| 23 | 22 | #include "formats/basicdsk.h" |
| 24 | 23 | #include "devices/flopdrv.h" |
| 25 | 24 | |
| 26 | | static UINT16 cursor_addr; |
| 25 | static UINT16 cursor_addr,cursor_raster; |
| 27 | 26 | static UINT8 keyb_press,keyb_press_flag; |
| 28 | 27 | static UINT8 backdrop_pen; |
| 29 | 28 | |
| r8571 | r8572 | |
| 76 | 75 | { |
| 77 | 76 | int tile = vram[count]; |
| 78 | 77 | int color = attr[count] & 7; |
| 78 | int bk_color = (attr[count] & 0x18) >> 3; |
| 79 | int yb,xb,bk_pen; |
| 79 | 80 | |
| 81 | bk_pen = 0x00; |
| 82 | switch(bk_color) |
| 83 | { |
| 84 | case 1: bk_pen = 0x07; break; //white |
| 85 | case 2: bk_pen = 0x00; break; //black |
| 86 | case 3: bk_pen = (color ^ 7)+0x08; break; //complementary |
| 87 | } |
| 88 | |
| 89 | if(bk_color) |
| 90 | for(yb=0;yb<8;yb++) |
| 91 | for(xb=0;xb<8;xb++) |
| 92 | *BITMAP_ADDR16(bitmap, y*8+CRTC_MIN_Y+yb, x*8+CRTC_MIN_X+xb) = screen->machine->pens[bk_pen+0x10]; |
| 93 | |
| 94 | /*TODO: make this custom code*/ |
| 80 | 95 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0); |
| 81 | 96 | |
| 82 | | if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor |
| 83 | | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0); |
| 97 | // draw cursor |
| 98 | if(cursor_addr == count) |
| 99 | { |
| 100 | int xc,yc,cursor_on; |
| 84 | 101 | |
| 102 | cursor_on = 0; |
| 103 | switch(cursor_raster & 0x60) |
| 104 | { |
| 105 | case 0x00: cursor_on = 1; break; //always on |
| 106 | case 0x20: cursor_on = 0; break; //always off |
| 107 | case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink |
| 108 | case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink |
| 109 | } |
| 110 | |
| 111 | if(cursor_on) |
| 112 | { |
| 113 | for(yc=0;yc<(8-(cursor_raster & 7));yc++) |
| 114 | { |
| 115 | for(xc=0;xc<8;xc++) |
| 116 | { |
| 117 | *BITMAP_ADDR16(bitmap, y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = screen->machine->pens[0x17]; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 85 | 123 | count++; //TODO: width 40 uses count += 2 |
| 86 | 124 | } |
| 87 | 125 | } |
| r8571 | r8572 | |
| 101 | 139 | else |
| 102 | 140 | { |
| 103 | 141 | /* FIXME: this should be inside the MC6845 core! */ |
| 104 | | if(addr_latch == 0x0e) |
| 142 | if(addr_latch == 0x0a) |
| 143 | cursor_raster = data; |
| 144 | else if(addr_latch == 0x0e) |
| 105 | 145 | cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff); |
| 106 | 146 | else if(addr_latch == 0x0f) |
| 107 | 147 | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff); |
| r8571 | r8572 | |
| 264 | 304 | rom[offset] = data; |
| 265 | 305 | } |
| 266 | 306 | |
| 267 | | #define keyb_press(_val_,_charset_) \ |
| 268 | | if(input_code_pressed(space->machine, _val_)) \ |
| 269 | | return _charset_ \ |
| 270 | 307 | |
| 271 | 308 | static READ8_HANDLER( key_r ) |
| 272 | 309 | { |
| r8571 | r8572 | |
| 344 | 381 | // AM_RANGE(0x21, 0x21) AM_WRITENOP //60 Hz irq control |
| 345 | 382 | // AM_RANGE(0x22, 0x22) AM_WRITENOP //printer output data |
| 346 | 383 | AM_RANGE(0x23, 0x23) AM_WRITE(border_col_w) //border area control |
| 347 | | // AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC?) |
| 348 | | // AM_RANGE(0x25, 0x25) AM_READNOP //Timer read (RTC?) |
| 384 | // AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC) |
| 385 | // AM_RANGE(0x25, 0x25) AM_READNOP //Timer read (RTC) |
| 349 | 386 | // AM_RANGE(0x26, 0x26) AM_WRITENOP //RS232C RX / TX |
| 350 | 387 | // AM_RANGE(0x27, 0x27) AM_WRITENOP //RS232C Mode / Command / Status |
| 351 | 388 | |
| r8571 | r8572 | |
| 388 | 425 | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr |
| 389 | 426 | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so |
| 390 | 427 | |
| 428 | #if 0 |
| 429 | |
| 430 | #endif |
| 391 | 431 | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si |
| 392 | 432 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle |
| 393 | 433 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 |
| 394 | 434 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 |
| 395 | | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x14 dc3 |
| 435 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) |
| 396 | 436 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 |
| 397 | | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x16 nak |
| 437 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) |
| 398 | 438 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn |
| 399 | 439 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb |
| 400 | | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x19 cancel |
| 440 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) |
| 401 | 441 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em |
| 402 | 442 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) |
| 403 | 443 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c ??? |
| r8571 | r8572 | |
| 552 | 592 | NULL /* update address callback */ |
| 553 | 593 | }; |
| 554 | 594 | |
| 555 | | #if 0 |
| 556 | | static const rgb_t defcolors[]= |
| 557 | | { |
| 558 | | MAKE_RGB(0x00,0x00,0x00), |
| 559 | | MAKE_RGB(0x00,0x00,0xff), |
| 560 | | MAKE_RGB(0x00,0xff,0x00), |
| 561 | | MAKE_RGB(0x00,0xff,0xff), |
| 562 | | MAKE_RGB(0xff,0x00,0x00), |
| 563 | | MAKE_RGB(0xff,0x00,0xff), |
| 564 | | MAKE_RGB(0xff,0xff,0x00), |
| 565 | | MAKE_RGB(0xff,0xff,0xff), |
| 566 | | /* TODO: values extracted from WinSMC emulator, almost certainly not 100% accurate */ |
| 567 | | MAKE_RGB(0x10,0x40,0x10), //dark green |
| 568 | | MAKE_RGB(0x10,0x70,0x20), //moss green |
| 569 | | MAKE_RGB(0xd0,0x50,0x20), //salmon |
| 570 | | MAKE_RGB(0xe0,0x90,0x20), //tan |
| 571 | | MAKE_RGB(0x10,0x50,0x80), //ash blue |
| 572 | | MAKE_RGB(0x10,0x90,0xe0), //light blue |
| 573 | | MAKE_RGB(0xf0,0x70,0x90), //pink |
| 574 | | MAKE_RGB(0x80,0x80,0x80) //gray |
| 575 | | }; |
| 576 | | #endif |
| 577 | | |
| 578 | 595 | static PALETTE_INIT( smc777 ) |
| 579 | 596 | { |
| 580 | 597 | int i; |
| r8571 | r8572 | |
| 585 | 602 | |
| 586 | 603 | if((i & 0x01) == 0x01) |
| 587 | 604 | { |
| 588 | | r = ((i >> 2) & 1) ? 0xff : 0x00; |
| 589 | | g = ((i >> 3) & 1) ? 0xff : 0x00; |
| 605 | r = ((i >> 3) & 1) ? 0xff : 0x00; |
| 606 | g = ((i >> 2) & 1) ? 0xff : 0x00; |
| 590 | 607 | b = ((i >> 1) & 1) ? 0xff : 0x00; |
| 591 | 608 | } |
| 592 | 609 | else { r = g = b = 0x00; } |
| 593 | 610 | |
| 594 | 611 | palette_set_color_rgb(machine, i, r,g,b); |
| 595 | 612 | } |
| 596 | | |
| 597 | | // for(i=0;i<0x10;i++) |
| 598 | | // palette_set_color(machine, 0x10+i,defcolors[i]); |
| 599 | 613 | } |
| 600 | 614 | |
| 601 | 615 | static const wd17xx_interface smc777_mb8876_interface = |
| r8571 | r8572 | |
| 613 | 627 | SECTORS([16]) |
| 614 | 628 | SECTOR_LENGTH([256]) |
| 615 | 629 | FIRST_SECTOR_ID([1])) |
| 630 | /* TODO */ |
| 631 | FLOPPY_OPTION( img, "1dd", "SMC777 disk image", basicdsk_identify_default, basicdsk_construct_default, |
| 632 | HEADS([2]) |
| 633 | TRACKS([64]) |
| 634 | SECTORS([16]) |
| 635 | SECTOR_LENGTH([128]) |
| 636 | FIRST_SECTOR_ID([1])) |
| 616 | 637 | FLOPPY_OPTIONS_END |
| 617 | 638 | |
| 618 | 639 | static const floppy_config smc777_floppy_config = |