src/mess/machine/gamepock.c
| r1689 | r1690 | |
| 14 | 14 | static HD44102CH hd44102ch[3]; |
| 15 | 15 | |
| 16 | 16 | static void hd44102ch_w( int which, int c_d, UINT8 data ) { |
| 17 | | //logerror("HD44102CH #%d write %s %02X ", which, ( c_d ) ? "data" : "command", data ); |
| 18 | 17 | if ( c_d ) { |
| 19 | 18 | UINT8 y; |
| 20 | 19 | /* Data */ |
| 21 | | //logerror("write to %02X", hd44102ch[which].address ); |
| 22 | 20 | hd44102ch[which].ram[ hd44102ch[which].address ] = data; |
| 23 | 21 | |
| 24 | 22 | /* Increment/decrement Y counter */ |
| r1689 | r1690 | |
| 34 | 32 | /* Command */ |
| 35 | 33 | switch ( data ) { |
| 36 | 34 | case 0x38: /* Display off */ |
| 37 | | //logerror("display off"); |
| 38 | 35 | hd44102ch[which].enabled = 0; |
| 39 | 36 | break; |
| 40 | 37 | case 0x39: /* Display on */ |
| 41 | | //logerror("display on"); |
| 42 | 38 | hd44102ch[which].enabled = 1; |
| 43 | 39 | break; |
| 44 | 40 | case 0x3A: /* Y decrement mode */ |
| 45 | | //logerror("y decrement mode"); |
| 46 | 41 | hd44102ch[which].y_inc = 0xFF; |
| 47 | 42 | break; |
| 48 | 43 | case 0x3B: /* Y increment mode */ |
| 49 | | //logerror("y increment mode"); |
| 50 | 44 | hd44102ch[which].y_inc = 0x01; |
| 51 | 45 | break; |
| 52 | 46 | case 0x3E: /* Display start page #0 */ |
| 53 | 47 | case 0x7E: /* Display start page #1 */ |
| 54 | 48 | case 0xBE: /* Display start page #2 */ |
| 55 | 49 | case 0xFE: /* Display start page #3 */ |
| 56 | | //logerror("set start page %d", data >> 6 ); |
| 57 | 50 | hd44102ch[which].start_page = data & 0xC0; |
| 58 | 51 | break; |
| 59 | 52 | default: |
| 60 | 53 | if ( ( data & 0x3F ) < 50 ) { |
| 61 | | //logerror("set X/Y address %02X", data ); |
| 62 | 54 | hd44102ch[which].address = data; |
| 63 | 55 | } |
| 64 | 56 | break; |
| 65 | 57 | } |
| 66 | 58 | } |
| 67 | | //logerror("\n"); |
| 68 | 59 | } |
| 69 | 60 | |
| 70 | 61 | static void hd44102ch_init( int which ) { |
| r1689 | r1690 | |
| 73 | 64 | } |
| 74 | 65 | |
| 75 | 66 | static 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 | } |
| 81 | 71 | |
| 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 | } |
| 86 | 76 | |
| 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 ); |
| 91 | 80 | } |
| 92 | 81 | } |
| 93 | 82 | |
| 94 | 83 | WRITE8_HANDLER( gamepock_port_a_w ) { |
| 84 | UINT8 old_port_a = gamepock_port_a; |
| 85 | |
| 95 | 86 | gamepock_port_a = data; |
| 96 | 87 | |
| 97 | | gamepock_lcd_update(); |
| 88 | if ( ! ( old_port_a & 0x02 ) && ( gamepock_port_a & 0x02 ) ) { |
| 89 | gamepock_lcd_update(); |
| 90 | } |
| 98 | 91 | } |
| 99 | 92 | |
| 100 | 93 | WRITE8_HANDLER( gamepock_port_b_w ) { |
| 101 | 94 | gamepock_port_b = data; |
| 102 | | |
| 103 | | gamepock_lcd_update(); |
| 104 | 95 | } |
| 105 | 96 | |
| 106 | 97 | READ8_HANDLER( gamepock_port_b_r ) { |