src/mess/drivers/pc6001.c
| r5933 | r5934 | |
| 76 | 76 | irq vector 08: tests ppi port c, puts port A to $fa1d,puts 0x02 to [$fa19] ;tape data ready |
| 77 | 77 | irq vector 0A: writes 0x00 to [$fa19] |
| 78 | 78 | irq vector 0C: writes 0x00 to [$fa19] |
| 79 | | irq vector 0E: same as 2, (A = 0x03, B = 0x00) |
| 79 | irq vector 0E: same as 2, (A = 0x03, B = 0x00) ;? any press has the same effect as two enter pressed, break input? |
| 80 | 80 | irq vector 10: same as 2, (A = 0x03, B = 0x00) |
| 81 | 81 | irq vector 12: writes 0x10 to [$fa19] ;end of tape reached |
| 82 | | irq vector 14: same as 2, (A = 0x00, B = 0x01) |
| 82 | irq vector 14: same as 2, (A = 0x00, B = 0x01) ;kanji lock enabled |
| 83 | 83 | irq vector 16: tests ppi port c, writes the result to $feca. ;vblank |
| 84 | 84 | |
| 85 | 85 | |
| r5933 | r5934 | |
| 97 | 97 | static UINT8 irq_vector = 0x00; |
| 98 | 98 | static UINT8 cas_switch,sys_latch; |
| 99 | 99 | |
| 100 | | #define CAS_LENGTH 0x12e5 |
| 100 | #define CAS_LENGTH 0x3b9c |
| 101 | 101 | |
| 102 | 102 | static VIDEO_START( pc6001 ) |
| 103 | 103 | { |
| r5933 | r5934 | |
| 123 | 123 | |
| 124 | 124 | attr = pc6001_video_ram[0]; |
| 125 | 125 | |
| 126 | | if(attr & 0x80) // 128x192 4 colors mode |
| 126 | if(attr & 0x80) // gfx mode |
| 127 | 127 | { |
| 128 | | int shrink_x = 2*4; |
| 129 | | int shrink_y = (attr & 8) ? 1 : 2; |
| 130 | | int w = (shrink_x == 8) ? 32 : 16; |
| 128 | if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger) |
| 129 | { |
| 130 | for(y=0;y<192;y++) |
| 131 | { |
| 132 | for(x=0;x<32;x++) |
| 133 | { |
| 134 | tile = pc6001_video_ram[(x+(y*32))+0x200]; |
| 131 | 135 | |
| 132 | | for(y=0;y<(192/shrink_y);y++) |
| 136 | for(xi=0;xi<8;xi++) |
| 137 | { |
| 138 | color = ((tile)>>(7-xi) & 1) ? 7 : 0; |
| 139 | |
| 140 | *BITMAP_ADDR16(bitmap, (y+24), (x*8+xi)+32) = screen->machine->pens[color]; |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | else // 128x192x2 mode |
| 133 | 146 | { |
| 134 | | for(x=0;x<w;x++) |
| 147 | int shrink_x = 2*4; |
| 148 | int shrink_y = (attr & 8) ? 1 : 2; |
| 149 | int w = (shrink_x == 8) ? 32 : 16; |
| 150 | int col_bank = ((attr & 2)<<1); |
| 151 | |
| 152 | for(y=0;y<(192/shrink_y);y++) |
| 135 | 153 | { |
| 136 | | tile = pc6001_video_ram[(x+(y*32))+0x200]; |
| 154 | for(x=0;x<w;x++) |
| 155 | { |
| 156 | tile = pc6001_video_ram[(x+(y*32))+0x200]; |
| 137 | 157 | |
| 138 | | for(yi=0;yi<shrink_y;yi++) |
| 139 | | { |
| 140 | | for(xi=0;xi<shrink_x;xi++) |
| 158 | for(yi=0;yi<shrink_y;yi++) |
| 141 | 159 | { |
| 142 | | int i; |
| 143 | | i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; |
| 144 | | color = ((tile >> i) & 3)+8; |
| 160 | for(xi=0;xi<shrink_x;xi++) |
| 161 | { |
| 162 | int i; |
| 163 | i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; |
| 164 | color = ((tile >> i) & 3)+8; |
| 165 | color+= col_bank; |
| 145 | 166 | |
| 146 | | *BITMAP_ADDR16(bitmap, ((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = screen->machine->pens[color]; |
| 167 | *BITMAP_ADDR16(bitmap, ((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = screen->machine->pens[color]; |
| 168 | } |
| 147 | 169 | } |
| 148 | 170 | } |
| 149 | 171 | } |
| r5933 | r5934 | |
| 318 | 340 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 319 | 341 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| 320 | 342 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 321 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 322 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 323 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 343 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 344 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 345 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 324 | 346 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 325 | 347 | |
| 326 | 348 | PORT_START("P2") |
| r5933 | r5934 | |
| 328 | 350 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 329 | 351 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 330 | 352 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 331 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 332 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 333 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 353 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 354 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 355 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 334 | 356 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 335 | 357 | |
| 336 | 358 | PORT_START("key1") //0x00-0x1f |
| r5933 | r5934 | |
| 436 | 458 | PORT_BIT(0x20000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("]") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 437 | 459 | PORT_BIT(0x40000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("^") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') |
| 438 | 460 | PORT_BIT(0x80000000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("_") |
| 461 | |
| 462 | PORT_START("key_modifiers") |
| 463 | PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) |
| 464 | PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) |
| 465 | PORT_BIT(0x00000004,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE |
| 466 | PORT_BIT(0x00000008,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 467 | PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT) |
| 439 | 468 | INPUT_PORTS_END |
| 440 | 469 | |
| 441 | 470 | static INTERRUPT_GEN( pc6001_interrupt ) |
| r5933 | r5934 | |
| 515 | 544 | { |
| 516 | 545 | const char* portnames[3] = { "key1","key2","key3" }; |
| 517 | 546 | int i,port_i,scancode; |
| 547 | UINT8 shift_pressed,caps_lock; |
| 518 | 548 | scancode = 0; |
| 519 | 549 | |
| 550 | shift_pressed = (input_port_read(machine,"key_modifiers") & 2)>>1; |
| 551 | caps_lock = (input_port_read(machine,"key_modifiers") & 8)>>3; |
| 552 | |
| 520 | 553 | for(port_i=0;port_i<3;port_i++) |
| 521 | 554 | { |
| 522 | 555 | for(i=0;i<32;i++) |
| 523 | 556 | { |
| 524 | 557 | if((input_port_read(machine,portnames[port_i])>>i) & 1) |
| 525 | 558 | { |
| 559 | if((shift_pressed != caps_lock) && scancode >= 0x41 && scancode <= 0x5f) |
| 560 | scancode+=0x20; |
| 561 | |
| 562 | if(shift_pressed && scancode >= 0x31 && scancode <= 0x39) |
| 563 | scancode-=0x10; |
| 564 | |
| 526 | 565 | return scancode; |
| 527 | 566 | } |
| 528 | 567 | scancode++; |
| r5933 | r5934 | |
| 673 | 712 | |
| 674 | 713 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 675 | 714 | /* Load here your tape for now (and change the cas length macro according to what MESS returns) */ |
| 676 | | // ROM_LOAD( "block.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) ) |
| 715 | // ROM_LOAD( "the amazon.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) ) |
| 677 | 716 | ROM_END |
| 678 | 717 | |
| 679 | 718 | ROM_START( pc6001a ) |