trunk/src/mess/drivers/clcd.c
| r20487 | r20488 | |
| 15 | 15 | #include "machine/6551acia.h" |
| 16 | 16 | #include "rendlay.h" |
| 17 | 17 | |
| 18 | | static const char *const keyColumns[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5", "COL6", "COL7" }; |
| 19 | | |
| 20 | 18 | class clcd_state : public driver_device |
| 21 | 19 | { |
| 22 | 20 | public: |
| r20487 | r20488 | |
| 24 | 22 | : driver_device(mconfig, type, tag), |
| 25 | 23 | m_ram(*this,"ram"), |
| 26 | 24 | keyClockState(0), |
| 27 | | keyReadState(0) |
| 25 | keyReadState(0), |
| 26 | m_col0(*this,"COL0"), |
| 27 | m_col1(*this,"COL1"), |
| 28 | m_col2(*this,"COL2"), |
| 29 | m_col3(*this,"COL3"), |
| 30 | m_col4(*this,"COL4"), |
| 31 | m_col5(*this,"COL5"), |
| 32 | m_col6(*this,"COL6"), |
| 33 | m_col7(*this,"COL7"), |
| 34 | m_special(*this,"SPECIAL") |
| 28 | 35 | { |
| 29 | 36 | } |
| 30 | 37 | |
| r20487 | r20488 | |
| 68 | 75 | keyColumnSelect = data; |
| 69 | 76 | } |
| 70 | 77 | |
| 78 | int read_column( int column ) |
| 79 | { |
| 80 | switch( column ) |
| 81 | { |
| 82 | case 0: |
| 83 | return m_col0->read(); |
| 84 | |
| 85 | case 1: |
| 86 | return m_col1->read(); |
| 87 | |
| 88 | case 2: |
| 89 | return m_col2->read(); |
| 90 | |
| 91 | case 3: |
| 92 | return m_col3->read(); |
| 93 | |
| 94 | case 4: |
| 95 | return m_col4->read(); |
| 96 | |
| 97 | case 5: |
| 98 | return m_col5->read(); |
| 99 | |
| 100 | case 6: |
| 101 | return m_col6->read(); |
| 102 | |
| 103 | case 7: |
| 104 | return m_col7->read(); |
| 105 | } |
| 106 | |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 71 | 110 | WRITE8_MEMBER( via0_pb_w ) |
| 72 | 111 | { |
| 73 | 112 | int newKeyReadState = data & 1; |
| r20487 | r20488 | |
| 77 | 116 | |
| 78 | 117 | if( newKeyReadState != 0 ) |
| 79 | 118 | { |
| 80 | | keyData = ioport( "SPECIAL" )->read(); |
| 119 | keyData = m_special->read(); |
| 81 | 120 | |
| 82 | 121 | for( int i = 0; i < 8; i++ ) |
| 83 | 122 | { |
| 84 | 123 | if( ( keyColumnSelect & ( 128 >> i ) ) == 0 ) |
| 85 | 124 | { |
| 86 | | keyData |= ioport( keyColumns[ i ] )->read() << 8; |
| 125 | keyData |= read_column( i ) << 8; |
| 87 | 126 | } |
| 88 | 127 | } |
| 89 | 128 | |
| r20487 | r20488 | |
| 125 | 164 | int keyClockState; |
| 126 | 165 | int keyReadState; |
| 127 | 166 | virtual void palette_init(); |
| 167 | required_ioport m_col0; |
| 168 | required_ioport m_col1; |
| 169 | required_ioport m_col2; |
| 170 | required_ioport m_col3; |
| 171 | required_ioport m_col4; |
| 172 | required_ioport m_col5; |
| 173 | required_ioport m_col6; |
| 174 | required_ioport m_col7; |
| 175 | required_ioport m_special; |
| 128 | 176 | }; |
| 129 | 177 | |
| 130 | 178 | static ADDRESS_MAP_START( clcd_mem, AS_PROGRAM, 8, clcd_state ) |