src/mess/drivers/glasgow.c
| r6463 | r6464 | |
| 20 | 20 | 1*74LS367 3 State Hex Buffers |
| 21 | 21 | |
| 22 | 22 | |
| 23 | Made playable by Robbbert in Nov 2009. |
| 24 | |
| 25 | How to play (quick guide) |
| 26 | 1. You are the white player. |
| 27 | 2. Click on the piece to move (LED starts flashing), then click where it goes |
| 28 | 3. Computer plays black, it will work out its move and beep. |
| 29 | 4. Read the move in the display, or look for the flashing LEDs. |
| 30 | 5. Move the computer's piece in the same way you moved yours. |
| 31 | 6. If a piece is being taken, firstly click on the piece then click the blank |
| 32 | area at bottom right. This causes the piece to disappear. After that, |
| 33 | move the piece that took the other piece. |
| 34 | 7. You'll need to read the official user manual for advanced features, or if |
| 35 | you get messages such as "Err1". |
| 36 | |
| 37 | Note about clickable artwork: it seems the horizontal coordinates can vary |
| 38 | between computers. The supplied artwork at svn r6463 works with my |
| 39 | computer; it may be out of alignment on yours. |
| 40 | |
| 41 | |
| 23 | 42 | ***************************************************************************/ |
| 24 | 43 | |
| 25 | 44 | #include "driver.h" |
| r6463 | r6464 | |
| 31 | 50 | static UINT8 lcd_shift_counter; |
| 32 | 51 | // static UINT8 led_status; |
| 33 | 52 | static UINT8 led7; |
| 34 | | static UINT8 key_low, |
| 35 | | key_hi, |
| 36 | | key_select, |
| 53 | static UINT8 key_select, |
| 37 | 54 | irq_flag, |
| 38 | 55 | lcd_invert, |
| 39 | 56 | key_selector; |
| r6463 | r6464 | |
| 44 | 61 | static UINT16 Line18_REED; |
| 45 | 62 | |
| 46 | 63 | static UINT8 read_board_flag; |
| 64 | static UINT8 mouse_hold = 0; |
| 47 | 65 | |
| 48 | | static const char EMP[4] = "EMP"; |
| 49 | | |
| 50 | 66 | typedef struct { |
| 51 | | unsigned int field; |
| 52 | | unsigned int x; |
| 53 | | unsigned int y; |
| 54 | | unsigned char piece[4]; |
| 67 | UINT8 field; |
| 68 | UINT8 piece; |
| 55 | 69 | } BOARD_FIELD; |
| 56 | 70 | |
| 57 | 71 | static BOARD_FIELD m_board[8][8]; |
| 58 | 72 | |
| 73 | /* starts at bottom left corner */ |
| 59 | 74 | static const BOARD_FIELD start_board[8][8] = |
| 60 | 75 | { |
| 61 | | { { 7,44,434,"WR1"}, { 6,100,434,"WN1"}, { 5,156,434,"WB1"}, { 4,212,434,"WQ1"}, { 3,268,434,"WK"}, { 2,324,434,"WB2"}, { 1,380,434,"WN2"}, { 0,436,434,"WR2"} }, |
| 62 | | { {15,44,378,"WP1"}, {14,100,378,"WP2"}, {13,156,378,"WP3"}, {12,212,378,"WP4"}, {11,268,378,"WP5"}, {10,324,378,"WP6"}, { 9,380,378,"WP7"}, { 8,436,378,"WP8"} }, |
| 76 | { {7,10}, {6,8}, {5,9}, {4,11}, {3,12}, {2,9}, {1,8}, {0,10} }, |
| 77 | { {15,7}, {14,7}, {13,7}, {12,7}, { 11,7}, {10,7}, {9,7}, {8,7} }, |
| 63 | 78 | |
| 64 | | { {23,44,322, "EMP"}, {22,100,322, "EMP"}, {21,156,322, "EMP"}, {20,212,322, "EMP"}, {19,268,322, "EMP"}, {18,324,322, "EMP"}, {17,380,322, "EMP"}, {16,436,322, "EMP"} }, |
| 65 | | { {31,44,266, "EMP"}, {30,100,266, "EMP"}, {29,156,266, "EMP"}, {28,212,266, "EMP"}, {27,268,266, "EMP"}, {26,324,266, "EMP"}, {25,380,266, "EMP"}, {24,436,266, "EMP"} }, |
| 66 | | { {39,44,210, "EMP"}, {38,100,210, "EMP"}, {37,156,210, "EMP"}, {36,212,210, "EMP"}, {35,268,210, "EMP"}, {34,324,210, "EMP"}, {33,380,210, "EMP"}, {32,436,210, "EMP"} }, |
| 67 | | { {47,44,154, "EMP"}, {46,100,154, "EMP"}, {45,156,154, "EMP"}, {44,212,154, "EMP"}, {43,268,154, "EMP"}, {42,324,154, "EMP"}, {41,380,154, "EMP"}, {40,436,154, "EMP"} }, |
| 79 | { {23,0}, {22,0}, {21,0}, {20,0}, {19,0}, {18,0}, {17,0}, {16,0} }, |
| 80 | { {31,0}, {30,0}, {29,0}, {28,0}, {27,0}, {26,0}, {25,0}, {24,0} }, |
| 81 | { {39,0}, {38,0}, {37,0}, {36,0}, {35,0}, {34,0}, {33,0}, {32,0} }, |
| 82 | { {47,0}, {46,0}, {45,0}, {44,0}, {43,0}, {42,0}, {41,0}, {40,0} }, |
| 68 | 83 | |
| 69 | | { {55,44,100,"BP1"}, {54,100,100,"BP2"}, {53,156,100,"BP3"}, {52,212,100,"BP4"}, {51,268,100,"BP5"}, {50,324,100,"BP6"}, {49,380,100,"BP7"}, {48,436,100,"BP8"} }, |
| 70 | | { {63,44,44 ,"BR1"}, {62,100,44 ,"BN1"}, {61,156,44 ,"BB1"}, {60,212,44 ,"BQ1"}, {59,268,44 ,"BK"}, {58,324,44 ,"BB2"}, {57,380,44 ,"BN2"}, {56,436,44 ,"BR2"} } |
| 84 | { {55,1}, {54,1}, {53,1}, {52,1}, {51,1}, {50,1}, {49,1}, {48,1} }, |
| 85 | { {63,4}, {62,2}, {61,3}, {60,5}, {59,6}, {58,3}, {57,2}, {56,4} } |
| 71 | 86 | }; |
| 72 | 87 | |
| 88 | INLINE UINT8 pos_to_num(UINT8 val) |
| 89 | { |
| 90 | switch (val) |
| 91 | { |
| 92 | case 0xfe: return 7; |
| 93 | case 0xfd: return 6; |
| 94 | case 0xfb: return 5; |
| 95 | case 0xf7: return 4; |
| 96 | case 0xef: return 3; |
| 97 | case 0xdf: return 2; |
| 98 | case 0xbf: return 1; |
| 99 | case 0x7f: return 0; |
| 100 | default: return 0xff; |
| 101 | } |
| 102 | } |
| 103 | |
| 73 | 104 | static void set_board( void ) |
| 74 | 105 | { |
| 75 | 106 | UINT8 i_AH, i_18; |
| r6463 | r6464 | |
| 84 | 115 | } |
| 85 | 116 | } |
| 86 | 117 | |
| 118 | static void glasgow_pieces_w ( running_machine *machine ) |
| 119 | { |
| 120 | /* This causes the pieces to display on-screen */ |
| 121 | UINT8 i_18, i_AH; |
| 87 | 122 | |
| 88 | | static int irq_edge = 0x00; |
| 123 | for (i_18 = 0; i_18 < 8; i_18++) |
| 124 | for (i_AH = 0; i_AH < 8; i_AH++) |
| 125 | output_set_indexed_value("P", 63 - m_board[i_18][i_AH].field, m_board[i_18][i_AH].piece); |
| 126 | } |
| 89 | 127 | |
| 90 | | |
| 91 | | // Used by Glasgow and Dallas |
| 92 | | static WRITE16_HANDLER( write_lcd_gg ) |
| 128 | static WRITE16_HANDLER( glasgow_lcd_w ) |
| 93 | 129 | { |
| 94 | 130 | UINT8 lcd_data = data >> 8; |
| 95 | 131 | |
| r6463 | r6464 | |
| 98 | 134 | |
| 99 | 135 | lcd_shift_counter--; |
| 100 | 136 | lcd_shift_counter &= 3; |
| 101 | | // logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); |
| 102 | 137 | } |
| 103 | 138 | |
| 104 | | static WRITE16_HANDLER( write_beeper ) |
| 139 | static WRITE16_HANDLER( glasgow_lcd_flag_w ) |
| 105 | 140 | { |
| 106 | | UINT8 beep_flag; |
| 141 | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 142 | UINT16 lcd_flag = data & 0x8100; |
| 107 | 143 | |
| 108 | | lcd_invert = 1; |
| 109 | | beep_flag = data >> 8; |
| 110 | | // if ((beep_flag & 02) == 0) key_selector = 0; else key_selector = 1; |
| 111 | | logerror("Write Beeper = %x \n", data); |
| 112 | | beeper = data; |
| 144 | beep_set_state(speaker, (lcd_flag & 0x100) ? 1 : 0); |
| 145 | |
| 146 | if (lcd_flag) |
| 147 | led7 = 255; |
| 148 | else |
| 149 | { |
| 150 | led7 = 0; |
| 151 | key_selector = 1; |
| 152 | } |
| 113 | 153 | } |
| 114 | 154 | |
| 115 | | static WRITE16_HANDLER( write_lcd ) |
| 155 | static READ16_HANDLER( glasgow_keys_r ) |
| 116 | 156 | { |
| 117 | | UINT8 lcd_data = data >> 8; |
| 157 | UINT8 data = 0xff; |
| 118 | 158 | |
| 119 | | output_set_digit_value(lcd_shift_counter, lcd_invert & 1 ? lcd_data^0xff : lcd_data); |
| 120 | | lcd_shift_counter--; |
| 121 | | lcd_shift_counter &= 3; |
| 122 | | logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); |
| 123 | | } |
| 159 | static const char *const keynames[] = { "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; |
| 160 | static UINT8 board_row = 0; |
| 161 | static UINT16 mouse_down = 0; |
| 162 | board_row++; |
| 163 | board_row &= 7; |
| 124 | 164 | |
| 125 | | static WRITE16_HANDLER( write_lcd_flag ) |
| 126 | | { |
| 127 | | UINT8 lcd_flag; |
| 128 | | lcd_invert = 0; |
| 129 | | lcd_flag=data >> 8; |
| 130 | | //beep_set_state(0, lcd_flag & 1 ? 1 : 0); |
| 131 | | if (lcd_flag == 0) |
| 132 | | key_selector = 1; |
| 165 | /* See if any pieces moved on the board */ |
| 166 | data = input_port_read(space->machine, keynames[board_row]); |
| 133 | 167 | |
| 134 | | // The key function in the rom expects after writing to |
| 135 | | // the a value from the second key row; |
| 136 | | if (lcd_flag != 0) |
| 137 | | led7 = 255; |
| 168 | if ((data != 0xff) && (!mouse_down)) |
| 169 | { |
| 170 | /* Moving a white piece onto a blank, or taking a black piece */ |
| 171 | if ((mouse_hold > 6) && (m_board[board_row][pos_to_num(data)].piece < 7)) |
| 172 | { |
| 173 | m_board[board_row][pos_to_num(data)].piece = mouse_hold; |
| 174 | mouse_hold = 0; |
| 175 | } |
| 176 | else |
| 177 | /* Moving a black piece onto a blank, or taking a white piece */ |
| 178 | if ((mouse_hold) && (mouse_hold < 7) |
| 179 | && ((m_board[board_row][pos_to_num(data)].piece > 6) || (!(m_board[board_row][pos_to_num(data)].piece)))) |
| 180 | { |
| 181 | m_board[board_row][pos_to_num(data)].piece = mouse_hold; |
| 182 | mouse_hold = 0; |
| 183 | } |
| 184 | else |
| 185 | /* Picking up a white piece */ |
| 186 | if (m_board[board_row][pos_to_num(data)].piece > 6) |
| 187 | { |
| 188 | mouse_hold = m_board[board_row][pos_to_num(data)].piece; |
| 189 | m_board[board_row][pos_to_num(data)].piece = 0; |
| 190 | } |
| 191 | else |
| 192 | /* Picking up a black piece */ |
| 193 | if ((m_board[board_row][pos_to_num(data)].piece) && (m_board[board_row][pos_to_num(data)].piece < 7)) |
| 194 | { |
| 195 | mouse_hold = m_board[board_row][pos_to_num(data)].piece; |
| 196 | m_board[board_row][pos_to_num(data)].piece = 0; |
| 197 | } |
| 198 | |
| 199 | mouse_down = board_row + 1; |
| 200 | |
| 201 | } |
| 138 | 202 | else |
| 139 | | led7 = 0; |
| 203 | if ((data == 0xff) && (mouse_down == (board_row + 1))) /* Wait for mouse to be released */ |
| 204 | mouse_down = 0; |
| 140 | 205 | |
| 141 | | logerror("LCD Flag 16 = %x \n", data); |
| 142 | | } |
| 206 | /* See if we are taking a piece off the board */ |
| 207 | if (!input_port_read(space->machine, "LINE10")) |
| 208 | mouse_hold = 0; |
| 143 | 209 | |
| 144 | | static WRITE16_HANDLER( write_lcd_flag_gg ) |
| 145 | | { |
| 146 | | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 147 | | UINT8 lcd_flag = data >> 8; |
| 210 | /* See if any keys pressed */ |
| 211 | data = 3; |
| 148 | 212 | |
| 149 | | beep_set_state(speaker, lcd_flag & 1 ? 1 : 0); |
| 213 | if (key_select == input_port_read(space->machine, "LINE0")) |
| 214 | data &= 1; |
| 150 | 215 | |
| 151 | | if (lcd_flag == 0) |
| 152 | | key_selector = 1; |
| 216 | if (key_select == input_port_read(space->machine, "LINE1")) |
| 217 | data &= 2; |
| 153 | 218 | |
| 154 | | if (lcd_flag != 0) |
| 155 | | led7 = 255; |
| 156 | | else |
| 157 | | led7 = 0; |
| 158 | | |
| 159 | | // logerror("LCD Flag gg = %x \n", lcd_flag); |
| 219 | return data << 8; |
| 160 | 220 | } |
| 161 | 221 | |
| 162 | | static WRITE16_HANDLER( write_keys ) |
| 222 | static WRITE16_HANDLER( glasgow_keys_w ) |
| 163 | 223 | { |
| 164 | 224 | key_select = data >> 8; |
| 165 | | // logerror("Write Key = %x \n", data); |
| 225 | glasgow_pieces_w(space->machine); |
| 166 | 226 | } |
| 167 | 227 | |
| 168 | | static READ16_HANDLER( read_board ) |
| 228 | static READ16_HANDLER( glasgow_board_r ) |
| 169 | 229 | { |
| 170 | | return 0xff00; // Mephisto need it for working |
| 171 | | } |
| 230 | UINT8 i_AH, data = 0; |
| 172 | 231 | |
| 173 | | static WRITE16_HANDLER( write_board ) |
| 174 | | { |
| 175 | | UINT8 board = data >> 8; |
| 232 | if (Line18_REED < 8) |
| 233 | { |
| 234 | // if there is a piece on the field -> set bit in data |
| 235 | for (i_AH = 0; i_AH < 8; i_AH++) |
| 236 | { |
| 237 | if (!m_board[Line18_REED][i_AH].piece) |
| 238 | data |= (1 << i_AH); |
| 239 | } |
| 240 | } |
| 176 | 241 | |
| 177 | | board_value = board; |
| 242 | read_board_flag = TRUE; |
| 178 | 243 | |
| 179 | | if (board == 0xff) |
| 180 | | key_selector = 0; |
| 181 | | // The key function in the rom expects after writing to |
| 182 | | // the chess board a value from the first key row; |
| 183 | | logerror("Write Board = %x \n", data >> 8); |
| 244 | return data << 8; |
| 184 | 245 | } |
| 185 | 246 | |
| 186 | | static WRITE16_HANDLER( write_board_gg ) |
| 247 | static WRITE16_HANDLER( glasgow_board_w ) |
| 187 | 248 | { |
| 188 | | UINT8 beep_flag; |
| 249 | //UINT8 beep_flag; |
| 250 | Line18_REED = pos_to_num(data >> 8) ^ 7; |
| 189 | 251 | |
| 190 | | Line18_REED = data >> 8; |
| 191 | | |
| 192 | 252 | // LED's or REED's ? |
| 193 | 253 | if (read_board_flag) |
| 194 | 254 | { |
| r6463 | r6464 | |
| 200 | 260 | Line18_LED = data >> 8; |
| 201 | 261 | } |
| 202 | 262 | |
| 203 | | //logerror("write_board Line18_LED = %x \n ", Line18_LED); |
| 204 | | //logerror("write_board Line18_REED = %x \n ",Line18_REED); |
| 205 | | |
| 206 | 263 | lcd_invert = 1; |
| 207 | | beep_flag = data >> 8; |
| 264 | //beep_flag = data >> 8; |
| 208 | 265 | //if ((beep_flag & 02) == 0) key_selector = 0; else key_selector = 1; |
| 209 | 266 | //logerror("Write Beeper = %x \n ",data); |
| 210 | 267 | beeper = data; |
| 211 | | } |
| 212 | 268 | |
| 213 | | static WRITE16_HANDLER( write_irq_flag ) |
| 214 | | { |
| 215 | | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 216 | | |
| 217 | | beep_set_state(speaker, data & 0x100); |
| 218 | | logerror("Write 0x800004 = %x \n", data); |
| 219 | | irq_flag = 1; |
| 220 | | beeper = data; |
| 221 | 269 | } |
| 222 | 270 | |
| 223 | | static READ16_HANDLER( read_keys ) // Glasgow, Dallas |
| 271 | static WRITE16_HANDLER( glasgow_beeper_w ) |
| 224 | 272 | { |
| 225 | | UINT16 data = 0x0300; |
| 226 | | |
| 227 | | key_low = input_port_read(space->machine, "LINE0"); |
| 228 | | key_hi = input_port_read(space->machine, "LINE1"); |
| 229 | | |
| 230 | | if (key_select == key_low) |
| 231 | | data = data & 0x100; |
| 232 | | |
| 233 | | if (key_select == key_hi) |
| 234 | | data = data & 0x200; |
| 235 | | |
| 236 | | //logerror("Keyboard Offset = %x Data = %x\n ", offset, data); |
| 237 | | return data; |
| 238 | | } |
| 239 | | |
| 240 | | static READ16_HANDLER( read_newkeys16 ) //Amsterdam, Roma |
| 241 | | { |
| 242 | | UINT16 data; |
| 243 | | |
| 244 | | if (key_selector == 0) |
| 245 | | data = input_port_read(space->machine, "LINE0"); |
| 246 | | else |
| 247 | | data = input_port_read(space->machine, "LINE1"); |
| 248 | | |
| 249 | | logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, key_selector); |
| 250 | | data = data << 8; |
| 251 | | return data ; |
| 252 | | } |
| 253 | | |
| 254 | | static READ16_HANDLER( read_board_gg ) |
| 255 | | { |
| 256 | | UINT8 i_18, i_AH; |
| 257 | | UINT16 data = 0xff; |
| 258 | | |
| 259 | | for (i_18 = 0; i_18 < 8; i_18++) |
| 260 | | { |
| 261 | | // Looking for cleared bit in Line18 -> current line |
| 262 | | if (!(Line18_REED & (1 << i_18))) |
| 263 | | { |
| 264 | | // if there is a piece on the field -> set bit in data |
| 265 | | for (i_AH = 0; i_AH < 8; i_AH++) |
| 266 | | { |
| 267 | | if (strcmp ((char *)m_board[i_18][i_AH].piece, EMP)) |
| 268 | | data &= ~(1 << i_AH); // clear bit |
| 269 | | } |
| 270 | | } |
| 271 | | } |
| 272 | | |
| 273 | | data = data << 8; |
| 274 | | read_board_flag = TRUE; |
| 275 | | logerror("read_board_data = %x \n", data); |
| 276 | | |
| 277 | | // return 0xff00; // Mephisto need it for working |
| 278 | | |
| 279 | | return data; |
| 280 | | } |
| 281 | | |
| 282 | | static WRITE16_HANDLER( write_beeper_gg ) |
| 283 | | { |
| 284 | | // logerror("Write Board = %x \n ",data>>8); |
| 285 | 273 | UINT8 i_AH, i_18; |
| 286 | 274 | UINT16 LineAH = 0; |
| 287 | 275 | UINT8 LED; |
| 288 | 276 | |
| 289 | | // logerror("Write Board = %x \n ",data); |
| 290 | | |
| 291 | 277 | LineAH = data >> 8; |
| 292 | 278 | |
| 293 | 279 | if (LineAH && Line18_LED) |
| 294 | 280 | { |
| 295 | | // logerror("Line18_LED = %x \n ",Line18_LED); |
| 296 | | // logerror("LineAH = %x \n ",LineAH); |
| 297 | | |
| 298 | 281 | for (i_AH = 0; i_AH < 8; i_AH++) |
| 299 | 282 | { |
| 300 | 283 | if (LineAH & (1 << i_AH)) |
| r6463 | r6464 | |
| 303 | 286 | { |
| 304 | 287 | if (!(Line18_LED & (1 << i_18))) |
| 305 | 288 | { |
| 306 | | // logerror("i_18 = %d \n ",i_18); |
| 307 | | // logerror("i_AH = %d \n ",i_AH); |
| 308 | | // logerror("LED an: = %d \n ",m_board[i_18][i_AH]); |
| 309 | | |
| 310 | 289 | LED = m_board[i_18][i_AH].field; |
| 311 | 290 | output_set_led_value(LED, 1); |
| 312 | 291 | // LED on |
| r6463 | r6464 | |
| 335 | 314 | } |
| 336 | 315 | } |
| 337 | 316 | |
| 317 | static WRITE16_HANDLER( write_beeper ) |
| 318 | { |
| 319 | UINT8 beep_flag; |
| 320 | |
| 321 | lcd_invert = 1; |
| 322 | beep_flag = data >> 8; |
| 323 | // if ((beep_flag & 02) == 0) key_selector = 0; else key_selector = 1; |
| 324 | logerror("Write Beeper = %x \n", data); |
| 325 | beeper = data; |
| 326 | } |
| 327 | |
| 328 | static WRITE16_HANDLER( write_lcd ) |
| 329 | { |
| 330 | UINT8 lcd_data = data >> 8; |
| 331 | |
| 332 | output_set_digit_value(lcd_shift_counter, lcd_invert & 1 ? lcd_data^0xff : lcd_data); |
| 333 | lcd_shift_counter--; |
| 334 | lcd_shift_counter &= 3; |
| 335 | logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); |
| 336 | } |
| 337 | |
| 338 | static WRITE16_HANDLER( write_lcd_flag ) |
| 339 | { |
| 340 | UINT8 lcd_flag; |
| 341 | lcd_invert = 0; |
| 342 | lcd_flag=data >> 8; |
| 343 | //beep_set_state(0, lcd_flag & 1 ? 1 : 0); |
| 344 | if (lcd_flag == 0) |
| 345 | key_selector = 1; |
| 346 | |
| 347 | // The key function in the rom expects after writing to |
| 348 | // the a value from the second key row; |
| 349 | if (lcd_flag != 0) |
| 350 | led7 = 255; |
| 351 | else |
| 352 | led7 = 0; |
| 353 | |
| 354 | logerror("LCD Flag 16 = %x \n", data); |
| 355 | } |
| 356 | |
| 357 | static READ16_HANDLER( read_board ) |
| 358 | { |
| 359 | return 0xff00; // Mephisto need it for working |
| 360 | } |
| 361 | |
| 362 | static WRITE16_HANDLER( write_board ) |
| 363 | { |
| 364 | UINT8 board = data >> 8; |
| 365 | |
| 366 | board_value = board; |
| 367 | |
| 368 | if (board == 0xff) |
| 369 | key_selector = 0; |
| 370 | // The key function in the rom expects after writing to |
| 371 | // the chess board a value from the first key row; |
| 372 | logerror("Write Board = %x \n", data >> 8); |
| 373 | } |
| 374 | |
| 375 | |
| 376 | static WRITE16_HANDLER( write_irq_flag ) |
| 377 | { |
| 378 | const device_config *speaker = devtag_get_device(space->machine, "beep"); |
| 379 | |
| 380 | beep_set_state(speaker, data & 0x100); |
| 381 | logerror("Write 0x800004 = %x \n", data); |
| 382 | irq_flag = 1; |
| 383 | beeper = data; |
| 384 | } |
| 385 | |
| 386 | static READ16_HANDLER( read_newkeys16 ) //Amsterdam, Roma |
| 387 | { |
| 388 | UINT16 data; |
| 389 | |
| 390 | if (key_selector == 0) |
| 391 | data = input_port_read(space->machine, "LINE0"); |
| 392 | else |
| 393 | data = input_port_read(space->machine, "LINE1"); |
| 394 | |
| 395 | logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, key_selector); |
| 396 | data <<= 8; |
| 397 | return data ; |
| 398 | } |
| 399 | |
| 400 | |
| 338 | 401 | /* |
| 339 | 402 | static READ16_HANDLER(read_test) |
| 340 | 403 | { |
| r6463 | r6464 | |
| 396 | 459 | data = input_port_read(space->machine, "LINE1"); |
| 397 | 460 | //if (key_selector == 1) data = input_port_read(machine, "LINE0"); else data = 0; |
| 398 | 461 | logerror("read Keyboard Offset = %x Data = %x\n", offset, data); |
| 399 | | data = data << 24; |
| 462 | data <<= 24; |
| 400 | 463 | return data ; |
| 401 | 464 | } |
| 402 | 465 | |
| 403 | 466 | static READ32_HANDLER( read_board32 ) |
| 404 | 467 | { |
| 405 | 468 | logerror("read board 32 Offset = %x \n", offset); |
| 406 | | return 0x00000000; |
| 469 | return 0; |
| 407 | 470 | } |
| 408 | 471 | |
| 409 | 472 | /* |
| r6463 | r6464 | |
| 433 | 496 | beeper = data; |
| 434 | 497 | } |
| 435 | 498 | |
| 499 | //static int irq_edge = 0x00; |
| 500 | |
| 436 | 501 | static TIMER_CALLBACK( update_nmi ) |
| 437 | 502 | { |
| 438 | 503 | //cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, irq_edge & 0xff ? CLEAR_LINE : ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 439 | 504 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 440 | 505 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 441 | | irq_edge = ~irq_edge; |
| 506 | // irq_edge = ~irq_edge; |
| 442 | 507 | } |
| 443 | 508 | |
| 444 | 509 | static TIMER_CALLBACK( update_nmi32 ) |
| r6463 | r6464 | |
| 446 | 511 | // cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, irq_edge & 0xff ? CLEAR_LINE : ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 447 | 512 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 448 | 513 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 449 | | irq_edge = ~irq_edge; |
| 514 | // irq_edge = ~irq_edge; |
| 450 | 515 | } |
| 451 | 516 | |
| 452 | 517 | static MACHINE_START( glasgow ) |
| r6463 | r6464 | |
| 477 | 542 | set_board(); |
| 478 | 543 | } |
| 479 | 544 | |
| 480 | | |
| 481 | 545 | static ADDRESS_MAP_START(glasgow_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 546 | ADDRESS_MAP_GLOBAL_MASK(0x1FFFF) |
| 482 | 547 | AM_RANGE(0x00000000, 0x0000ffff) AM_ROM |
| 483 | | AM_RANGE(0x00ff0000, 0x00ff0001) AM_MIRROR(0xfe0000) AM_WRITE( write_lcd_gg ) |
| 484 | | AM_RANGE(0x00ff0002, 0x00ff0003) AM_MIRROR(0xfe0002) AM_READWRITE( read_keys,write_keys ) |
| 485 | | AM_RANGE(0x00ff0004, 0x00ff0005) AM_MIRROR(0xfe0004) AM_WRITE( write_lcd_flag_gg ) |
| 486 | | AM_RANGE(0x00ff0006, 0x00ff0007) AM_MIRROR(0xfe0006) AM_READWRITE( read_board_gg, write_beeper_gg ) |
| 487 | | AM_RANGE(0x00ff0008, 0x00ff0009) AM_MIRROR(0xfe0008) AM_WRITE( write_board_gg ) |
| 488 | | AM_RANGE(0x00ffc000, 0x00ffffff) AM_MIRROR(0xfec000) AM_RAM // 16KB |
| 548 | AM_RANGE(0x00010000, 0x00010001) AM_WRITE( glasgow_lcd_w ) |
| 549 | AM_RANGE(0x00010002, 0x00010003) AM_READWRITE( glasgow_keys_r, glasgow_keys_w ) |
| 550 | AM_RANGE(0x00010004, 0x00010005) AM_WRITE( glasgow_lcd_flag_w ) |
| 551 | AM_RANGE(0x00010006, 0x00010007) AM_READWRITE( glasgow_board_r, glasgow_beeper_w ) |
| 552 | AM_RANGE(0x00010008, 0x00010009) AM_WRITE( glasgow_board_w ) |
| 553 | AM_RANGE(0x0001c000, 0x0001ffff) AM_RAM // 16KB |
| 489 | 554 | ADDRESS_MAP_END |
| 490 | 555 | |
| 491 | 556 | |
| r6463 | r6464 | |
| 560 | 625 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) |
| 561 | 626 | INPUT_PORTS_END |
| 562 | 627 | |
| 628 | static INPUT_PORTS_START( glasgow ) |
| 629 | PORT_INCLUDE( old_keyboard ) |
| 630 | PORT_START("LINE2") |
| 631 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 632 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 633 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 634 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 635 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 636 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 637 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 638 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 639 | PORT_START("LINE3") |
| 640 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 641 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 642 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 643 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 644 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 645 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 646 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 647 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 648 | PORT_START("LINE4") |
| 649 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 650 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 651 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 652 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 653 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 654 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 655 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 656 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 657 | PORT_START("LINE5") |
| 658 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 659 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 660 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 661 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 662 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 663 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 664 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 665 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 666 | PORT_START("LINE6") |
| 667 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 668 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 669 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 670 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 671 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 672 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 673 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 674 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 675 | PORT_START("LINE7") |
| 676 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 677 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 678 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 679 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 680 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 681 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 682 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 683 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 684 | PORT_START("LINE8") |
| 685 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 686 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 687 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 688 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 689 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 690 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 691 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 692 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 693 | PORT_START("LINE9") |
| 694 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 695 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 696 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 697 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 698 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 699 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 700 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 701 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 702 | PORT_START("LINE10") |
| 703 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 704 | INPUT_PORTS_END |
| 563 | 705 | |
| 564 | | |
| 565 | 706 | static MACHINE_DRIVER_START(glasgow ) |
| 566 | 707 | /* basic machine hardware */ |
| 567 | 708 | MDRV_CPU_ADD("maincpu", M68000, 12000000) |
| r6463 | r6464 | |
| 653 | 794 | ***************************************************************************/ |
| 654 | 795 | |
| 655 | 796 | /* YEAR, NAME, PARENT, COMPAT, MACHINE, INPUT, INIT, CONFIG, COMPANY, FULLNAME, FLAGS */ |
| 656 | | CONS( 1984, glasgow, 0, 0, glasgow, old_keyboard, 0, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", 0) |
| 797 | CONS( 1984, glasgow, 0, 0, glasgow, glasgow, 0, 0, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", 0) |
| 657 | 798 | CONS( 1984, amsterd, glasgow, 0, amsterd, new_keyboard, 0, 0, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", 0) |
| 658 | 799 | CONS( 1984, dallas, glasgow, 0, glasgow, old_keyboard, 0, 0, "Hegener & Glaser Muenchen", "Mephisto Dallas", 0) |
| 659 | 800 | CONS( 1984, roma, glasgow, 0, glasgow, new_keyboard, 0, 0, "Hegener & Glaser Muenchen", "Mephisto Roma", GAME_NOT_WORKING) |