Previous 15994 Revisions Next

r1690 Monday 18th February, 2008 at 19:01:53 UTC by Wilbert Pol
[GAMEPOCK] LCD updates are now triggered when bit 1 of port A changes.
[src/mess/machine]gamepock.c

src/mess/machine/gamepock.c
r1689r1690
1414static HD44102CH hd44102ch[3];
1515
1616static void hd44102ch_w( int which, int c_d, UINT8 data ) {
17   //logerror("HD44102CH #%d write %s %02X ", which, ( c_d ) ? "data" : "command",  data );
1817   if ( c_d ) {
1918      UINT8   y;
2019      /* Data */
21      //logerror("write to %02X", hd44102ch[which].address );
2220      hd44102ch[which].ram[ hd44102ch[which].address ] = data;
2321
2422      /* Increment/decrement Y counter */
r1689r1690
3432      /* Command */
3533      switch ( data ) {
3634      case 0x38:      /* Display off */
37         //logerror("display off");
3835         hd44102ch[which].enabled = 0;
3936         break;
4037      case 0x39:      /* Display on */
41         //logerror("display on");
4238         hd44102ch[which].enabled = 1;
4339         break;
4440      case 0x3A:      /* Y decrement mode */
45         //logerror("y decrement mode");
4641         hd44102ch[which].y_inc = 0xFF;
4742         break;
4843      case 0x3B:      /* Y increment mode */
49         //logerror("y increment mode");
5044         hd44102ch[which].y_inc = 0x01;
5145         break;
5246      case 0x3E:      /* Display start page #0 */
5347      case 0x7E:      /* Display start page #1 */
5448      case 0xBE:      /* Display start page #2 */
5549      case 0xFE:      /* Display start page #3 */
56         //logerror("set start page %d", data >> 6 );
5750         hd44102ch[which].start_page = data & 0xC0;
5851         break;
5952      default:
6053         if ( ( data & 0x3F ) < 50 ) {
61            //logerror("set X/Y address %02X", data );
6254            hd44102ch[which].address = data;
6355         }
6456         break;
6557      }
6658   }
67   //logerror("\n");
6859}
6960
7061static void hd44102ch_init( int which ) {
r1689r1690
7364}
7465
7566static void gamepock_lcd_update(void) {
76   if ( gamepock_port_a & 0x02 ) {
77      /* Check whether HD44102CH #1 is enabled */
78      if ( gamepock_port_a & 0x08 ) {
79         hd44102ch_w( 0, gamepock_port_a & 0x04, gamepock_port_b );
80      }
67   /* Check whether HD44102CH #1 is enabled */
68   if ( gamepock_port_a & 0x08 ) {
69      hd44102ch_w( 0, gamepock_port_a & 0x04, gamepock_port_b );
70   }
8171
82      /* Check whether HD44102CH #2 is enabled */
83      if ( gamepock_port_a & 0x10 ) {
84         hd44102ch_w( 1, gamepock_port_a & 0x04, gamepock_port_b );
85      }
72   /* Check whether HD44102CH #2 is enabled */
73   if ( gamepock_port_a & 0x10 ) {
74      hd44102ch_w( 1, gamepock_port_a & 0x04, gamepock_port_b );
75   }
8676
87      /* Check whether HD44102CH #3 is enabled */
88      if ( gamepock_port_a & 0x20 ) {
89         hd44102ch_w( 2, gamepock_port_a & 0x04, gamepock_port_b );
90      }
77   /* Check whether HD44102CH #3 is enabled */
78   if ( gamepock_port_a & 0x20 ) {
79      hd44102ch_w( 2, gamepock_port_a & 0x04, gamepock_port_b );
9180   }
9281}
9382
9483WRITE8_HANDLER( gamepock_port_a_w ) {
84   UINT8   old_port_a = gamepock_port_a;
85
9586   gamepock_port_a = data;
9687
97   gamepock_lcd_update();
88   if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) ) {
89      gamepock_lcd_update();
90   }
9891}
9992
10093WRITE8_HANDLER( gamepock_port_b_w ) {
10194   gamepock_port_b = data;
102
103   gamepock_lcd_update();
10495}
10596
10697READ8_HANDLER( gamepock_port_b_r ) {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team