src/mess/drivers/coupe.c
| r2125 | r2126 | |
| 383 | 383 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) |
| 384 | 384 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) |
| 385 | 385 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) |
| 386 | | |
| 387 | 386 | INPUT_PORTS_END |
| 388 | 387 | |
| 389 | | /* Initialise the palette */ |
| 388 | |
| 389 | |
| 390 | /************************************* |
| 391 | * |
| 392 | * Palette |
| 393 | * |
| 394 | *************************************/ |
| 395 | |
| 396 | /* |
| 397 | Decode colours for the palette as follows: |
| 398 | |
| 399 | bit 7 6 5 4 3 2 1 0 |
| 400 | nothing G+4 R+4 B+4 ALL+1 G+2 R+2 B+2 |
| 401 | |
| 402 | These values scaled up to 0-255 range would give modifiers of: |
| 403 | |
| 404 | +4 = +(4*36), +2 = +(2*36), +1 = *(1*36) |
| 405 | |
| 406 | Not quite max of 255 but close enough for me! |
| 407 | */ |
| 390 | 408 | static PALETTE_INIT( coupe ) |
| 391 | 409 | { |
| 392 | | unsigned char red,green,blue; |
| 393 | | int a; |
| 394 | | unsigned short coupe_colortable[128]; // 1-1 relationship to palette! |
| 410 | int i; |
| 395 | 411 | |
| 396 | | for (a=0;a<128;a++) |
| 412 | for (i = 0; i < 128; i++) |
| 397 | 413 | { |
| 398 | | /* decode colours for palette as follows : |
| 399 | | * bit number 7 6 5 4 3 2 1 0 |
| 400 | | * | | | | | | | |
| 401 | | * nothing G+4 R+4 B+4 ALL+1 G+2 R+2 B+2 |
| 402 | | * |
| 403 | | * these values scaled up to 0-255 range would give modifiers of : +4 = +(4*36), +2 = +(2*36), +1 = *(1*36) |
| 404 | | * not quite max of 255 but close enough for me! |
| 405 | | */ |
| 406 | | red=green=blue=0; |
| 407 | | if (a&0x01) |
| 408 | | blue+=2*36; |
| 409 | | if (a&0x02) |
| 410 | | red+=2*36; |
| 411 | | if (a&0x04) |
| 412 | | green+=2*36; |
| 413 | | if (a&0x08) |
| 414 | UINT8 r = 0, g = 0, b = 0; |
| 415 | |
| 416 | /* colors */ |
| 417 | if (i & 0x01) b += 2*36; |
| 418 | if (i & 0x02) r += 2*36; |
| 419 | if (i & 0x04) g += 2*36; |
| 420 | if (i & 0x10) b += 4*36; |
| 421 | if (i & 0x20) r += 4*36; |
| 422 | if (i & 0x40) g += 4*36; |
| 423 | |
| 424 | /* intensity bit */ |
| 425 | if (i & 0x08) |
| 414 | 426 | { |
| 415 | | red+=1*36; |
| 416 | | green+=1*36; |
| 417 | | blue+=1*36; |
| 427 | r += 1*36; |
| 428 | g += 1*36; |
| 429 | b += 1*36; |
| 418 | 430 | } |
| 419 | | if (a&0x10) |
| 420 | | blue+=4*36; |
| 421 | | if (a&0x20) |
| 422 | | red+=4*36; |
| 423 | | if (a&0x40) |
| 424 | | green+=4*36; |
| 425 | 431 | |
| 426 | | palette_set_color_rgb(machine, a, red, green, blue); |
| 427 | | coupe_colortable[a]=a; |
| 432 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 428 | 433 | } |
| 429 | 434 | } |
| 430 | 435 | |