Previous 199869 Revisions Next

r20475 Friday 25th January, 2013 at 22:06:08 UTC by Jonathan Gevaryahu
(MESS) cat.c (Canon Cat): implemented video invert bit, added notes about what some of the registers are called in the original source code [Lord Nightmare]
[src/mess/drivers]cat.c

trunk/src/mess/drivers/cat.c
r20474r20475
182182   DECLARE_READ16_MEMBER(cat_modem_r);
183183   DECLARE_WRITE16_MEMBER(cat_modem_w);
184184   DECLARE_READ16_MEMBER(cat_6ms_counter_r);
185   DECLARE_WRITE16_MEMBER(cat_video_enable_w);
186   DECLARE_WRITE16_MEMBER(cat_test_mode_w);
185   DECLARE_WRITE16_MEMBER(cat_opr_w);
186   DECLARE_WRITE16_MEMBER(cat_tcb_w);
187187   DECLARE_READ16_MEMBER(cat_2e80_r);
188188   DECLARE_READ16_MEMBER(cat_0080_r);
189189   DECLARE_READ16_MEMBER(cat_0000_r);
r20474r20475
198198    */
199199   UINT16 m_6ms_counter;
200200   UINT8 m_video_enable;
201   UINT8 m_video_invert;
201202   UINT16 m_pr_cont;
202203   UINT8 m_keyboard_line;
203204
r20474r20475
425426   return m_6ms_counter;
426427}
427428
428// 0x840000: video enable (also controls hsync/vsync?)
429WRITE16_MEMBER( cat_state::cat_video_enable_w )
429/* 0x840001: 'opr' Output Port Register
430 * writing 0x1c (or possibly anything) here resets the watchdog
431 * if the watchdog expires an NMI is sent to the cpu
432 */
433WRITE16_MEMBER( cat_state::cat_opr_w )
430434{
431435   /*
432    * 76543210
436    * 76543210 (FEDCBA98 are ignored)
433437    * |||||||\-- ?
434438    * ||||||\--- ?
435439    * |||||\---- Video enable (1 = video on, 0 = video off/screen black)
436    * ||||\----- ? (always written as 1?) maybe hsync
437    * |||\------ ? (always written as 1?) maybe vsync
440    * ||||\----- Watchdog reset?
441    * |||\------ Video invert (1 = black-on-white video; 0 = white-on-black)
438442    * ||\------- ?
439443    * |\-------- ?
440444    * \--------- ?
441445    */
442
443446#ifdef DEBUG_VIDEO_ENABLE_W
447   //if ((data&0xef)!= 0x0c)
444448   fprintf(stderr, "Video enable reg write: offset %06X, data %04X\n", 0x840000+(offset<<1), data);
445449#endif
446450   m_video_enable = BIT( data, 2 );
451   m_video_invert = 1-BIT( data, 4 );
447452}
448453
449// 0x850000: test mode registers
450WRITE16_MEMBER( cat_state::cat_test_mode_w )
454// 0x850000: watchdog timer/video status
455// implement me!
456
457// 0x860000: test regitser
458// the power fail status reset bit also lives here somewhere?
459WRITE16_MEMBER( cat_state::cat_tcb_w )
451460{
452461#ifdef DEBUG_TEST_W
453   fprintf(stderr, "Test mode reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data);
462   fprintf(stderr, "Test reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data);
454463#endif
455464}
456465
r20474r20475
491500                                                                                                    *NOTE: DRAM rows 2 and 3 above are only usually populated in cat developer units!*
4925010   1   1   ?   ?   *   *   *   ?   ?   ?   ?   ?   ?   ?   *   *   *   *   *   *   *   *   x       W   VIDEO CONTRL REGISTERS (reads as 0x2e80)
4935021   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*
4941   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
5031   0   0   Y   Y   0   0   0   x   x   x   x   x   x   x   x   x   x   x   *   *   *   *   0       {'ga3'} *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always
495504                                                                            x   x   x   x   1       O   OPEN BUS (reads as 0x80)
496                                                                            0   0   0   0   0       RW  Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?)
497                                                                            0   0   0   1   0       W   Keyboard Row Select (reads as 0x00)
498                                                                            0   0   1   0   0       W   Centronics Printer Data W (reads as 0x00)
499                                                                            0   0   1   1   0       RW  Floppy data register
500                                                                            0   1   0   0   0       R   Floppy status lines (write protect, ready, index, track0)
505                                                                            0   0   0   0   0       RW  {'fd.cont'} Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?)
506                                                                            0   0   0   1   0       W   {'kb.wr'} Keyboard Row Select (reads as 0x00)
507                                                                            0   0   1   0   0       W   {'pr.data'} Centronics Printer Data W (reads as 0x00)
508                                                                            0   0   1   1   0       RW  {'fd.dwr' and 'fd.drd'} Floppy data read/write register; maybe the write gate value in fd.cont chooses which?
509                                                                            0   1   0   0   0       R   {'fd.status'} Floppy status lines (write protect, ready, index, track0)
501510                                                                            0   1   0   1   0       R   Keyboard Column Read
502511                                                                            0   1   1   0   0       W?  Unknown (reads as 0x00)
503512                                                                            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
504513                                                                            1   x   x   x   0       W?  Unknown (reads as 0x00)
5051   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]
5061   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]
5071   0   0   x   x   0   1   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       R   Read: Fixed 16-bit counter from ga2. increments once another 16-bit counter clocked at 10mhz overflows
5081   0   0   x   x   1   0   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       W?  Video/Sync enable register? (screen enable on bit 3?) (reads as 0x2e80)
5091   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?
5101   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)
5141   0   0   x   x   0   0   1   x   x   x   x   x   x   x   x   x   x   x   *   *   *   *   1       RW  {'duart'} 68681 DUART at ic34 [controlled via GA2 /DUARTCS]
5151   0   0   x   x   0   1   0   x   x   x   x   x   x   x   x   x   x   *   *   *   *   *   0       RW  {'modem'} Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS]
5161   0   0   x   x   0   1   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       R   {'timer'} Read: Fixed 16-bit counter from ga2. increments every 6.5535ms when another 16-bit counter clocked at 10mhz overflows
5171   0   0   x   x   1   0   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       W   {'opr'} Output Port (Video/Sync enable and watchdog reset?) register (screen enable on bit 3?) (reads as 0x2e80)
5181   0   0   x   x   1   0   1   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       R   {'wdt'} Watchdog timer reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register?
5191   0   0   x   x   1   1   0   x   x   x   x   x   x   x   x   x   x   x   x   x   x   x   *       R?W {'tcb'} test control bits: powerfail status in bit <?> (reads as 0x0000)
5115201   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)
512521
5135221   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)
r20474r20475
534543   AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff ) AM_MIRROR(0x18FFE0)
535544   AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_modem_r,cat_modem_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7
536545   AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter_r) AM_MIRROR(0x18FFFE) // 16bit 6ms counter clocked by output of another 16bit counter clocked at 10mhz
537   AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_video_enable_w) AM_MIRROR(0x18FFFE) // Video status/Output port register
538   //AM_RANGE(0x850000, 0x850001) AM_READ(cat_video_status) AM_MIRROR(0x18FFFE) // video status read: hblank, vblank or draw?
539   AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_test_mode_w) AM_MIRROR(0x18FFFE) // Test mode
546   AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_opr_w) AM_MIRROR(0x18FFFE) // Output port register (video enable, invert, watchdog reset)
547   //AM_RANGE(0x850000, 0x850001) AM_READ(cat_video_status) AM_MIRROR(0x18FFFE) // video status and watchdog read: hblank, vblank or draw?
548   AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_tcb_w) AM_MIRROR(0x18FFFE) // Test mode
540549   AM_RANGE(0x870000, 0x870001) AM_READ(cat_2e80_r) AM_MIRROR(0x18FFFE) // Open bus?
541550   AM_RANGE(0xA00000, 0xA00001) AM_READ(cat_2e80_r) AM_MIRROR(0x1FFFFE) // Open bus?
542551   AM_RANGE(0xC00000, 0xC00001) AM_READ(cat_2e80_r) AM_MIRROR(0x3FFFFE) // Open bus?
r20474r20475
682691{
683692   m_duart_inp = 0x0e;
684693   m_6ms_counter = 0;
694   m_video_enable = 1;
695   m_video_invert = 0;
685696   m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::keyboard_callback),this));
686697   m_6ms_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::counter_6ms_callback),this));
687698   machine().device<nvram_device>("nvram")->set_base(m_svram, 0x4000);
r20474r20475
715726            code = m_p_videoram[addr++];
716727            for (b = 15; b >= 0; b--)
717728            {
718               bitmap.pix16(y, horpos++) = (code >> b) & 0x01;
729               bitmap.pix16(y, horpos++) = ((code >> b) & 0x01) ^ m_video_invert;
719730            }
720731         }
721732      }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team