Previous 199869 Revisions Next

r20459 Friday 25th January, 2013 at 00:32:20 UTC by Jonathan Gevaryahu
(MESS) cat.c (Canon Cat): Got rid of a lot of hashtag lookups; fixed the video enable bit location. Cleaned up comments a bit. More debugging stuff added. [Lord Nightmare]
[src/mess/drivers]cat.c

trunk/src/mess/drivers/cat.c
r20458r20459
2525* when the Cat boots, type (without quotes) "Enable Forth Language"
2626* hold left-alt(leap left) and type E n a, release left-alt (the left cursor is now at the first character)
2727* 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)
3030* press enter and the forth "ok" prompt should appear. you can type 'page' and enter to clear the screen 
3131
3232Canon Cat:
r20458r20459
4040
4141ToDo:
4242* 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);
4648  The 1.74 (bios 1) firmware doesn't have this issue.
4749  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)
4854- 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
5771- Centronics port
5872- 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)
6074- 6ms timer at 0x83xxxx
6175- Watchdog timer/powerfail at 0x85xxxx
6276- Canon Cat released versions known: 1.74 (dumped), 2.40 (dumped), 2.42 (NEED DUMP)
6377
6478* 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?)
6681- Communications ports (Duart? or some other plain UART?)
6782- Floppy (probably similar to the Cat)
6883- Centronics port (probably similar to the Cat)
r20458r20459
88103#undef DEBUG_MODEM_W
89104
90105#undef DEBUG_DUART_OUTPUT_LINES
106#undef DEBUG_DUART_INPUT_LINES
107#undef DEBUG_DUART_TXD
108#undef DEBUG_DUART_IRQ_HANDLER
91109
92110#undef DEBUG_TEST_W
93111
r20458r20459
102120public:
103121   cat_state(const machine_config &mconfig, device_type type, const char *tag)
104122      : 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")
107138      { }
108139
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
109168   DECLARE_WRITE16_MEMBER(cat_video_status_w);
110169   DECLARE_WRITE16_MEMBER(cat_test_mode_w);
111170   DECLARE_READ16_MEMBER(cat_s35213_r);
r20458r20459
124183   DECLARE_READ16_MEMBER(cat_2e80_r);
125184   DECLARE_READ16_MEMBER(cat_0080_r);
126185   DECLARE_READ16_MEMBER(cat_0000_r);
127   optional_shared_ptr<UINT16> m_p_sram;
128   required_shared_ptr<UINT16> m_p_videoram;
186
129187   UINT8 m_duart_inp;// = 0x0e;
130188   UINT8 m_video_enable;
131189   UINT16 m_pr_cont;
132190   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
143192   TIMER_CALLBACK_MEMBER(keyboard_callback);
144193   TIMER_CALLBACK_MEMBER(swyft_reset);
145194};
r20458r20459
313362   UINT16 retVal = 0;
314363   // Read country code
315364   if (m_pr_cont == 0x0900)
316      retVal = ioport("DIPSW1")->read();
365      retVal = m_dipsw->read();
317366
318367   // Regular keyboard read
319368   if (m_pr_cont == 0x0800 || m_pr_cont == 0x0a00)
r20458r20459
321370      retVal=0xff00;
322371      switch(m_keyboard_line)
323372      {
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;
332381      }
333382   }
334383   return retVal;
r20458r20459
507556   PORT_DIPSETTING(    0x7100, "Switzerland" )
508557   PORT_DIPSETTING(    0x7000, "ASCII" )
509558
510   PORT_START("LINE0")
559   PORT_START("Y0")
511560   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
512561   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
513562   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
r20458r20459
517566   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('\xa2')
518567   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
519568
520   PORT_START("LINE1")
569   PORT_START("Y1")
521570   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('n') PORT_CHAR('B')
522571   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
523572   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
r20458r20459
527576   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
528577   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
529578
530   PORT_START("LINE2")
579   PORT_START("Y2")
531580   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
532581   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
533582   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
r20458r20459
537586   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
538587   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
539588
540   PORT_START("LINE3")
589   PORT_START("Y3")
541590   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
542591   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left USE FRONT") PORT_CODE(KEYCODE_LCONTROL)
543592   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
r20458r20459
547596   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
548597   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
549598
550   PORT_START("LINE4")
599   PORT_START("Y4")
551600   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
552601   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right USE FRONT") PORT_CODE(KEYCODE_RCONTROL)
553602   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_SHIFT_1)
r20458r20459
557606   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
558607   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
559608
560   PORT_START("LINE5")
609   PORT_START("Y5")
561610   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
562611   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
563612   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
r20458r20459
567616   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
568617   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
569618
570   PORT_START("LINE6")
619   PORT_START("Y6")
571620   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_F1)
572621   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left LEAP") PORT_CODE(KEYCODE_LALT)
573622   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
r20458r20459
577626   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
578627   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
579628
580   PORT_START("LINE7")
629   PORT_START("Y7")
581630   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT)
582631   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Leap") PORT_CODE(KEYCODE_RALT)
583632   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_PGDN)
r20458r20459
688737
689738static void duart_irq_handler(device_t *device, int state, UINT8 vector)
690739{
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
692743}
693744
694745static void duart_tx(device_t *device, int channel, UINT8 data)
695746{
747#ifdef DEBUG_DUART_TXD
748   fprintf(stderr, "Duart TXD: data %02X\n", data);
749#endif
696750}
697751
698752static UINT8 duart_input(device_t *device)
699753{
700754   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
702758   if (state->m_duart_inp != 0)
703759   {
704760      state->m_duart_inp = 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team