Previous 199869 Revisions Next

r20429 Thursday 24th January, 2013 at 09:04:02 UTC by Jonathan Gevaryahu
(MESS) cat.c (Canon Cat): Reverse engineered 99% of memory map including mirrors based on extensive hardware testing; Located Printer, Modem and Floppy drive registers (not yet hooked up); Added v1.74 firmware and SpellCheck ROMs. Added a lot of debugging information. [Lord Nightmare, Balrog]
[src/mess/drivers]cat.c

trunk/src/mess/drivers/cat.c
r20428r20429
11/***************************************************************************
22
3    Canon Cat driver by Miodrag Milanovic
3    Canon Cat driver by Miodrag Milanovic and Lord Nightmare
44
55    12/06/2009 Skeleton driver.
66    15/06/2009 Working driver
r20428r20429
2121- Then press USE FRONT and the SHIFT keys together and tap the space bar. Note that the cursor
2222  stops blinking. Now a Pressing the RETURN key gets the Forth OK and you are 'in' as they say.
2323
24In MESS, to activate it as above:
25* when the Cat boots, type (without quotes) "Enable Forth Language"
26* hold left-alt(leap left) and type E n a, release left-alt (the left cursor is now at the first character)
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)
30* press enter and the forth "ok" prompt should appear. you can type 'page' and enter to clear the screen 
2431
32Canon Cat:
33<insert guru-diagram here once drawn>
34Crystals:
35X1: 19.968Mhz, used by GA2 (plus a PLL to multiply by 2?), and divide by 4 for cpuclk, divide by 8 for 2.5mhz and divide by 5.5 for 3.63mhz (is this suposed to be divide by 6? there may not be a pll if it is...)
36X2: 3.579545Mhz, used by the DTMF generator chip AMI S2579 at IC40
37X3: 2.4576Mhz, used by the modem chip AMI S35213 at IC37
38
39
40
2541ToDo:
26- Floppy drive (3.5", 256kb)
27- Beeper/speaker
28- Swyft - figure out the keyboard
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);
46  The 1.74 (bios 1) firmware doesn't have this issue.
47  Figure out what causes it and make it stop.
48- 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
2957- Centronics port
30- RS232C port
58- RS232C port and Modem "port" connected to the DUART's two ports
59- DTMF generator chip (connected to DUART ports OP4,5,6,7)
60- 6ms timer at 0x83xxxx
61- Watchdog timer/powerfail at 0x85xxxx
62- Canon Cat released versions known: 1.74 (dumped), 2.40 (dumped), 2.42 (NEED DUMP)
3163
64* Swyft
65- Figure out the keyboard (unlike the cat interrupts are involved? or maybe an NMI on a timer/vblank?)
66- Communications ports (Duart? or some other plain UART?)
67- Floppy (probably similar to the Cat)
68- Centronics port (probably similar to the Cat)
69- Multple undumped firmware revisions exist
70
3271****************************************************************************/
3372
73// Defines
74
75#undef DEBUG_VIDEO_STATUS_W
76#undef DEBUG_VIDEO_CONTROL_W
77
78#undef DEBUG_FLOPPY_CONTROL_W
79#undef DEBUG_FLOPPY_CONTROL_R
80#undef DEBUG_FLOPPY_DATA_W
81#undef DEBUG_FLOPPY_DATA_R
82#undef DEBUG_FLOPPY_STATUS_R
83
84#undef DEBUG_PRINTER_DATA_W
85#undef DEBUG_PRINTER_CONTROL_W
86
87#undef DEBUG_MODEM_R
88#undef DEBUG_MODEM_W
89
90#undef DEBUG_DUART_OUTPUT_LINES
91
92#undef DEBUG_TEST_W
93
94// Includes
3495#include "emu.h"
3596#include "cpu/m68000/m68000.h"
3697#include "machine/68681.h"
r20428r20429
40101{
41102public:
42103   cat_state(const machine_config &mconfig, device_type type, const char *tag)
43      : driver_device(mconfig, type, tag) ,
104      : driver_device(mconfig, type, tag),
44105      m_p_sram(*this, "p_sram"),
45      m_p_videoram(*this, "p_videoram"){ }
106      m_p_videoram(*this, "p_videoram")
107      { }
46108
47109   DECLARE_WRITE16_MEMBER(cat_video_status_w);
48110   DECLARE_WRITE16_MEMBER(cat_test_mode_w);
49   DECLARE_READ16_MEMBER(cat_modem_r);
50   DECLARE_WRITE16_MEMBER(cat_modem_w);
51   DECLARE_READ16_MEMBER(cat_battery_r);
52   DECLARE_WRITE16_MEMBER(cat_printer_w);
53   DECLARE_READ16_MEMBER(cat_floppy_r);
54   DECLARE_WRITE16_MEMBER(cat_floppy_w);
111   DECLARE_READ16_MEMBER(cat_s35213_r);
112   DECLARE_WRITE16_MEMBER(cat_s35213_w);
113   DECLARE_READ16_MEMBER(cat_floppy_control_r);
114   DECLARE_WRITE16_MEMBER(cat_floppy_control_w);
115   DECLARE_WRITE16_MEMBER(cat_printer_data_w);
116   DECLARE_READ16_MEMBER(cat_floppy_data_r);
117   DECLARE_WRITE16_MEMBER(cat_floppy_data_w);
55118   DECLARE_READ16_MEMBER(cat_keyboard_r);
56119   DECLARE_WRITE16_MEMBER(cat_keyboard_w);
57   DECLARE_WRITE16_MEMBER(cat_video_w);
58   DECLARE_READ16_MEMBER(cat_something_r);
120   DECLARE_WRITE16_MEMBER(cat_video_control_w);
121   DECLARE_READ16_MEMBER(cat_floppy_status_r);
122   DECLARE_READ16_MEMBER(cat_battery_r);
123   DECLARE_WRITE16_MEMBER(cat_printer_control_w);
124   DECLARE_READ16_MEMBER(cat_2e80_r);
125   DECLARE_READ16_MEMBER(cat_0080_r);
126   DECLARE_READ16_MEMBER(cat_0000_r);
59127   optional_shared_ptr<UINT16> m_p_sram;
60128   required_shared_ptr<UINT16> m_p_videoram;
61129   UINT8 m_duart_inp;// = 0x0e;
r20428r20429
66134   DECLARE_MACHINE_START(cat);
67135   DECLARE_MACHINE_RESET(cat);
68136   DECLARE_VIDEO_START(cat);
137   DECLARE_DRIVER_INIT(cat);
69138   DECLARE_MACHINE_START(swyft);
70139   DECLARE_MACHINE_RESET(swyft);
71140   DECLARE_VIDEO_START(swyft);
r20428r20429
75144   TIMER_CALLBACK_MEMBER(swyft_reset);
76145};
77146
78WRITE16_MEMBER( cat_state::cat_video_status_w )
147// TODO: this init doesn't actually work yet! please fix me!
148/*
149DRIVER_INIT_MEMBER( cat_state,cat )
79150{
80   m_video_enable = BIT( data, 3 );
81}
151   UINT8 *svrom = machine().root_device().memregion("svrom")->base();
152   int i;
153   // fill svrom with the correct 2e80 pattern except where svrom1 sits
154   // first half
155   for (i = 0; i < 0x20000; i+=2)
156      svrom[i] = 0x2E;
157   // second half
158   for (i = 0x20000; i < 0x40000; i+=2)
159   {
160      svrom[i] = 0x2E;
161      svrom[i+1] = 0x80;
162   }
163}*/
82164
83165WRITE16_MEMBER( cat_state::cat_test_mode_w )
84166{
167#ifdef DEBUG_TEST_W
168   fprintf(stderr, "Test mode reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data);
169#endif
85170}
86171
87READ16_MEMBER( cat_state::cat_modem_r )
172// AMI S35213 300/1200 Single Chip Modem (datasheet found at http://bitsavers.trailing-edge.com/pdf/ami/_dataBooks/1985_AMI_MOS_Products_Catalog.pdf on pdf page 243)
173READ16_MEMBER( cat_state::cat_s35213_r )
88174{
89   return 0;
175#ifdef DEBUG_MODEM_R
176   fprintf(stderr,"Read from s35213 modem address %06X\n", 0x820000+(offset<<1));
177#endif
178// HACK: return default 'sane' modem state
179   return 0x00;
90180}
91181
92WRITE16_MEMBER( cat_state::cat_modem_w )
182WRITE16_MEMBER( cat_state::cat_s35213_w )
93183{
184#ifdef DEBUG_MODEM_W
185   fprintf(stderr,"Write to s35213 modem address %06X, data %04X\n", 0x820000+(offset<<1), data);
186#endif
94187}
95188
96READ16_MEMBER( cat_state::cat_battery_r )
189/* 0x600000-0x65ffff Write: Video Generator (AKA NH4-5001 AKA Gate Array #1 @ IC30)
190 writing to the video generator is done by putting the register number in the high 3 bits
191 and the data to write in the lower 12 (14?) bits.
192 The actual data-bus data written here is completely ignored,
193 in fact it isn't even connected to the gate array; The firmware writes 0x0000.
194 hence:
195 0 = must be 0
196 s = register select
197 d = data to write
198 ? = unknown
199 x = ignored
200 ? 1 1 ?  ? s s s  s ? ? ?  ? ? ? d  d d d d  d d d .
201 600xxx - VSE (End of Frame)
202 608xxx - VST (End of VSync)
203 610xxx - VSS (VSync Start)
204 618xxx - VDE (Active Lines) = value written * 4
205 620xxx - unknown
206 628xxx - unknown
207 630xxx - unknown
208 638xxx - unknown
209 640xxx - HSE (End H Line)
210 648xxx - HST (End HSync)
211 650xxx - HSS (HSync Start)
212 658xxx - VOC (Video Control)
213 */
214WRITE16_MEMBER( cat_state::cat_video_control_w )
97215{
98   /* just return that battery is full */
99   return 0x7fff;
216   /*
217    * 006500AE ,          ( HSS HSync Start    89 )
218    * 006480C2 ,          ( HST End HSync   96 )
219    * 006400CE ,          ( HSE End H Line    104 )
220    * 006180B0 ,          ( VDE Active Lines    344 )
221    * 006100D4 ,          ( VSS VSync Start   362 )
222    * 006080F4 ,          ( VST End of VSync    378 )
223    * 00600120 ,          ( VSE End of Frame    400 )
224    * 006581C0 ,          ( VOC Video Control Normal Syncs )
225    */
226#ifdef DEBUG_VIDEO_CONTROL_W
227   static const char *const regDest[16] = { "VSE (End of frame)", "VST (End of VSync)", "VSS (Start of VSync)", "VDE (Active Lines)", "unknown 620xxx", "unknown 628xxx", "unknown 630xxx", "unknown 638xxx", "HSE (end of horizontal line)", "HST (end of HSync)", "HSS (HSync Start)", "VOC (Video Control)", "unknown 660xxx", "unknown 668xxx", "unknown 670xxx", "unknown 678xxx" };
228   fprintf(stderr,"Write to video chip address %06X; %02X -> register %s with data %04X\n", 0x600000+(offset<<1), offset&0xFF, regDest[(offset&0x3C000)>>14], data);
229#endif
100230}
101231
102WRITE16_MEMBER( cat_state::cat_printer_w )
232// Floppy control register (called fd.cont in the cat source code)
233   /* FEDCBA98 (76543210 is ignored)
234    * |||||||\-- ?always low? (may be some sort of 'reset' or debug bit? the cat code explicitly clears this bit but never sets it)
235    * ||||||\--- WRITE GATE: 0 = write head disabled, 1 = write head enabled (verified from cat source code)
236    * |||||\---- ?always high? (leftover debug bit? unused by cat code)
237    * ||||\----- /DIRECTION: 1 = in, 0 = out (verified from forth cmd)
238    * |||\------ /SIDESEL: 1 = side1, 0 = side0 (verified from forth cmd)
239    * ||\------- STEP: 1 = STEP active, 0 = STEP inactive (verified from cat source code)
240    * |\-------- MOTOR ON: 1 = on, 0 = off (verified)
241    * \--------- /DRIVESELECT: 1 = drive 0, 0 = drive 1 (verified from forth cmd)
242    */
243// 0x800000-0x800001 read
244READ16_MEMBER( cat_state::cat_floppy_control_r )
103245{
104   m_pr_cont = data;
246#ifdef DEBUG_FLOPPY_CONTROL_R
247   fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800000+(offset<<1));
248#endif
249   return 0x0480;
105250}
251// 0x800000-0x800001 write
252WRITE16_MEMBER( cat_state::cat_floppy_control_w )
253{
254#ifdef DEBUG_FLOPPY_CONTROL_W
255   fprintf(stderr,"Write to Floppy Control address %06X, data %04X\n", 0x800000+(offset<<1), data);
256#endif
257}
106258
107READ16_MEMBER( cat_state::cat_floppy_r )
259// 0x800002-0x800003 read = 0x0080, see open bus
260// 0x800002-0x800003 write
261WRITE16_MEMBER( cat_state::cat_keyboard_w )
108262{
109   return 0;
263   m_keyboard_line = data >> 8;
110264}
111265
112WRITE16_MEMBER( cat_state::cat_floppy_w )
266// 0x800004-0x800005 write = printer data
267WRITE16_MEMBER( cat_state::cat_printer_data_w )
113268{
269#ifdef DEBUG_PRINTER_DATA_W
270   fprintf(stderr,"Write to Printer Data address %06X, data %04X\n", 0x800004+(offset<<1), data);
271#endif
114272}
273// 0x800006-0x800007: Floppy data register (called fd.dwr in the cat source code)
274READ16_MEMBER( cat_state::cat_floppy_data_r )
275{
276#ifdef DEBUG_FLOPPY_DATA_R
277   fprintf(stderr,"Read from Floppy Data address %06X\n", 0x800006+(offset<<1));
278#endif
279   return 0x0080;
280}
281WRITE16_MEMBER( cat_state::cat_floppy_data_w )
282{
283#ifdef DEBUG_FLOPPY_DATA_W
284   fprintf(stderr,"Write to Floppy Data address %06X, data %04X\n", 0x800006+(offset<<1), data);
285#endif
286}
115287
288
289// 0x800008-0x800009: Floppy status register (called fd.status in the cat source code)
290   /* FEDCBA98 (76543210 is ignored)
291    * |||||||\-- ? always low
292    * ||||||\--- ? always low
293    * |||||\---- READY: 1 = ready, 0 = not ready (verified from cat source code)
294    * ||||\----- /WRITE PROTECT: 1 = writable, 0 = protected (verified)
295    * |||\------ /TRACK0: 0 = on track 0, 1 = not on track 0 (verified)
296    * ||\------- /INDEX: 0 = index sensor active, 1 = index sensor inactive (verified)
297    * |\-------- ? low on drive 1, high on drive 0?
298    * \--------- ? usually high but occasionally low?
299    stuff that needs to be found here:
300    ready sense
301    */
302READ16_MEMBER( cat_state::cat_floppy_status_r )
303{
304#ifdef DEBUG_FLOPPY_STATUS_R
305   fprintf(stderr,"Read from Floppy Status address %06X\n", 0x800008+(offset<<1));
306#endif
307   return 0x0080;
308}
309
310// 0x80000a-0x80000b
116311READ16_MEMBER( cat_state::cat_keyboard_r )
117312{
118313   UINT16 retVal = 0;
r20428r20429
139334   return retVal;
140335}
141336
142WRITE16_MEMBER( cat_state::cat_keyboard_w )
337// 0x80000c-0x80000d (unused in cat source code; may have originally been a separate read only port where 800006 would have been write-only)
338
339// 0x80000e-0x80000f read
340READ16_MEMBER( cat_state::cat_battery_r )
143341{
144   m_keyboard_line = data >> 8;
342   /* just return that battery is full, i.e. bit 15 is 0 */
343   /* to make the cat think the battery is bad, return 0x8080 instead of 0x0080 */
344   // TODO: hook this to a dipswitch
345   return 0x0080;
145346}
347// 0x80000e-0x80000f write
348WRITE16_MEMBER( cat_state::cat_printer_control_w )
349{
350   /*
351    * FEDCBA98 (76543210 is ignored)
352    * |||||||\-- CC line enable (verified from cat source code)
353    * ||||||\--- LEDE line enable (verified from cat source code)
354    * |||||\---- ?
355    * ||||\----- ? always seems to be written as high?
356    * |||\------ ?
357    * ||\------- ?
358    * |\-------- ?
359    * \--------- ?
360    */
361   // writes of 0x0A00 turn on the keyboard LED on the LOCK key
362   // writes of 0x0800 turn off the keyboard LED on the LOCK key
363#ifdef DEBUG_PRINTER_CONTROL_W
364   fprintf(stderr,"Write to Printer Control address %06X, data %04X\n", (offset<<1)+0x80000e, data);
365#endif
366   m_pr_cont = data;
367}
146368
147WRITE16_MEMBER( cat_state::cat_video_w )
369WRITE16_MEMBER( cat_state::cat_video_status_w )
148370{
149/*
150 006500AE ,          ( HSS HSync Strart    89 )
151 006480C2 ,          ( HST End HSync   96 )
152 006400CE ,          ( HSE End H Line    104 )
153 006180B0 ,          ( VDE Active Lines    344 )
154 006100D4 ,          ( VSS VSync Start   362 )
155 006080F4 ,          ( VST End of VSync    378 )
156 00600120 ,          ( VSE End of Frame    400 )
157 006581C0 ,          ( VOC Video Control Normal Syncs )
158 */
371   /*
372    * 76543210
373    * |||||||\-- ?
374    * ||||||\--- ?
375    * |||||\---- Video enable (1 = video on, 0 = video off/screen black)
376    * ||||\----- ? (always written as 1?)
377    * |||\------ ? (always written as 1?)
378    * ||\------- ?
379    * |\-------- ?
380    * \--------- ?
381    */
382
383#ifdef DEBUG_VIDEO_STATUS_W
384   fprintf(stderr, "Video status reg write: offset %06X, data %04X\n", 0x840000+(offset<<1), data);
385#endif
386   m_video_enable = BIT( data, 2 );
159387}
160388
161READ16_MEMBER( cat_state::cat_something_r )
389// open bus etc handlers
390READ16_MEMBER( cat_state::cat_2e80_r )
162391{
163   return 0x00ff;
392   return 0x2e80;
164393}
165394
395READ16_MEMBER( cat_state::cat_0000_r )
396{
397   return 0x0000;
398}
399
400READ16_MEMBER( cat_state::cat_0080_r )
401{
402   return 0x0080;
403}
404
405
406/* Canon cat memory map, based on a 16MB dump of the entire address space of a running unit using forth "1000000 0 do i c@ semit loop"
40768k address map:
408a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13 a12 a11 a10 a9  a8  a7  a6  a5  a4  a3  a2  a1  (a0 via UDS/LDS)
4090   0   *   x   x   *   *   *   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x       *GATE ARRAY 2 DECODES THESE LINES TO ENABLE THIS AREA*
4100   0   0   0   x   0   a   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   b       R   ROM (ab: 00=ic4 01=ic2 10=ic5 11=ic3) (EPROM 27C512 x 4) [controlled via GA2 /ROMCS]
4110   0   0   0   x   1   0   0   x   x   *   *   *   *   *   *   *   *   *   *   *   *   *   0       RW  SVRAM ic11 d4364 (battery backed) [controlled via GA2 /RAMCS]
4120   0   0   0   x   1   x   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   0       O   OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?]
4130   0   0   0   x   1   1   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   0       O   OPEN BUS (reads as 0x2e) [may be controlled via GA2 /RAMCS?]
4140   0   0   0   x   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   1       O   OPEN BUS (reads as 0x80) [may be controlled via GA2 /RAMCS?]
4150   0   0   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x       O   BUS CONFLICT (reads as random garbage, corrupted copy based on when a20 is 0, some sort of bus collision? note GA2 can't see a20 so /ROMCS and /RAMCS lines are probably active here as above)
4160   0   1   x   x   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   0       R   SVROM 2 ic7 (not present on cat as sold, open bus reads as 0x2e) [controlled via GA2 /SVCS0]
4170   0   1   x   x   0   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   1       R   SVROM 0 ic6 (MASK ROM tc531000) [controlled via GA2 /SVCS0]
4180   0   1   x   x   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   0       O   OPEN BUS (reads as 0x2e) [controlled via GA2 /SVCS1] *SEE BELOW*
4190   0   1   x   x   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   1       R   SVROM 1 ic8 (not present on cat as sold, open bus reads as 0x80) [controlled via GA2 /SVCS1] *SEE BELOW*
420                                                                                                    *NOTE: on developer units, two 128K SRAMS are mapped in place of the two entries immediately above!* (this involves some creative wiring+sockets or an official IAI 'shadow ram board')
4210   1   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *       *BOTH GATE ARRAYS 1 and 2 DECODE THIS AREA; 2 DEALS WITH ADDR AND 1 WITH DATA/CAS/RAS*
4220   1   0   x   x   a   b   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *       RW  VIDEO/SYSTEM DRAM (ab: 00=row 0, ic26-29; 01=row 1, ic22-25; 10=row 2; ic18-21; 11=row 3; ic14-17)
423                                                                                                    *NOTE: DRAM rows 2 and 3 above are only usually populated in cat developer units!*
4240   1   1   ?   ?   *   *   *   ?   ?   ?   ?   ?   ?   ?   *   *   *   *   *   *   *   *   x       W   VIDEO CONTRL REGISTERS (reads as 0x2e80)
4251   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *   *   *   *   *       *GATE ARRAY 3 DECODES THIS AREA, GA3 IS ENABLED BY /IOCS1 FROM GA2*
4261   0   0   Y   Y   0   0   0   x   x   x   x   x   x   x   x   x   x   x   *   *   *   *   0       *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always
427                                                                            x   x   x   x   1       O   OPEN BUS (reads as 0x80)
428                                                                            0   0   0   0   0       RW  Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?)
429                                                                            0   0   0   1   0       W   Keyboard Row Select (reads as 0x00)
430                                                                            0   0   1   0   0       W   Centronics Printer Data W (reads as 0x00)
431                                                                            0   0   1   1   0       RW  Floppy data register
432                                                                            0   1   0   0   0       R   Floppy status lines (write protect, ready, index, track0)
433                                                                            0   1   0   1   0       R   Keyboard Column Read
434                                                                            0   1   1   0   0       W?  Unknown (reads as 0x00)
435                                                                            0   1   1   1   0       RW  Read: Battery status (MSB bit, 0 = ok, 1 = dead, other bits read as 0)/Write: Centronics Printer and Keyboard LED/Country Code Related
436                                                                            1   x   x   x   0       W?  Unknown (reads as 0x00)
4371   0   0   x   x   0   0   1   x   x   x   x   x   x   x   x   x   x   x   *   *   *   *   1       RW  68681 DUART at ic34 [controlled via GA2 /DUARTCS]
4381   0   0   x   x   0   1   0   x   x   x   x   x   x   x   x   x   x   *   *   *   *   *   0       RW  Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS]
4391   0   0   x   x   0   1   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       RW  Read: Fixed 16-bit counter. increments once per frame? Write: Modem Chip?
4401   0   0   x   x   1   0   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       W?  Video Control register? (screen enable on bit 3?) (reads as 0x2e80)
4411   0   0   x   x   1   0   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       R?  reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register?
4421   0   0   x   x   1   1   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       W?  Test register? (reads as 0x0000)
4431   0   0   x   x   1   1   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       ?   Unknown (reads as 0x2e80)
444
4451   0   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x       O   OPEN BUS (reads as 0x2e80)
4461   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x       O   OPEN BUS (reads as 0x2e80)
447*/
448
449
166450static ADDRESS_MAP_START(cat_mem, AS_PROGRAM, 16, cat_state)
167451   ADDRESS_MAP_UNMAP_HIGH
168   AM_RANGE(0x00000000, 0x0003ffff) AM_ROM // 256 KB ROM
169   AM_RANGE(0x00040000, 0x00043fff) AM_RAM AM_SHARE("p_sram") // SRAM powered by battery
170   AM_RANGE(0x00200000, 0x0027ffff) AM_ROM AM_REGION("svrom",0x0000) // SV ROM
171   AM_RANGE(0x00400000, 0x0047ffff) AM_RAM AM_SHARE("p_videoram") // 512 KB RAM
172   AM_RANGE(0x00600000, 0x0065ffff) AM_WRITE(cat_video_w) // Video chip
173   AM_RANGE(0x00800000, 0x00800001) AM_READWRITE(cat_floppy_r, cat_floppy_w)
174   AM_RANGE(0x00800002, 0x00800003) AM_WRITE(cat_keyboard_w)
175   AM_RANGE(0x00800008, 0x00800009) AM_READ(cat_something_r)
176   AM_RANGE(0x0080000a, 0x0080000b) AM_READ(cat_keyboard_r)
177   AM_RANGE(0x0080000e, 0x0080000f) AM_READWRITE(cat_battery_r,cat_printer_w)
178   AM_RANGE(0x00810000, 0x0081001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff )
179   AM_RANGE(0x00820000, 0x008200ff) AM_READWRITE(cat_modem_r, cat_modem_w)// modem
180   AM_RANGE(0x00840000, 0x00840001) AM_WRITE(cat_video_status_w) // Video status
181   AM_RANGE(0x00860000, 0x00860001) AM_WRITE(cat_test_mode_w) // Test mode
452   AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_MIRROR(0x080000) // 256 KB ROM
453   AM_RANGE(0x040000, 0x043fff) AM_RAM AM_SHARE("p_sram") AM_MIRROR(0x08C000)// SRAM powered by battery
454   AM_RANGE(0x200000, 0x27ffff) AM_ROM AM_REGION("svrom",0x0000) AM_MIRROR(0x180000) // SV ROM
455   AM_RANGE(0x400000, 0x47ffff) AM_RAM AM_SHARE("p_videoram") AM_MIRROR(0x180000) // 512 KB RAM
456   AM_RANGE(0x600000, 0x67ffff) AM_READWRITE(cat_2e80_r,cat_video_control_w) AM_MIRROR(0x180000) // Gate Array #1: Video
457   AM_RANGE(0x800000, 0x800001) AM_READWRITE(cat_floppy_control_r, cat_floppy_control_w) AM_MIRROR(0x18FFE0) // floppy control lines and readback
458   AM_RANGE(0x800002, 0x800003) AM_READWRITE(cat_0080_r, cat_keyboard_w) AM_MIRROR(0x18FFE0) // keyboard col write
459   AM_RANGE(0x800004, 0x800005) AM_READWRITE(cat_0080_r, cat_printer_data_w) AM_MIRROR(0x18FFE0) // Centronics Printer Data
460   AM_RANGE(0x800006, 0x800007) AM_READWRITE(cat_floppy_data_r,cat_floppy_data_w) AM_MIRROR(0x18FFE0) // floppy data read/write
461   AM_RANGE(0x800008, 0x800009) AM_READ(cat_floppy_status_r) AM_MIRROR(0x18FFE0) // floppy status lines
462   AM_RANGE(0x80000a, 0x80000b) AM_READ(cat_keyboard_r) AM_MIRROR(0x18FFE0) // keyboard row read
463   AM_RANGE(0x80000c, 0x80000d) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus?
464   AM_RANGE(0x80000e, 0x80000f) AM_READWRITE(cat_battery_r,cat_printer_control_w) AM_MIRROR(0x18FFE0) // Centronics Printer Control, keyboard led and country code enable
465   AM_RANGE(0x800010, 0x80001f) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus?
466   AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff ) AM_MIRROR(0x18FFE0)
467   AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_s35213_r,cat_s35213_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7
468   //AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter) AM_MIRROR(0x18FFFE) // 6ms counter?
469   AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_video_status_w) AM_MIRROR(0x18FFFE) // Video status/Output port register
470   //AM_RANGE(0x850000, 0x850001) AM_READ(cat_video_status) AM_MIRROR(0x18FFFE) // video status read: hblank, vblank or draw?
471   AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_test_mode_w) AM_MIRROR(0x18FFFE) // Test mode
472   AM_RANGE(0x870000, 0x870001) AM_READ(cat_2e80_r) AM_MIRROR(0x18FFFE) // Open bus?
473   AM_RANGE(0xA00000, 0xA00001) AM_READ(cat_2e80_r) AM_MIRROR(0x1FFFFE) // Open bus?
474   AM_RANGE(0xC00000, 0xC00001) AM_READ(cat_2e80_r) AM_MIRROR(0x3FFFFE) // Open bus?
182475ADDRESS_MAP_END
183476
184477static ADDRESS_MAP_START(swyft_mem, AS_PROGRAM, 16, cat_state)
r20428r20429
226519
227520   PORT_START("LINE1")
228521   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('n') PORT_CHAR('B')
229   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
522   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
230523   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
231524   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
232525   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
r20428r20429
236529
237530   PORT_START("LINE2")
238531   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
239   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.')
532   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
240533   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
241534   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
242535   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
r20428r20429
269562   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
270563   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
271564   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
272   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\xbd') PORT_CHAR('\xbc')
565   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('\xbd') PORT_CHAR('\xbc') //PORT_CHAR('}') PORT_CHAR('{')
273566   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
274567   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
275568   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
r20428r20429
289582   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Leap") PORT_CODE(KEYCODE_RALT)
290583   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Page") PORT_CODE(KEYCODE_PGUP) PORT_CODE(KEYCODE_PGDN)
291584   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK)
292   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE)
585   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Erase") PORT_CODE(KEYCODE_BACKSPACE)
293586   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
294587   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UNDO") PORT_CODE(KEYCODE_BACKSLASH)
295   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xb1') PORT_CHAR('\xb0')
588   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('\xb1') PORT_CHAR('\xb0') // PORT_CHAR('\\') PORT_CHAR('~')
296589INPUT_PORTS_END
297590
298591static INPUT_PORTS_START( swyft )
r20428r20429
418711   }
419712}
420713
714// TODO: hook to speaker and dtmf generator
715static void duart_output(device_t *device, UINT8 data)
716{
717#ifdef DEBUG_DUART_OUTPUT_LINES
718   fprintf(stderr,"Duart output io lines changed to: %02X\n", data);
719#endif
720}
721
421722static const duart68681_config cat_duart68681_config =
422723{
423724   duart_irq_handler,
424725   duart_tx,
425726   duart_input,
426   NULL
727   duart_output
427728};
428729
429730static MACHINE_CONFIG_START( cat, cat_state )
430731
431732   /* basic machine hardware */
432   MCFG_CPU_ADD("maincpu",M68000, XTAL_5MHz)
733   MCFG_CPU_ADD("maincpu",M68000, XTAL_19_968MHz/4)
433734   MCFG_CPU_PROGRAM_MAP(cat_mem)
434735
435736   MCFG_MACHINE_START_OVERRIDE(cat_state,cat)
r20428r20429
448749
449750   MCFG_VIDEO_START_OVERRIDE(cat_state,cat)
450751
451   MCFG_DUART68681_ADD( "duart68681", XTAL_5MHz, cat_duart68681_config )
752   MCFG_DUART68681_ADD( "duart68681", XTAL_19_968MHz*2/11, cat_duart68681_config ) // duart is normally clocked by 3.6864mhz xtal, but cat uses a divider from the main xtal instead which yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire
452753
453754   MCFG_NVRAM_ADD_0FILL("nvram")
454755MACHINE_CONFIG_END
r20428r20429
486787ROM_START( cat )
487788   ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF )
488789   // SYS ROM
489   ROM_LOAD16_BYTE( "r240l0.bin", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432) )
490   ROM_LOAD16_BYTE( "r240h0.bin", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc) )
491   ROM_LOAD16_BYTE( "r240l1.bin", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34) )
492   ROM_LOAD16_BYTE( "r240h1.bin", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075) )
790   ROM_SYSTEM_BIOS( 0, "r240", "Canon Cat V2.40 Firmware")
791   ROMX_LOAD( "r240l0.ic2", 0x00001, 0x10000, CRC(1b89bdc4) SHA1(39c639587dc30f9d6636b46d0465f06272838432), ROM_SKIP(1) | ROM_BIOS(1))
792   ROMX_LOAD( "r240h0.ic4", 0x00000, 0x10000, CRC(94f89b8c) SHA1(6c336bc30636a02c625d31f3057ec86bf4d155fc), ROM_SKIP(1) | ROM_BIOS(1))
793   ROMX_LOAD( "r240l1.ic3", 0x20001, 0x10000, CRC(1a73be4f) SHA1(e2de2cb485f78963368fb8ceba8fb66ca56dba34), ROM_SKIP(1) | ROM_BIOS(1))
794   ROMX_LOAD( "r240h1.ic5", 0x20000, 0x10000, CRC(898dd9f6) SHA1(93e791dd4ed7e4afa47a04df6fdde359e41c2075), ROM_SKIP(1) | ROM_BIOS(1))
795   ROM_SYSTEM_BIOS( 1, "r174", "Canon Cat V1.74 Firmware")
796   // Canon cat v1.74 roms are labeled as r74; they only added the major number to the rom label after 2.0
797   ROMX_LOAD( "r74__0l__c18c.blue.ic2", 0x00001, 0x10000, CRC(b19aa0c8) SHA1(85b3e549cfb91bd3dd32335e02eaaf9350e80900), ROM_SKIP(1) | ROM_BIOS(2))
798   ROMX_LOAD( "r74__0h__75a6.yellow.ic4", 0x00000, 0x10000, CRC(75281f77) SHA1(ed8b5e37713892ee83413d23c839d09e2fd2c1a9), ROM_SKIP(1) | ROM_BIOS(2))
799   ROMX_LOAD( "r74__1l__c8a3.green.ic3", 0x20001, 0x10000, CRC(93275558) SHA1(f690077a87076fd51ae385ac5a455804cbc43c8f), ROM_SKIP(1) | ROM_BIOS(2))
800   ROMX_LOAD( "r74__1h__3c37.white.ic5", 0x20000, 0x10000, CRC(5d7c3962) SHA1(8335993583fdd30b894c01c1a7a6aca61cd81bb4), ROM_SKIP(1) | ROM_BIOS(2))
493801
494   ROM_REGION( 0x80000, "svrom", ROMREGION_ERASEFF )
802   ROM_REGION( 0x80000, "svrom", ROMREGION_ERASE00 )
803   // SPELLING VERIFICATION ROM (SVROM)
804   // since ROM_FILL16BE(0x0, 0x80000, 0x2e80) doesn't exist, the even bytes and latter chunk of the svrom space are filled in in DRIVER_INIT
805   // Romspace here is a little strange: there are 3 rom sockets on the board:
806   // svrom-0 maps to 200000-21ffff every ODD byte (d8-d0)
807   ROMX_LOAD( "uv1__nh7-0684__hn62301apc11__7h1.ic6", 0x00000, 0x20000, CRC(229CA210) SHA1(564B57647A34ACDD82159993A3990A412233DA14), ROM_SKIP(1)) // this is a 28pin tc531000 mask rom, 128KB long
808   // svrom-1 maps to 200000-21ffff every EVEN byte (d15-d7)
809   // no rom is in the socket; it reads as open bus 0x2E
810   // svrom-2 maps to 240000-25ffff every ODD byte (d8-d0)
811   // no rom is in the socket; it reads as open bus 0x80
812   // there is no svrom-3; 240000-25ffff EVEN always reads as 0x2E
495813ROM_END
496814
497815/* Driver */
498816
499/*    YEAR  NAME  PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
500COMP( 1985, swyft,0,       0,      swyft,    swyft, driver_device,    0,   "Information Applicance Inc", "Swyft", GAME_NOT_WORKING | GAME_NO_SOUND)
501COMP( 1987, cat,  swyft,   0,      cat,      cat, driver_device,      0,   "Canon",   "Cat", GAME_NOT_WORKING | GAME_NO_SOUND)
817/*    YEAR  NAME  PARENT  COMPAT   MACHINE    INPUT    DEVICE         INIT     COMPANY   FULLNAME       FLAGS */
818COMP( 1985, swyft,0,      0,       swyft,     swyft,   driver_device, 0,       "Information Applicance Inc", "Swyft", GAME_NOT_WORKING | GAME_NO_SOUND)
819COMP( 1987, cat,  swyft,  0,       cat,       cat,     driver_device, 0,       "Canon",  "Cat", GAME_NOT_WORKING | GAME_NO_SOUND)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team