src/mess/drivers/rm380z.c
| r13892 | r13893 | |
| 105 | 105 | DECLARE_READ8_MEMBER( videoram_read ); |
| 106 | 106 | DECLARE_WRITE8_MEMBER( videoram_write ); |
| 107 | 107 | |
| 108 | | DECLARE_READ8_MEMBER(rm380z_io_r); |
| 109 | | DECLARE_WRITE8_MEMBER(rm380z_io_w); |
| 108 | DECLARE_WRITE8_MEMBER(disk_0_control); |
| 110 | 109 | |
| 111 | 110 | int keyboard_decode(); |
| 112 | 111 | }; |
| r13892 | r13893 | |
| 322 | 321 | if ((offset>=0x0000)&&(offset<0x1000)) |
| 323 | 322 | { |
| 324 | 323 | // ROM |
| 325 | | return state->m_cos_rom[offset]; |
| 324 | return state->m_cos_rom[offset+ 0xe000]; |
| 326 | 325 | } |
| 327 | 326 | else if ((offset>=0x1c00)&&(offset<=0x1dff)) |
| 328 | 327 | { |
| 329 | | return m_cos_rom[offset-0x800]; |
| 328 | return m_cos_rom[offset]; |
| 330 | 329 | } |
| 331 | 330 | else if ((offset>=0x1000)&&(offset<0x4000)) |
| 332 | 331 | { |
| r13892 | r13893 | |
| 450 | 449 | // |
| 451 | 450 | |
| 452 | 451 | |
| 453 | | WRITE8_MEMBER( rm380z_state::rm380z_io_w ) |
| 452 | WRITE8_MEMBER( rm380z_state::disk_0_control ) |
| 454 | 453 | { |
| 455 | | UINT8 portnum=offset&0xff; |
| 456 | 454 | device_t *fdc = machine().device("wd1771"); |
| 457 | 455 | |
| 458 | | //printf("port write of [%x] at [%x] from PC [%x]\n",data,portnum,cpu_get_pc(machine().device("maincpu"))); |
| 456 | printf("disk drive port0 write [%x]\n",data); |
| 459 | 457 | |
| 460 | | if (portnum==0xc0) |
| 458 | // drive port0 |
| 459 | if (data&0x01) |
| 461 | 460 | { |
| 462 | | wd17xx_command_w(fdc, 0, data); |
| 463 | | //printf("wrote command [%x] to floppy disk\n",data); |
| 461 | // drive select bit 0 |
| 462 | wd17xx_set_drive(fdc,0); |
| 464 | 463 | } |
| 465 | | else if (portnum==0xc1) |
| 464 | |
| 465 | if (data&0x08) |
| 466 | 466 | { |
| 467 | | wd17xx_track_w(fdc, 0, data); |
| 468 | | //printf("wrote track data [%x] to floppy disk\n",data); |
| 467 | // motor on |
| 469 | 468 | } |
| 470 | | else if (portnum==0xc2) |
| 469 | |
| 470 | // "MSEL (dir/side select bit) |
| 471 | if (data&0x20) |
| 471 | 472 | { |
| 472 | | wd17xx_sector_w(fdc, 0, data); |
| 473 | | //printf("wrote sector data [%x] to floppy disk\n",data); |
| 473 | wd17xx_set_side(fdc,1); |
| 474 | 474 | } |
| 475 | | else if (portnum==0xc3) |
| 475 | else |
| 476 | 476 | { |
| 477 | | wd17xx_data_w(fdc, 0, data); |
| 478 | | //printf("wrote data [%x] to floppy disk\n",data); |
| 477 | wd17xx_set_side(fdc,0); |
| 479 | 478 | } |
| 480 | | else if (portnum==0xc4) |
| 479 | |
| 480 | // set drive en- (?) |
| 481 | if (data&0x40) |
| 481 | 482 | { |
| 482 | | printf("disk drive port0 write [%x]\n",data); |
| 483 | | |
| 484 | | // drive port0 |
| 485 | | if (data&0x01) |
| 486 | | { |
| 487 | | // drive select bit 0 |
| 488 | | wd17xx_set_drive(fdc,0); |
| 489 | | } |
| 490 | | |
| 491 | | if (data&0x08) |
| 492 | | { |
| 493 | | // motor on |
| 494 | | } |
| 495 | | |
| 496 | | // "MSEL (dir/side select bit) |
| 497 | | if (data&0x20) |
| 498 | | { |
| 499 | | wd17xx_set_side(fdc,1); |
| 500 | | } |
| 501 | | else |
| 502 | | { |
| 503 | | wd17xx_set_side(fdc,0); |
| 504 | | } |
| 505 | | |
| 506 | | // set drive en- (?) |
| 507 | | if (data&0x40) |
| 508 | | { |
| 509 | | } |
| 510 | 483 | } |
| 511 | 484 | } |
| 512 | 485 | |
| 513 | | READ8_MEMBER( rm380z_state::rm380z_io_r ) |
| 514 | | { |
| 515 | | UINT8 retval=0; |
| 516 | | UINT8 portnum=offset&0xff; |
| 517 | | device_t *fdc = machine().device("wd1771"); |
| 518 | | |
| 519 | | //printf("port read at [%x] from PC [%x]\n",portnum,cpu_get_pc(machine().device("maincpu"))); |
| 520 | | |
| 521 | | if (portnum==0xc0) |
| 522 | | { |
| 523 | | retval=wd17xx_status_r(fdc,0); |
| 524 | | //printf("disk drive status read is [%x]\n",retval); |
| 525 | | } |
| 526 | | else if (portnum==0xc1) |
| 527 | | { |
| 528 | | retval=wd17xx_track_r(fdc, 0); |
| 529 | | //printf("disk drive track read is [%x]\n",retval); |
| 530 | | } |
| 531 | | else if (portnum==0xc2) |
| 532 | | { |
| 533 | | retval=wd17xx_sector_r(fdc, 0); |
| 534 | | //printf("disk drive sector read is [%x]\n",retval); |
| 535 | | } |
| 536 | | else if (portnum==0xc3) |
| 537 | | { |
| 538 | | retval=wd17xx_data_r(fdc, 0); |
| 539 | | //printf("disk drive data read [%x] at PC [%x]\n",retval,cpu_get_pc(machine().device("maincpu"))); |
| 540 | | } |
| 541 | | else if (portnum==0xcc) |
| 542 | | { |
| 543 | | // CTC (?) |
| 544 | | return 0x00; |
| 545 | | } |
| 546 | | else |
| 547 | | { |
| 548 | | printf("other disk drive port read [%x] PC [%x]\n",portnum,cpu_get_pc(machine().device("maincpu"))); |
| 549 | | return 0x00; |
| 550 | | } |
| 551 | | |
| 552 | | return retval; |
| 553 | | } |
| 554 | | |
| 555 | 486 | static ADDRESS_MAP_START(rm380z_mem, AS_PROGRAM, 8, rm380z_state) |
| 556 | 487 | AM_RANGE( 0x0000, 0xdfff ) AM_READWRITE(main_read,main_write) |
| 557 | | AM_RANGE( 0xe000, 0xefff ) AM_ROM AM_REGION("maincpu", 0) |
| 488 | AM_RANGE( 0xe000, 0xefff ) AM_ROM |
| 558 | 489 | AM_RANGE( 0xf000, 0xf5ff ) AM_READWRITE(videoram_read,videoram_write) |
| 559 | | AM_RANGE( 0xf600, 0xf9ff ) AM_ROM AM_REGION("maincpu", 0x1000) /* Extra ROM space for COS4.0 */ |
| 490 | AM_RANGE( 0xf600, 0xf9ff ) AM_ROM /* Extra ROM space for COS4.0 */ |
| 560 | 491 | AM_RANGE( 0xfa00, 0xfbfb ) AM_RAM |
| 561 | 492 | AM_RANGE( 0xfbfc, 0xfbff ) AM_READWRITE( port_fbfc_read, port_fbfc_write ) |
| 562 | 493 | AM_RANGE( 0xfc00, 0xffff ) AM_RAM |
| r13892 | r13893 | |
| 568 | 499 | |
| 569 | 500 | static ADDRESS_MAP_START( rm380z_io , AS_IO, 8, rm380z_state) |
| 570 | 501 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 571 | | AM_RANGE(0x0000, 0xffff) AM_READWRITE(rm380z_io_r, rm380z_io_w) |
| 572 | | // AM_RANGE(0xc3, 0xc3) AM_DEVWRITE_LEGACY("wd1771", wd17xx_command_w) |
| 573 | | // AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_track_r, wd17xx_track_w) |
| 574 | | // AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_sector_r, wd17xx_sector_w) |
| 575 | | // AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_data_r, wd17xx_data_w) |
| 502 | AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_status_r, wd17xx_command_w) |
| 503 | AM_RANGE(0xc1, 0xc1) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_track_r, wd17xx_track_w) |
| 504 | AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_sector_r, wd17xx_sector_w) |
| 505 | AM_RANGE(0xc3, 0xc3) AM_DEVREADWRITE_LEGACY("wd1771", wd17xx_data_r, wd17xx_data_w) |
| 506 | AM_RANGE(0xc4, 0xc4) AM_WRITE(disk_0_control) |
| 507 | AM_RANGE(0xcc, 0xcc) AM_NOP // CTC (?) |
| 576 | 508 | ADDRESS_MAP_END |
| 577 | 509 | |
| 578 | 510 | // |
| r13892 | r13893 | |
| 755 | 687 | { |
| 756 | 688 | rm380z_state *state = screen.machine().driver_data<rm380z_state>(); |
| 757 | 689 | |
| 758 | | unsigned char* pChar=screen.machine().region("maincpu")->base()+0x1600; |
| 690 | unsigned char* pChar=screen.machine().region("gfx")->base(); |
| 759 | 691 | UINT16* scrptr = &bitmap.pix16(0, 0); |
| 760 | 692 | |
| 761 | 693 | for (int row=0;row<screenrows;row++) |
| r13892 | r13893 | |
| 813 | 745 | |
| 814 | 746 | /* ROM definition */ |
| 815 | 747 | ROM_START( rm380z ) |
| 816 | | ROM_REGION( 0x1600+0x1680, "maincpu", 0 ) |
| 817 | | ROM_LOAD( "cos40b-m.bin", 0x0000, 0x1000, CRC(1f0b3a5c) SHA1(0b29cb2a3b7eaa3770b34f08c4fd42844f42700f)) |
| 818 | | ROM_LOAD( "cos40b-m_f600-f9ff.bin", 0x1000, 0x400, CRC(e3397d9d) SHA1(490a0c834b0da392daf782edc7d51ca8f0668b1a)) |
| 819 | | ROM_LOAD( "cos40b-m_1c00-1dff.bin", 0x1400, 0x200, CRC(0f759f44) SHA1(9689c1c1faa62c56def999cbedbbb0c8d928dcff)) |
| 820 | | ROM_LOAD( "ch3.raw", 0x1600, 0x1680, CRC(e0b10221) SHA1(95304ccad9a7af49d79a349feb2bc23035f90abc)) |
| 748 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 749 | ROM_LOAD( "cos40b-m_1c00-1dff.bin", 0x1c00, 0x0200, CRC(0f759f44) SHA1(9689c1c1faa62c56def999cbedbbb0c8d928dcff)) |
| 750 | ROM_LOAD( "cos40b-m.bin", 0xe000, 0x1000, CRC(1f0b3a5c) SHA1(0b29cb2a3b7eaa3770b34f08c4fd42844f42700f)) |
| 751 | ROM_LOAD( "cos40b-m_f600-f9ff.bin", 0xf600, 0x0400, CRC(e3397d9d) SHA1(490a0c834b0da392daf782edc7d51ca8f0668b1a)) |
| 752 | ROM_REGION( 0x1680, "gfx", 0 ) |
| 753 | ROM_LOAD( "ch3.raw", 0x0000, 0x1680, CRC(e0b10221) SHA1(95304ccad9a7af49d79a349feb2bc23035f90abc)) |
| 821 | 754 | ROM_END |
| 822 | 755 | |
| 823 | 756 | /* Driver */ |