src/mess/drivers/pc6001.c
| r5934 | r5935 | |
| 96 | 96 | static UINT8 *pc6001_video_ram; |
| 97 | 97 | static UINT8 irq_vector = 0x00; |
| 98 | 98 | static UINT8 cas_switch,sys_latch; |
| 99 | static UINT32 cas_offset; |
| 99 | 100 | |
| 100 | | #define CAS_LENGTH 0x3b9c |
| 101 | #define CAS_LENGTH 0x64c8 |
| 101 | 102 | |
| 102 | 103 | static VIDEO_START( pc6001 ) |
| 103 | 104 | { |
| r5934 | r5935 | |
| 127 | 128 | { |
| 128 | 129 | if(attr & 0x10) // 256x192x1 mode (FIXME: might be a different trigger) |
| 129 | 130 | { |
| 131 | int fgcol = (attr & 2) ? 7 : 2; |
| 132 | |
| 130 | 133 | for(y=0;y<192;y++) |
| 131 | 134 | { |
| 132 | 135 | for(x=0;x<32;x++) |
| r5934 | r5935 | |
| 135 | 138 | |
| 136 | 139 | for(xi=0;xi<8;xi++) |
| 137 | 140 | { |
| 138 | | color = ((tile)>>(7-xi) & 1) ? 7 : 0; |
| 141 | color = ((tile)>>(7-xi) & 1) ? fgcol : 0; |
| 139 | 142 | |
| 140 | 143 | *BITMAP_ADDR16(bitmap, (y+24), (x*8+xi)+32) = screen->machine->pens[color]; |
| 141 | 144 | } |
| r5934 | r5935 | |
| 241 | 244 | |
| 242 | 245 | pc6001_video_ram = pc6001_ram + startaddr[(data >> 1) & 0x03] - 0x8000; |
| 243 | 246 | |
| 244 | | if((!(sys_latch & 8)) && data & 0x8) |
| 247 | if((!(sys_latch & 8)) && data & 0x8) //PLAY tape cmd |
| 245 | 248 | cas_switch = 1; |
| 249 | if((sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd |
| 250 | { |
| 251 | cas_switch = 0; |
| 252 | irq_vector = 0x00; |
| 253 | cputag_set_input_line(space->machine,"maincpu", 0, ASSERT_LINE); |
| 254 | } |
| 246 | 255 | |
| 247 | 256 | sys_latch = data; |
| 248 | 257 | printf("%02x\n",data); |
| r5934 | r5935 | |
| 574 | 583 | static TIMER_CALLBACK(cassette_callback) |
| 575 | 584 | { |
| 576 | 585 | UINT8 *gfx_data = memory_region(machine, "cas"); |
| 577 | | static UINT32 i; |
| 578 | 586 | |
| 579 | 587 | if(cas_switch == 1) |
| 580 | 588 | { |
| 581 | | cur_keycode = gfx_data[i++]; |
| 582 | | //popmessage("%04x",i); |
| 583 | | if(i >= CAS_LENGTH) |
| 589 | cur_keycode = gfx_data[cas_offset++]; |
| 590 | //popmessage("%04x %02x",cas_offset,cas_switch); |
| 591 | if(cas_offset >= CAS_LENGTH) |
| 584 | 592 | { |
| 585 | | i = 0; |
| 593 | cas_offset = 0; |
| 586 | 594 | cas_switch = 0; |
| 587 | 595 | irq_vector = 0x12; |
| 588 | 596 | cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE); |
| r5934 | r5935 | |
| 637 | 645 | timer_pulse(machine, ATTOTIME_IN_HZ(250), NULL, 0, keyboard_callback); |
| 638 | 646 | timer_pulse(machine, ATTOTIME_IN_HZ(160), NULL, 0, cassette_callback); |
| 639 | 647 | cas_switch = 0; |
| 648 | cas_offset = 0; |
| 640 | 649 | } |
| 641 | 650 | |
| 642 | 651 | static const rgb_t defcolors[] = |
| r5934 | r5935 | |
| 712 | 721 | |
| 713 | 722 | ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF ) |
| 714 | 723 | /* Load here your tape for now (and change the cas length macro according to what MESS returns) */ |
| 715 | | // ROM_LOAD( "the amazon.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) ) |
| 724 | // ROM_LOAD( "trick boy.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) ) |
| 716 | 725 | ROM_END |
| 717 | 726 | |
| 718 | 727 | ROM_START( pc6001a ) |