src/mess/drivers/smc777.c
| r8568 | r8569 | |
| 23 | 23 | #include "devices/flopdrv.h" |
| 24 | 24 | |
| 25 | 25 | static UINT16 cursor_addr; |
| 26 | static UINT8 keyb_press,keyb_press_flag; |
| 27 | static UINT8 backdrop_pen; |
| 26 | 28 | |
| 29 | #define CRTC_MIN_X 10 |
| 30 | #define CRTC_MIN_Y 10 |
| 31 | |
| 27 | 32 | static VIDEO_START( smc777 ) |
| 28 | 33 | { |
| 29 | 34 | } |
| 30 | 35 | |
| 31 | 36 | static VIDEO_UPDATE( smc777 ) |
| 32 | 37 | { |
| 33 | | int x,y,count; |
| 38 | int x,y,yi; |
| 39 | UINT16 count; |
| 34 | 40 | static UINT8 *vram = memory_region(screen->machine, "vram"); |
| 35 | 41 | static UINT8 *attr = memory_region(screen->machine, "attr"); |
| 42 | static UINT8 *gram = memory_region(screen->machine, "fbuf"); |
| 36 | 43 | |
| 44 | bitmap_fill(bitmap, cliprect, screen->machine->pens[backdrop_pen+0x10]); |
| 45 | |
| 37 | 46 | count = 0x0000; |
| 47 | for(yi=0;yi<8;yi++) |
| 48 | { |
| 49 | for(y=0;y<200;y+=8) |
| 50 | { |
| 51 | for(x=0;x<640;x+=4) |
| 52 | { |
| 53 | static UINT16 color; |
| 38 | 54 | |
| 55 | 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]; |
| 58 | |
| 59 | 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]; |
| 62 | |
| 63 | count++; |
| 64 | } |
| 65 | } |
| 66 | // count+= 48; |
| 67 | |
| 68 | } |
| 69 | |
| 70 | count = 0x0000; |
| 71 | |
| 39 | 72 | for(y=0;y<25;y++) |
| 40 | 73 | { |
| 41 | 74 | for(x=0;x<80;x++) |
| r8568 | r8569 | |
| 43 | 76 | int tile = vram[count]; |
| 44 | 77 | int color = attr[count] & 7; |
| 45 | 78 | |
| 46 | | drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8); |
| 79 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0); |
| 47 | 80 | |
| 48 | 81 | if(((cursor_addr) == count) && screen->machine->primary_screen->frame_number() & 0x10) // draw cursor |
| 49 | | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8,y*8,0); |
| 82 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x87,7,0,0,x*8+CRTC_MIN_X,y*8+CRTC_MIN_Y,0); |
| 50 | 83 | |
| 51 | 84 | count++; //TODO: width 40 uses count += 2 |
| 52 | 85 | } |
| r8568 | r8569 | |
| 55 | 88 | return 0; |
| 56 | 89 | } |
| 57 | 90 | |
| 58 | | static READ8_HANDLER( test_r ) |
| 59 | | { |
| 60 | | return mame_rand(space->machine); |
| 61 | | } |
| 62 | | |
| 63 | 91 | static WRITE8_HANDLER( smc777_6845_w ) |
| 64 | 92 | { |
| 65 | 93 | static int addr_latch; |
| r8568 | r8569 | |
| 67 | 95 | if(offset == 0) |
| 68 | 96 | { |
| 69 | 97 | addr_latch = data; |
| 70 | | mc6845_address_w(space->machine->device("crtc"), 0,data); |
| 98 | //mc6845_address_w(space->machine->device("crtc"), 0,data); |
| 71 | 99 | } |
| 72 | 100 | else |
| 73 | 101 | { |
| r8568 | r8569 | |
| 77 | 105 | else if(addr_latch == 0x0f) |
| 78 | 106 | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff); |
| 79 | 107 | |
| 80 | | mc6845_register_w(space->machine->device("crtc"), 0,data); |
| 108 | //mc6845_register_w(space->machine->device("crtc"), 0,data); |
| 81 | 109 | } |
| 82 | 110 | } |
| 83 | 111 | |
| r8568 | r8569 | |
| 235 | 263 | rom[offset] = data; |
| 236 | 264 | } |
| 237 | 265 | |
| 266 | #define keyb_press(_val_,_charset_) \ |
| 267 | if(input_code_pressed(space->machine, _val_)) \ |
| 268 | return _charset_ \ |
| 269 | |
| 270 | static READ8_HANDLER( key_r ) |
| 271 | { |
| 272 | static UINT8 res; |
| 273 | |
| 274 | if(offset == 1) //keyboard status |
| 275 | return (0xfc) | keyb_press_flag; |
| 276 | |
| 277 | keyb_press_flag = 0; |
| 278 | res = keyb_press; |
| 279 | // keyb_press = 0xff; |
| 280 | |
| 281 | return res; |
| 282 | } |
| 283 | |
| 284 | static WRITE8_HANDLER( border_col_w ) |
| 285 | { |
| 286 | backdrop_pen = data & 0xf; |
| 287 | } |
| 288 | |
| 289 | |
| 238 | 290 | static ADDRESS_MAP_START(smc777_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 239 | 291 | ADDRESS_MAP_UNMAP_HIGH |
| 240 | 292 | AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITE(smc777_rom_w) |
| r8568 | r8569 | |
| 248 | 300 | AM_RANGE(0x08, 0x0f) AM_READWRITE(smc777_attr_r,smc777_attr_w) |
| 249 | 301 | AM_RANGE(0x10, 0x17) AM_READWRITE(smc777_pcg_r, smc777_pcg_w) |
| 250 | 302 | AM_RANGE(0x18, 0x19) AM_WRITE(smc777_6845_w) |
| 251 | | AM_RANGE(0x1a, 0x1b) AM_READ(test_r) AM_WRITENOP//keyboard data |
| 303 | AM_RANGE(0x1a, 0x1b) AM_READ(key_r) AM_WRITENOP//keyboard data |
| 252 | 304 | // AM_RANGE(0x1c, 0x1c) AM_WRITENOP //status and control data / Printer strobe |
| 253 | 305 | // AM_RANGE(0x1d, 0x1d) AM_WRITENOP //status and control data / Printer status / strobe |
| 254 | 306 | // AM_RANGE(0x1e, 0x1f) AM_WRITENOP //RS232C irq control |
| 255 | 307 | // AM_RANGE(0x20, 0x20) AM_WRITENOP //display mode switching |
| 256 | 308 | // AM_RANGE(0x21, 0x21) AM_WRITENOP //60 Hz irq control |
| 257 | 309 | // AM_RANGE(0x22, 0x22) AM_WRITENOP //printer output data |
| 258 | | // AM_RANGE(0x23, 0x23) AM_WRITENOP //border area control |
| 310 | AM_RANGE(0x23, 0x23) AM_WRITE(border_col_w) //border area control |
| 259 | 311 | // AM_RANGE(0x24, 0x24) AM_WRITENOP //Timer write / specify address (RTC?) |
| 260 | 312 | // AM_RANGE(0x25, 0x25) AM_READNOP //Timer read (RTC?) |
| 261 | 313 | // AM_RANGE(0x26, 0x26) AM_WRITENOP //RS232C RX / TX |
| r8568 | r8569 | |
| 280 | 332 | |
| 281 | 333 | /* Input ports */ |
| 282 | 334 | static INPUT_PORTS_START( smc777 ) |
| 335 | PORT_START("key1") //0x00-0x1f |
| 336 | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null |
| 337 | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh |
| 338 | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x02 stx |
| 339 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x03 etx |
| 340 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x04 etx |
| 341 | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x05 eot |
| 342 | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x06 enq |
| 343 | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x07 ack |
| 344 | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) |
| 345 | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Tab") PORT_CODE(KEYCODE_TAB) PORT_CHAR(9) |
| 346 | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0a |
| 347 | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0b lf |
| 348 | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0c vt |
| 349 | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(27) |
| 350 | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0e cr |
| 351 | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x0f so |
| 352 | |
| 353 | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x10 si |
| 354 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x11 dle |
| 355 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x12 dc1 |
| 356 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x13 dc2 |
| 357 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x14 dc3 |
| 358 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x15 dc4 |
| 359 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x16 nak |
| 360 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x17 syn |
| 361 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x18 etb |
| 362 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x19 cancel |
| 363 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1a em |
| 364 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("ESC") PORT_CHAR(27) |
| 365 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1c ??? |
| 366 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1d fs |
| 367 | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1e gs |
| 368 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x1f us |
| 369 | |
| 370 | PORT_START("key2") //0x20-0x3f |
| 371 | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 372 | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x21 ! |
| 373 | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_UNUSED) //0x22 " |
| 374 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_UNUSED) //0x23 # |
| 375 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_UNUSED) //0x24 $ |
| 376 | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_UNUSED) //0x25 % |
| 377 | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_UNUSED) //0x26 & |
| 378 | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' |
| 379 | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( |
| 380 | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) |
| 381 | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * |
| 382 | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2b + |
| 383 | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , |
| 384 | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| 385 | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2e . |
| 386 | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2f / |
| 387 | |
| 388 | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 389 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') |
| 390 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') |
| 391 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 392 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 393 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 394 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 395 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 396 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 397 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 398 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') |
| 399 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME(";") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') |
| 400 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3c < |
| 401 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3d = |
| 402 | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3e > |
| 403 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x3f ? |
| 404 | |
| 405 | PORT_START("key3") //0x40-0x5f |
| 406 | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("@") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 407 | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 408 | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 409 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 410 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 411 | PORT_BIT(0x00000020,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 412 | PORT_BIT(0x00000040,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 413 | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 414 | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 415 | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 416 | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 417 | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 418 | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 419 | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 420 | PORT_BIT(0x00004000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 421 | PORT_BIT(0x00008000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 422 | PORT_BIT(0x00010000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 423 | PORT_BIT(0x00020000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 424 | PORT_BIT(0x00040000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 425 | PORT_BIT(0x00080000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 426 | PORT_BIT(0x00100000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 427 | PORT_BIT(0x00200000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 428 | PORT_BIT(0x00400000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 429 | PORT_BIT(0x00800000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 430 | PORT_BIT(0x01000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 431 | PORT_BIT(0x02000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 432 | PORT_BIT(0x04000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 433 | PORT_BIT(0x08000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("[") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('[') |
| 434 | PORT_BIT(0x10000000,IP_ACTIVE_HIGH,IPT_UNUSED) |
| 435 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 436 | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') |
| 437 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") |
| 283 | 438 | INPUT_PORTS_END |
| 284 | 439 | |
| 440 | static TIMER_CALLBACK( keyboard_callback ) |
| 441 | { |
| 442 | const char* portnames[3] = { "key1","key2","key3" }; |
| 443 | int i,port_i,scancode; |
| 444 | //UINT8 keymod = input_port_read(machine,"key_modifiers") & 0x1f; |
| 445 | scancode = 0; |
| 285 | 446 | |
| 447 | for(port_i=0;port_i<3;port_i++) |
| 448 | { |
| 449 | for(i=0;i<32;i++) |
| 450 | { |
| 451 | if((input_port_read(machine,portnames[port_i])>>i) & 1) |
| 452 | { |
| 453 | //key_flag = 1; |
| 454 | // if(keymod & 0x02) // shift not pressed |
| 455 | // { |
| 456 | // if(scancode >= 0x41 && scancode < 0x5a) |
| 457 | // scancode += 0x20; // lowercase |
| 458 | // } |
| 459 | // else |
| 460 | // { |
| 461 | // if(scancode >= 0x31 && scancode < 0x3a) |
| 462 | // scancode -= 0x10; |
| 463 | // if(scancode == 0x30) |
| 464 | // { |
| 465 | // scancode = 0x3d; |
| 466 | // } |
| 467 | // } |
| 468 | keyb_press = scancode; |
| 469 | keyb_press_flag = 1; |
| 470 | return; |
| 471 | } |
| 472 | scancode++; |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | static MACHINE_START(smc777) |
| 478 | { |
| 479 | timer_pulse(machine, ATTOTIME_IN_HZ(240/32), NULL, 0, keyboard_callback); |
| 480 | } |
| 481 | |
| 286 | 482 | static MACHINE_RESET(smc777) |
| 287 | 483 | { |
| 288 | 484 | } |
| 289 | 485 | |
| 290 | | |
| 291 | 486 | static const gfx_layout smc777_charlayout = |
| 292 | 487 | { |
| 293 | 488 | 8, 8, |
| r8568 | r8569 | |
| 317 | 512 | NULL /* update address callback */ |
| 318 | 513 | }; |
| 319 | 514 | |
| 515 | static const rgb_t defcolors[]= |
| 516 | { |
| 517 | MAKE_RGB(0x00,0x00,0x00), |
| 518 | MAKE_RGB(0x00,0x00,0xff), |
| 519 | MAKE_RGB(0x00,0xff,0x00), |
| 520 | MAKE_RGB(0x00,0xff,0xff), |
| 521 | MAKE_RGB(0xff,0x00,0x00), |
| 522 | MAKE_RGB(0xff,0x00,0xff), |
| 523 | MAKE_RGB(0xff,0xff,0x00), |
| 524 | MAKE_RGB(0xff,0xff,0xff), |
| 525 | /* TODO: values extracted from WinSMC emulator, almost certainly not 100% accurate */ |
| 526 | MAKE_RGB(0x10,0x40,0x10), //dark green |
| 527 | MAKE_RGB(0x10,0x70,0x20), //moss green |
| 528 | MAKE_RGB(0xd0,0x50,0x20), //salmon |
| 529 | MAKE_RGB(0xe0,0x90,0x20), //tan |
| 530 | MAKE_RGB(0x10,0x50,0x80), //ash blue |
| 531 | MAKE_RGB(0x10,0x90,0xe0), //light blue |
| 532 | MAKE_RGB(0xf0,0x70,0x90), //pink |
| 533 | MAKE_RGB(0x80,0x80,0x80) //gray |
| 534 | }; |
| 535 | |
| 320 | 536 | static PALETTE_INIT( smc777 ) |
| 321 | 537 | { |
| 322 | 538 | int i; |
| r8568 | r8569 | |
| 335 | 551 | |
| 336 | 552 | palette_set_color_rgb(machine, i, r,g,b); |
| 337 | 553 | } |
| 554 | |
| 555 | for(i=0;i<0x10;i++) |
| 556 | palette_set_color(machine, 0x10+i,defcolors[i]); |
| 338 | 557 | } |
| 339 | 558 | |
| 340 | 559 | static const wd17xx_interface smc777_mb8876_interface = |
| r8568 | r8569 | |
| 373 | 592 | MDRV_CPU_PROGRAM_MAP(smc777_mem) |
| 374 | 593 | MDRV_CPU_IO_MAP(smc777_io) |
| 375 | 594 | |
| 595 | MDRV_MACHINE_START(smc777) |
| 376 | 596 | MDRV_MACHINE_RESET(smc777) |
| 377 | 597 | |
| 378 | 598 | /* video hardware */ |
| 379 | 599 | MDRV_SCREEN_ADD("screen", RASTER) |
| 380 | | MDRV_SCREEN_REFRESH_RATE(50) |
| 600 | MDRV_SCREEN_REFRESH_RATE(60) |
| 381 | 601 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 382 | 602 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 383 | | MDRV_SCREEN_SIZE(640, 200) |
| 384 | | MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1) |
| 385 | | MDRV_PALETTE_LENGTH(0x10) |
| 603 | MDRV_SCREEN_SIZE(0x400, 400) |
| 604 | MDRV_SCREEN_VISIBLE_AREA(0, 660-1, 0, 220-1) //normal 640 x 200 + 20 pixels for border color |
| 605 | MDRV_PALETTE_LENGTH(0x20) |
| 386 | 606 | MDRV_PALETTE_INIT(smc777) |
| 387 | 607 | MDRV_GFXDECODE(smc777) |
| 388 | 608 | |