trunk/src/mess/drivers/cat.c
| r20458 | r20459 | |
| 25 | 25 | * when the Cat boots, type (without quotes) "Enable Forth Language" |
| 26 | 26 | * hold left-alt(leap left) and type E n a, release left-alt (the left cursor is now at the first character) |
| 27 | 27 | * simultaneously press both alt keys for a moment and release both (the whole "Enable Forth Language" line will be selected) |
| 28 | | * press either Ctri(use front) key and press backspace(Erase) (If beeping actually worked the cat would beep here) |
| 29 | | * press ctrl(use front), shift, and space (the cursor should stop blinking) |
| 28 | * press control(use front) and press backspace(Erase) (If beeping actually worked the cat would beep here) |
| 29 | * press control(use front), shift, and space (the cursor should stop blinking) |
| 30 | 30 | * press enter and the forth "ok" prompt should appear. you can type 'page' and enter to clear the screen |
| 31 | 31 | |
| 32 | 32 | Canon Cat: |
| r20458 | r20459 | |
| 40 | 40 | |
| 41 | 41 | ToDo: |
| 42 | 42 | * Canon Cat |
| 43 | | - Find the mirrors for the write-only video control register and figure out what the writes actually do |
| 44 | | - The 2.40 (bios 0) firmware gets annoyed and thinks it has a phone call at random |
| 45 | | (hit ctrl to make it shut up for a bit or go into forth mode); |
| 43 | - Find the mirrors for the write-only video control register and figure out |
| 44 | what the writes actually do |
| 45 | - The 2.40 (bios 0) firmware gets annoyed and thinks it has a phone call at |
| 46 | random. |
| 47 | (hit ctrl a few times to make it shut up for a bit or go into forth mode); |
| 46 | 48 | The 1.74 (bios 1) firmware doesn't have this issue. |
| 47 | 49 | Figure out what causes it and make it stop. |
| 50 | (This MIGHT be related to the mysterious HK0NT line connecting gate array 2 |
| 51 | to a toggle latch connecting to IP2 on the DUART; It may be necessary to |
| 52 | actually probe that line with a meter to see what address/bit causes it to |
| 53 | toggle, if the call can't be found in the cat source code) |
| 48 | 54 | - Floppy drive (3.5", Single Sided Double Density MFM, ~400kb) |
| 49 | | * Cat has very low level control of data being read or written, much like the Amiga does |
| 50 | | * first sector is id ZERO which is unusual since most formats are base 1 for sectors |
| 51 | | * sectors are 512 bytes, standard MFM with usual address and data marks and ccitt crc16 |
| 52 | | * track 0 contains sector zero repeated identically 10 times; the cat SEEMS to use this as a disk/document ID |
| 53 | | * tracks 1-79 contain sectors 0x0 thru 0x9 ('normal' mfm parlance: sectors -1, 0, 1, ... 7, 8) |
| 54 | | * this means the whole disk effectively contains 512*10*80 = 409600 bytes of data, though track 0 is just a disk "number" identifier for the cat meaning 404480 usable bytes |
| 55 | | * (Once this is done I'd declare the system working) |
| 56 | | - Beeper/speaker; this is connected to the DUART 'user output' pin OP3 and probably depends on an accurate implementation of the duart counters/timers |
| 55 | * Cat has very low level control of data being read or written, much like |
| 56 | the Amiga does |
| 57 | * first sector is id ZERO which is unusual since most MFM formats are base-1 |
| 58 | for sector numbering |
| 59 | * sectors are 512 bytes, standard MFM with usual address and data marks and |
| 60 | ccitt crc16 |
| 61 | * track 0 contains sector zero repeated identically 10 times; the cat SEEMS |
| 62 | to use this as a disk/document ID |
| 63 | * tracks 1-79 each contain ten sectors, id 0x0 thru 0x9 |
| 64 | ('normal' mfm parlance: sectors -1, 0, 1, ... 7, 8) |
| 65 | * this means the whole disk effectively contains 512*10*80 = 409600 bytes of |
| 66 | data, though track 0 is just a disk "unique" identifier for the cat |
| 67 | meaning 404480 usable bytes |
| 68 | * (Once the floppy is working I'd declare the system working) |
| 69 | - Beeper/speaker; this is connected to the DUART 'user output' pin OP3 and |
| 70 | probably depends on an accurate implementation of the duart counters/timers |
| 57 | 71 | - Centronics port |
| 58 | 72 | - RS232C port and Modem "port" connected to the DUART's two ports |
| 59 | | - DTMF generator chip (connected to DUART ports OP4,5,6,7) |
| 73 | - DTMF generator chip (connected to DUART 'user output' pins OP4,5,6,7) |
| 60 | 74 | - 6ms timer at 0x83xxxx |
| 61 | 75 | - Watchdog timer/powerfail at 0x85xxxx |
| 62 | 76 | - Canon Cat released versions known: 1.74 (dumped), 2.40 (dumped), 2.42 (NEED DUMP) |
| 63 | 77 | |
| 64 | 78 | * Swyft |
| 65 | | - Figure out the keyboard (unlike the cat interrupts are involved? or maybe an NMI on a timer/vblank?) |
| 79 | - Figure out the keyboard (interrupts are involved? or maybe an NMI on a |
| 80 | timer/vblank?) |
| 66 | 81 | - Communications ports (Duart? or some other plain UART?) |
| 67 | 82 | - Floppy (probably similar to the Cat) |
| 68 | 83 | - Centronics port (probably similar to the Cat) |
| r20458 | r20459 | |
| 88 | 103 | #undef DEBUG_MODEM_W |
| 89 | 104 | |
| 90 | 105 | #undef DEBUG_DUART_OUTPUT_LINES |
| 106 | #undef DEBUG_DUART_INPUT_LINES |
| 107 | #undef DEBUG_DUART_TXD |
| 108 | #undef DEBUG_DUART_IRQ_HANDLER |
| 91 | 109 | |
| 92 | 110 | #undef DEBUG_TEST_W |
| 93 | 111 | |
| r20458 | r20459 | |
| 102 | 120 | public: |
| 103 | 121 | cat_state(const machine_config &mconfig, device_type type, const char *tag) |
| 104 | 122 | : driver_device(mconfig, type, tag), |
| 105 | | m_p_sram(*this, "p_sram"), |
| 106 | | m_p_videoram(*this, "p_videoram") |
| 123 | m_maincpu(*this, "maincpu"), |
| 124 | //m_nvram(*this, "nvram"), // merge with p_sram? |
| 125 | //m_duart(*this, "duart68681"), |
| 126 | //m_speaker(*this, "speaker"), |
| 127 | m_p_sram(*this, "p_sram"), // nvram |
| 128 | m_p_videoram(*this, "p_videoram"), |
| 129 | m_y0(*this, "Y0"), |
| 130 | m_y1(*this, "Y1"), |
| 131 | m_y2(*this, "Y2"), |
| 132 | m_y3(*this, "Y3"), |
| 133 | m_y4(*this, "Y4"), |
| 134 | m_y5(*this, "Y5"), |
| 135 | m_y6(*this, "Y6"), |
| 136 | m_y7(*this, "Y7"), |
| 137 | m_dipsw(*this, "DIPSW1") |
| 107 | 138 | { } |
| 108 | 139 | |
| 140 | required_device<cpu_device> m_maincpu; |
| 141 | //optional_device<nvram_device> m_nvram; |
| 142 | //required_device<68681_device> m_duart; |
| 143 | //required_device<speaker_sound_device> m_speaker; |
| 144 | optional_shared_ptr<UINT16> m_p_sram; |
| 145 | required_shared_ptr<UINT16> m_p_videoram; |
| 146 | optional_ioport m_y0; |
| 147 | optional_ioport m_y1; |
| 148 | optional_ioport m_y2; |
| 149 | optional_ioport m_y3; |
| 150 | optional_ioport m_y4; |
| 151 | optional_ioport m_y5; |
| 152 | optional_ioport m_y6; |
| 153 | optional_ioport m_y7; |
| 154 | optional_ioport m_dipsw; |
| 155 | emu_timer *m_keyboard_timer; |
| 156 | |
| 157 | DECLARE_MACHINE_START(cat); |
| 158 | DECLARE_MACHINE_RESET(cat); |
| 159 | DECLARE_VIDEO_START(cat); |
| 160 | DECLARE_DRIVER_INIT(cat); |
| 161 | DECLARE_MACHINE_START(swyft); |
| 162 | DECLARE_MACHINE_RESET(swyft); |
| 163 | DECLARE_VIDEO_START(swyft); |
| 164 | |
| 165 | UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 166 | UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 167 | |
| 109 | 168 | DECLARE_WRITE16_MEMBER(cat_video_status_w); |
| 110 | 169 | DECLARE_WRITE16_MEMBER(cat_test_mode_w); |
| 111 | 170 | DECLARE_READ16_MEMBER(cat_s35213_r); |
| r20458 | r20459 | |
| 124 | 183 | DECLARE_READ16_MEMBER(cat_2e80_r); |
| 125 | 184 | DECLARE_READ16_MEMBER(cat_0080_r); |
| 126 | 185 | DECLARE_READ16_MEMBER(cat_0000_r); |
| 127 | | optional_shared_ptr<UINT16> m_p_sram; |
| 128 | | required_shared_ptr<UINT16> m_p_videoram; |
| 186 | |
| 129 | 187 | UINT8 m_duart_inp;// = 0x0e; |
| 130 | 188 | UINT8 m_video_enable; |
| 131 | 189 | UINT16 m_pr_cont; |
| 132 | 190 | UINT8 m_keyboard_line; |
| 133 | | emu_timer *m_keyboard_timer; |
| 134 | | DECLARE_MACHINE_START(cat); |
| 135 | | DECLARE_MACHINE_RESET(cat); |
| 136 | | DECLARE_VIDEO_START(cat); |
| 137 | | DECLARE_DRIVER_INIT(cat); |
| 138 | | DECLARE_MACHINE_START(swyft); |
| 139 | | DECLARE_MACHINE_RESET(swyft); |
| 140 | | DECLARE_VIDEO_START(swyft); |
| 141 | | UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 142 | | UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 191 | |
| 143 | 192 | TIMER_CALLBACK_MEMBER(keyboard_callback); |
| 144 | 193 | TIMER_CALLBACK_MEMBER(swyft_reset); |
| 145 | 194 | }; |
| r20458 | r20459 | |
| 313 | 362 | UINT16 retVal = 0; |
| 314 | 363 | // Read country code |
| 315 | 364 | if (m_pr_cont == 0x0900) |
| 316 | | retVal = ioport("DIPSW1")->read(); |
| 365 | retVal = m_dipsw->read(); |
| 317 | 366 | |
| 318 | 367 | // Regular keyboard read |
| 319 | 368 | if (m_pr_cont == 0x0800 || m_pr_cont == 0x0a00) |
| r20458 | r20459 | |
| 321 | 370 | retVal=0xff00; |
| 322 | 371 | switch(m_keyboard_line) |
| 323 | 372 | { |
| 324 | | case 0x01: retVal = ioport("LINE0")->read() << 8; break; |
| 325 | | case 0x02: retVal = ioport("LINE1")->read() << 8; break; |
| 326 | | case 0x04: retVal = ioport("LINE2")->read() << 8; break; |
| 327 | | case 0x08: retVal = ioport("LINE3")->read() << 8; break; |
| 328 | | case 0x10: retVal = ioport("LINE4")->read() << 8; break; |
| 329 | | case 0x20: retVal = ioport("LINE5")->read() << 8; break; |
| 330 | | case 0x40: retVal = ioport("LINE6")->read() << 8; break; |
| 331 | | case 0x80: retVal = ioport("LINE7")->read() << 8; break; |
| 373 | case 0x01: retVal = m_y0->read() << 8; break; |
| 374 | case 0x02: retVal = m_y1->read() << 8; break; |
| 375 | case 0x04: retVal = m_y2->read() << 8; break; |
| 376 | case 0x08: retVal = m_y3->read() << 8; break; |
| 377 | case 0x10: retVal = m_y4->read() << 8; break; |
| 378 | case 0x20: retVal = m_y5->read() << 8; break; |
| 379 | case 0x40: retVal = m_y6->read() << 8; break; |
| 380 | case 0x80: retVal = m_y7->read() << 8; break; |
| 332 | 381 | } |
| 333 | 382 | } |
| 334 | 383 | return retVal; |
| r20458 | r20459 | |
| 507 | 556 | PORT_DIPSETTING( 0x7100, "Switzerland" ) |
| 508 | 557 | PORT_DIPSETTING( 0x7000, "ASCII" ) |
| 509 | 558 | |
| 510 | | PORT_START("LINE0") |
| 559 | PORT_START("Y0") |
| 511 | 560 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| 512 | 561 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') |
| 513 | 562 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') |
| r20458 | r20459 | |
| 517 | 566 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xa2') |
| 518 | 567 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 519 | 568 | |
| 520 | | PORT_START("LINE1") |
| 569 | PORT_START("Y1") |
| 521 | 570 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('n') PORT_CHAR('B') |
| 522 | 571 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 523 | 572 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') |
| r20458 | r20459 | |
| 527 | 576 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 528 | 577 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 529 | 578 | |
| 530 | | PORT_START("LINE2") |
| 579 | PORT_START("Y2") |
| 531 | 580 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') |
| 532 | 581 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 533 | 582 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') |
| r20458 | r20459 | |
| 537 | 586 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*') |
| 538 | 587 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 539 | 588 | |
| 540 | | PORT_START("LINE3") |
| 589 | PORT_START("Y3") |
| 541 | 590 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') |
| 542 | 591 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left USE FRONT") PORT_CODE(KEYCODE_LCONTROL) |
| 543 | 592 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| r20458 | r20459 | |
| 547 | 596 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| 548 | 597 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 549 | 598 | |
| 550 | | PORT_START("LINE4") |
| 599 | PORT_START("Y4") |
| 551 | 600 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') |
| 552 | 601 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right USE FRONT") PORT_CODE(KEYCODE_RCONTROL) |
| 553 | 602 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_SHIFT_1) |
| r20458 | r20459 | |
| 557 | 606 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 558 | 607 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') |
| 559 | 608 | |
| 560 | | PORT_START("LINE5") |
| 609 | PORT_START("Y5") |
| 561 | 610 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 562 | 611 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 563 | 612 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| r20458 | r20459 | |
| 567 | 616 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_') |
| 568 | 617 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 569 | 618 | |
| 570 | | PORT_START("LINE6") |
| 619 | PORT_START("Y6") |
| 571 | 620 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_F1) |
| 572 | 621 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left LEAP") PORT_CODE(KEYCODE_LALT) |
| 573 | 622 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| r20458 | r20459 | |
| 577 | 626 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 578 | 627 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) |
| 579 | 628 | |
| 580 | | PORT_START("LINE7") |
| 629 | PORT_START("Y7") |
| 581 | 630 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) |
| 582 | 631 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Leap") PORT_CODE(KEYCODE_RALT) |
| 583 | 632 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_PGDN) |
| r20458 | r20459 | |
| 688 | 737 | |
| 689 | 738 | static void duart_irq_handler(device_t *device, int state, UINT8 vector) |
| 690 | 739 | { |
| 691 | | //logerror("duart_irq_handler\n"); |
| 740 | #ifdef DEBUG_DUART_IRQ_HANDLER |
| 741 | fprintf(stderr, "Duart IRQ handler called; vector: %06X\n", vector); |
| 742 | #endif |
| 692 | 743 | } |
| 693 | 744 | |
| 694 | 745 | static void duart_tx(device_t *device, int channel, UINT8 data) |
| 695 | 746 | { |
| 747 | #ifdef DEBUG_DUART_TXD |
| 748 | fprintf(stderr, "Duart TXD: data %02X\n", data); |
| 749 | #endif |
| 696 | 750 | } |
| 697 | 751 | |
| 698 | 752 | static UINT8 duart_input(device_t *device) |
| 699 | 753 | { |
| 700 | 754 | cat_state *state = device->machine().driver_data<cat_state>(); |
| 701 | | |
| 755 | #ifdef DEBUG_DUART_INPUT_LINES |
| 756 | fprintf(stderr, "Duart input lines read!\n"); |
| 757 | #endif |
| 702 | 758 | if (state->m_duart_inp != 0) |
| 703 | 759 | { |
| 704 | 760 | state->m_duart_inp = 0; |