src/mess/drivers/glasgow.c
| r1301 | r1302 | |
| 1 | | /***************************************************************************
|
| 2 | | Mephisto Glasgow 3 S chess computer
|
| 3 | | Dirk V.
|
| 4 | | sp_rinter@gmx.de
|
| 5 | | |
| 6 | | 68000 CPU
|
| 7 | | 64 KB ROM
|
| 8 | | 16 KB RAM
|
| 9 | | 4 Digit LC Display
|
| 10 | | |
| 11 | | 3* 74LS138 Decoder/Multiplexer
|
| 12 | | 1*74LS74 Dual positive edge triggered D Flip Flop
|
| 13 | | 1*74LS139 1of4 Demultiplexer
|
| 14 | | 1*74LS05 HexInverter
|
| 15 | | 1*NE555 R=100K C=10uF
|
| 16 | | 2*74LS04 Hex Inverter
|
| 17 | | 1*74LS164 8 Bit Shift register
|
| 18 | | 1*74121 Monostable Multivibrator with Schmitt Trigger Inputs
|
| 19 | | 1*74LS20 Dual 4 Input NAND GAte
|
| 20 | | 1*74LS367 3 State Hex Buffers
|
| 21 | | |
| 22 | | |
| 23 | | ***************************************************************************/
|
| 24 | | |
| 25 | | #include "driver.h"
|
| 26 | | #include "cpu/m68000/m68k.h"
|
| 27 | | #include "cpu/m68000/m68000.h"
|
| 28 | | #include "glasgow.lh"
|
| 29 | | #include "sound/beep.h"
|
| 30 | | |
| 31 | | #include "render.h"
|
| 32 | | #include "rendlay.h"
|
| 33 | | |
| 34 | | static UINT8 lcd_shift_counter;
|
| 35 | | // static UINT8 led_status;
|
| 36 | | static UINT8 led7;
|
| 37 | | static UINT8 key_low,
|
| 38 | | key_hi,
|
| 39 | | key_select,
|
| 40 | | irq_flag,
|
| 41 | | lcd_invert,
|
| 42 | | key_selector;
|
| 43 | | UINT8 board_value;
|
| 44 | | static UINT16 beeper;
|
| 45 | | |
| 46 | | |
| 47 | | #define MOUSE_X 56
|
| 48 | | #define MOUSE_Y 56
|
| 49 | | #define MAX_X 530
|
| 50 | | #define MAX_Y 660
|
| 51 | | #define MOUSE_SPEED 3
|
| 52 | | |
| 53 | | #define MIN_BOARD_X 60.0
|
| 54 | | #define MAX_BOARD_X 480.0
|
| 55 | | |
| 56 | | #define MIN_BOARD_Y 60.0
|
| 57 | | #define MAX_BOARD_Y 480.0
|
| 58 | | |
| 59 | | #define MIN_CURSOR_X -10
|
| 60 | | #define MAX_CURSOR_X 496
|
| 61 | | |
| 62 | | #define MIN_CURSOR_Y 0
|
| 63 | | #define MAX_CURSOR_Y 622
|
| 64 | | |
| 65 | | static INT16 m_x, m_y;
|
| 66 | | static UINT8 m_button1 , m_button2;
|
| 67 | | static UINT8 MOUSE_MOVE = 0;
|
| 68 | | static UINT8 MOUSE_BUTTON1_WAIT = 0;
|
| 69 | | static UINT8 MOUSE_BUTTON2_WAIT = 0;
|
| 70 | | |
| 71 | | static UINT16 Line18_LED;
|
| 72 | | static UINT16 Line18_REED;
|
| 73 | | |
| 74 | | static UINT8 read_board_flag;
|
| 75 | | |
| 76 | | static char EMP[4] = "EMP";
|
| 77 | | static char NO_PIECE[4] = "NOP";
|
| 78 | | |
| 79 | | |
| 80 | | typedef struct {
|
| 81 | | unsigned int field;
|
| 82 | | unsigned int x;
|
| 83 | | unsigned int y;
|
| 84 | | unsigned char piece[4];
|
| 85 | | } BOARD_FIELD;
|
| 86 | | |
| 87 | | |
| 88 | | #define WR 12
|
| 89 | | #define WB 13
|
| 90 | | #define WKN 14
|
| 91 | | #define WQ 15
|
| 92 | | #define WK 16
|
| 93 | | |
| 94 | | #define BP 21
|
| 95 | | #define BR 22
|
| 96 | | #define BB 23
|
| 97 | | #define BKN 24
|
| 98 | | #define BQ 25
|
| 99 | | #define BK 26
|
| 100 | | |
| 101 | | |
| 102 | | |
| 103 | | BOARD_FIELD m_board[8][8];
|
| 104 | | |
| 105 | | BOARD_FIELD start_board[8][8] =
|
| 106 | | {
|
| 107 | | { { 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"} },
|
| 108 | | { {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"} },
|
| 109 | | |
| 110 | | { {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"} },
|
| 111 | | { {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"} },
|
| 112 | | { {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"} },
|
| 113 | | { {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"} },
|
| 114 | | |
| 115 | | { {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"} },
|
| 116 | | { {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"} }
|
| 117 | | |
| 118 | | };
|
| 119 | | |
| 120 | | |
| 121 | | static BOARD_FIELD cursor_field;
|
| 122 | | |
| 123 | | |
| 124 | | typedef struct {
|
| 125 | | unsigned char piece[4];
|
| 126 | | unsigned int selected;
|
| 127 | | unsigned int set;
|
| 128 | | } P_STATUS;
|
| 129 | | |
| 130 | | |
| 131 | | static P_STATUS all_pieces[48] =
|
| 132 | | {
|
| 133 | | {"WR1",0,0}, {"WN1",0,0},{"WB1",0,0}, {"WQ1",0,0}, {"WK",0,0}, {"WB2",0,0}, {"WN2",0,0}, {"WR2",0,0},
|
| 134 | | {"WP1",0,0}, {"WP2",0,0},{"WP3",0,0}, {"WP4",0,0}, {"WP5",0,0}, {"WP6",0,0}, {"WP7",0,0}, {"WP8",0,0},
|
| 135 | | |
| 136 | | |
| 137 | | {"BP1",0,0}, {"BP2",0,0},{"BP3",0,0}, {"BP4",0,0}, {"BP5",0,0}, {"BP6",0,0}, {"BP7",0,0}, {"BP8",0,0},
|
| 138 | | {"BR1",0,0}, {"BN1",0,0},{"BB1",0,0}, {"BQ1",0,0}, {"BK",0,0}, {"BB2",0,0}, {"BN2",0,0}, {"BR2",0,0},
|
| 139 | | |
| 140 | | |
| 141 | | {"BQ2",0,0}, {"BQ3",0,0}, {"BQ4",0,0}, {"BQ5",0,0}, {"BQ6",0,0}, {"BQ7",0,0},
|
| 142 | | |
| 143 | | |
| 144 | | {"WQ2",0,0}, {"WQ3",0,0}, {"WQ4",0,0}, {"WQ5",0,0}, {"WQ6",0,0}, {"WQ7",0,0}
|
| 145 | | |
| 146 | | };
|
| 147 | | |
| 148 | | static UINT8 start_i;
|
| 149 | | |
| 150 | | |
| 151 | | struct _render_target
|
| 152 | | {
|
| 153 | | render_target * next; /* keep a linked list of targets */
|
| 154 | | layout_view * curview; /* current view */
|
| 155 | | layout_file * filelist; /* list of layout files */
|
| 156 | | UINT32 flags; /* creation flags */
|
| 157 | | render_primitive_list primlist[2];/* list of primitives */
|
| 158 | | int listindex; /* index of next primlist to use */
|
| 159 | | INT32 width; /* width in pixels */
|
| 160 | | INT32 height; /* height in pixels */
|
| 161 | | render_bounds bounds; /* bounds of the target */
|
| 162 | | float pixel_aspect; /* aspect ratio of individual pixels */
|
| 163 | | float max_refresh; /* maximum refresh rate, 0 or if none */
|
| 164 | | int orientation; /* orientation */
|
| 165 | | int layerconfig; /* layer configuration */
|
| 166 | | layout_view * base_view; /* the view at the time of first frame */
|
| 167 | | int base_orientation; /* the orientation at the time of first frame */
|
| 168 | | int base_layerconfig; /* the layer configuration at the time of first frame */
|
| 169 | | int maxtexwidth; /* maximum width of a texture */
|
| 170 | | int maxtexheight; /* maximum height of a texture */
|
| 171 | | };
|
| 172 | | |
| 173 | | static render_target *my_target;
|
| 174 | | |
| 175 | | static view_item *my_cursor;
|
| 176 | | |
| 177 | | static void set_cursor (view_item *view_cursor);
|
| 178 | | |
| 179 | | static view_item *get_view_item(render_target *target, const char *v_name);
|
| 180 | | |
| 181 | | static BOARD_FIELD get_field( float i_x, float i_y, UINT8 mouse_move);
|
| 182 | | static void update_board(render_target *target, BOARD_FIELD board_field, unsigned int update_clear_flag);
|
| 183 | | |
| 184 | | static void calculate_bounds(view_item *view_item, float new_x0, float new_y0, float new_del_x, float new_del_y );
|
| 185 | | |
| 186 | | static void set_render_board(void);
|
| 187 | | static void clear_layout(void);
|
| 188 | | static void set_status_of_pieces(void);
|
| 189 | | |
| 190 | | static char * get_non_set_pieces(const char *cur_piece);
|
| 191 | | |
| 192 | | static unsigned int out_of_board( float x0, float y0);
|
| 193 | | |
| 194 | | |
| 195 | | |
| 196 | | // Used by Glasgow and Dallas
|
| 197 | | static WRITE16_HANDLER ( write_lcd_gg )
|
| 198 | | {
|
| 199 | | UINT8 lcd_data;
|
| 200 | | lcd_data = data>>8;
|
| 201 | | if (led7==0) output_set_digit_value(lcd_shift_counter,lcd_data);
|
| 202 | | lcd_shift_counter--;
|
| 203 | | lcd_shift_counter&=3;
|
| 204 | | // logerror("LCD Offset = %d Data low = %x \n ",offset,lcd_data);
|
| 205 | | }
|
| 206 | | |
| 207 | | static WRITE16_HANDLER ( write_lcd )
|
| 208 | | {
|
| 209 | | UINT8 lcd_data;
|
| 210 | | lcd_data = data>>8;
|
| 211 | | output_set_digit_value(lcd_shift_counter,lcd_invert&1?lcd_data^0xff:lcd_data);
|
| 212 | | lcd_shift_counter--;
|
| 213 | | lcd_shift_counter&=3;
|
| 214 | | // logerror("LCD Offset = %d Data low = %x \n ",offset,lcd_data);
|
| 215 | | }
|
| 216 | | static WRITE16_HANDLER ( write_lcd_flag )
|
| 217 | | {
|
| 218 | | UINT8 lcd_flag;
|
| 219 | | lcd_invert=0;
|
| 220 | | lcd_flag=data>>8;
|
| 221 | | //beep_set_state(0,lcd_flag&1?1:0);
|
| 222 | | if (lcd_flag == 0) key_selector=1;
|
| 223 | | if (lcd_flag!=0) led7=255;else led7=0;
|
| 224 | | // logerror("LCD Flag 16 = %x \n ",data);
|
| 225 | | }
|
| 226 | | |
| 227 | | |
| 228 | | static WRITE16_HANDLER ( write_lcd_flag_gg )
|
| 229 | | {
|
| 230 | | UINT8 lcd_flag;
|
| 231 | | lcd_flag=data>>8;
|
| 232 | | beep_set_state(0,lcd_flag&1?1:0);
|
| 233 | | if (lcd_flag == 0) key_selector=1;
|
| 234 | | if (lcd_flag!=0) led7=255;else led7=0;
|
| 235 | | |
| 236 | | // logerror("LCD Flag gg = %x \n ",lcd_flag);
|
| 237 | | }
|
| 238 | | |
| 239 | | static WRITE16_HANDLER ( write_keys )
|
| 240 | | {
|
| 241 | | key_select=data>>8;
|
| 242 | | // logerror("Write Key = %x \n ",data);
|
| 243 | | }
|
| 244 | | |
| 245 | | static WRITE16_HANDLER ( write_board )
|
| 246 | | {
|
| 247 | | UINT8 beep_flag;
|
| 248 | | |
| 249 | | Line18_REED=data>>8;
|
| 250 | | |
| 251 | | // LED's or REED's ?
|
| 252 | | //
|
| 253 | | if (read_board_flag)
|
| 254 | | {
|
| 255 | | Line18_LED=0;
|
| 256 | | read_board_flag=0;
|
| 257 | | }
|
| 258 | | else
|
| 259 | | {
|
| 260 | | Line18_LED=data>>8;
|
| 261 | | }
|
| 262 | | |
| 263 | | //logerror("write_board Line18_LED = %x \n ", Line18_LED);
|
| 264 | | //logerror("write_board Line18_REED = %x \n ",Line18_REED);
|
| 265 | | |
| 266 | | lcd_invert=1;
|
| 267 | | beep_flag=data>>8;
|
| 268 | | //if ((beep_flag &02)== 0) key_selector=0;else key_selector=1;
|
| 269 | | //logerror("Write Beeper = %x \n ",data);
|
| 270 | | beeper=data;
|
| 271 | | }
|
| 272 | | |
| 273 | | static WRITE16_HANDLER ( write_irq_flag )
|
| 274 | | {
|
| 275 | | |
| 276 | | beep_set_state(0,data&0x100);
|
| 277 | | logerror("Write 0x800004 = %x \n ",data);
|
| 278 | | irq_flag=1;
|
| 279 | | beeper=data;
|
| 280 | | }
|
| 281 | | |
| 282 | | static READ16_HANDLER(read_keys) // Glasgow, Dallas
|
| 283 | | {
|
| 284 | | UINT16 data;
|
| 285 | | data=0x0300;
|
| 286 | | key_low=readinputport(0x00);
|
| 287 | | key_hi=readinputport(0x01);
|
| 288 | | //logerror("Keyboard Offset = %x Data = %x\n ",offset,data);
|
| 289 | | if (key_select==key_low){data=data&0x100;}
|
| 290 | | if (key_select==key_hi){data=data&0x200;}
|
| 291 | | return data;
|
| 292 | | }
|
| 293 | | |
| 294 | | static READ16_HANDLER(read_newkeys16) //Amsterdam, Roma
|
| 295 | | {
|
| 296 | | UINT16 data;
|
| 297 | | |
| 298 | | if (key_selector==0) data=readinputport(0x00);else data=readinputport(0x01);
|
| 299 | | logerror("read Keyboard Offset = %x Data = %x Select = %x \n ",offset,data,key_selector);
|
| 300 | | data=data<<8;
|
| 301 | | return data ;
|
| 302 | | }
|
| 303 | | |
| 304 | | static READ16_HANDLER(read_board)
|
| 305 | | {
|
| 306 | | UINT8 i_18, i_AH;
|
| 307 | | UINT16 data;
|
| 308 | | |
| 309 | | data = 0xff;
|
| 310 | | |
| 311 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 312 | | {
|
| 313 | | |
| 314 | | // Looking for cleared bit in Line18 -> current line
|
| 315 | | //
|
| 316 | | if ( !(Line18_REED & (1<<i_18)) )
|
| 317 | | {
|
| 318 | | |
| 319 | | // if there is a piece on the field -> set bit in data
|
| 320 | | //
|
| 321 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 322 | | {
|
| 323 | | if (strcmp ((char *)m_board[i_18][i_AH].piece, EMP))
|
| 324 | | {
|
| 325 | | data &= ~(1 << i_AH); // clear bit
|
| 326 | | }
|
| 327 | | }
|
| 328 | | }
|
| 329 | | }
|
| 330 | | |
| 331 | | data = data<<8;
|
| 332 | | |
| 333 | | read_board_flag = TRUE;
|
| 334 | | |
| 335 | | logerror("read_board_data = %x \n ", data);
|
| 336 | | |
| 337 | | |
| 338 | | // return 0xff00; // Mephisto need it for working
|
| 339 | | |
| 340 | | |
| 341 | | return data;
|
| 342 | | |
| 343 | | }
|
| 344 | | |
| 345 | | static WRITE16_HANDLER(write_beeper)
|
| 346 | | {
|
| 347 | | // logerror("Write Board = %x \n ",data>>8);
|
| 348 | | |
| 349 | | UINT8 i_AH, i_18;
|
| 350 | | UINT16 LineAH = 0;
|
| 351 | | |
| 352 | | UINT8 LED;
|
| 353 | | |
| 354 | | |
| 355 | | // logerror("Write Board = %x \n ",data);
|
| 356 | | |
| 357 | | LineAH = data>>8;
|
| 358 | | |
| 359 | | if (LineAH && Line18_LED)
|
| 360 | | {
|
| 361 | | |
| 362 | | // logerror("Line18_LED = %x \n ",Line18_LED);
|
| 363 | | // logerror("LineAH = %x \n ",LineAH);
|
| 364 | | |
| 365 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 366 | | {
|
| 367 | | |
| 368 | | if ( LineAH & (1<<i_AH) )
|
| 369 | | {
|
| 370 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 371 | | {
|
| 372 | | if ( !(Line18_LED & (1<<i_18)) )
|
| 373 | | {
|
| 374 | | |
| 375 | | // logerror("i_18 = %d \n ",i_18);
|
| 376 | | // logerror("i_AH = %d \n ",i_AH);
|
| 377 | | // logerror("LED an: = %d \n ",m_board[i_18][i_AH]);
|
| 378 | | |
| 379 | | LED = m_board[i_18][i_AH].field;
|
| 380 | | |
| 381 | | output_set_led_value( LED, 1 );
|
| 382 | | |
| 383 | | // LED on
|
| 384 | | }
|
| 385 | | else
|
| 386 | | {
|
| 387 | | // LED off
|
| 388 | | |
| 389 | | } // End IF 18
|
| 390 | | } // End For 18
|
| 391 | | } // End IF AH
|
| 392 | | |
| 393 | | } // End For AH
|
| 394 | | |
| 395 | | } // End IF LineAH
|
| 396 | | |
| 397 | | else
|
| 398 | | {
|
| 399 | | // No LED -> all LED's off
|
| 400 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 401 | | {
|
| 402 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 403 | | {
|
| 404 | | // LED off
|
| 405 | | LED = m_board[i_18][i_AH].field;
|
| 406 | | output_set_led_value( LED, 0 );
|
| 407 | | |
| 408 | | } //End For 18
|
| 409 | | } // End For AH
|
| 410 | | |
| 411 | | } //End ELSE LineAH
|
| 412 | | |
| 413 | | }
|
| 414 | | |
| 415 | | /*
|
| 416 | | static READ16_HANDLER(read_test)
|
| 417 | | {
|
| 418 | | logerror("read test Offset = %x Data = %x\n ",offset,data);
|
| 419 | | return 0xffff; // Mephisto need it for working
|
| 420 | | }
|
| 421 | | |
| 422 | | */
|
| 423 | | |
| 424 | | /*
|
| 425 | | |
| 426 | | ***** 32 Bit Read and write Handler ***********
|
| 427 | | |
| 428 | | */
|
| 429 | | |
| 430 | | static WRITE32_HANDLER ( write_lcd32 )
|
| 431 | | {
|
| 432 | | UINT8 lcd_data;
|
| 433 | | lcd_data = data>>8;
|
| 434 | | output_set_digit_value(lcd_shift_counter,lcd_invert&1?lcd_data^0xff:lcd_data);
|
| 435 | | lcd_shift_counter--;
|
| 436 | | lcd_shift_counter&=3;
|
| 437 | | //logerror("LCD Offset = %d Data = %x \n ",offset,lcd_data);
|
| 438 | | }
|
| 439 | | static WRITE32_HANDLER ( write_lcd_flag32 )
|
| 440 | | {
|
| 441 | | UINT8 lcd_flag;
|
| 442 | | lcd_invert=0;
|
| 443 | | lcd_flag=data>>24;
|
| 444 | | if (lcd_flag == 0) key_selector=1;
|
| 445 | | logerror("LCD Flag 32 = %x \n ",lcd_flag);
|
| 446 | | //beep_set_state(0,lcd_flag&1?1:0);
|
| 447 | | if (lcd_flag!=0) led7=255;else led7=0;
|
| 448 | | }
|
| 449 | | |
| 450 | | |
| 451 | | static WRITE32_HANDLER ( write_keys32 )
|
| 452 | | {
|
| 453 | | lcd_invert=1;
|
| 454 | | key_select=data;
|
| 455 | | logerror("Write Key = %x \n ",key_select);
|
| 456 | | }
|
| 457 | | |
| 458 | | static READ32_HANDLER(read_newkeys32) // Dallas 32, Roma 32
|
| 459 | | {
|
| 460 | | UINT32 data;
|
| 461 | | if (key_selector==0) data=readinputport(0x00);else data=readinputport(0x01);
|
| 462 | | //if (key_selector==1) data=readinputport(0x00);else data=0;
|
| 463 | | logerror("read Keyboard Offset = %x Data = %x\n ",offset,data);
|
| 464 | | data=data<<24;
|
| 465 | | return data ;
|
| 466 | | }
|
| 467 | | |
| 468 | | |
| 469 | | |
| 470 | | static READ32_HANDLER(read_board32)
|
| 471 | | {
|
| 472 | | logerror("read board 32 Offset = %x \n ",offset);
|
| 473 | | return 0x00000000;
|
| 474 | | }
|
| 475 | | |
| 476 | | |
| 477 | | |
| 478 | | static WRITE32_HANDLER(write_board32)
|
| 479 | | {
|
| 480 | | UINT8 board;
|
| 481 | | board=data>>24;
|
| 482 | | if (board==0xff) key_selector=0;
|
| 483 | | logerror("Write Board = %x \n ",data);
|
| 484 | | }
|
| 485 | | |
| 486 | | |
| 487 | | static WRITE32_HANDLER ( write_beeper32 )
|
| 488 | | {
|
| 489 | | beep_set_state(0,data&0x01000000);
|
| 490 | | logerror("Write 0x8000004 = %x \n ",data);
|
| 491 | | irq_flag=1;
|
| 492 | | beeper=data;
|
| 493 | | }
|
| 494 | | |
| 495 | | static TIMER_CALLBACK( update_nmi )
|
| 496 | | {
|
| 497 | | // if (irq_flag==0)cpunum_set_input_line_and_vector(0, MC68000_IRQ_7, PULSE_LINE, MC68000_INT_ACK_AUTOVECTOR);
|
| 498 | | cpunum_set_input_line_and_vector(0, MC68000_IRQ_7, PULSE_LINE, MC68000_INT_ACK_AUTOVECTOR);
|
| 499 | | |
| 500 | | }
|
| 501 | | |
| 502 | | static TIMER_CALLBACK( update_nmi32 )
|
| 503 | | {
|
| 504 | | cpunum_set_input_line_and_vector(0, MC68020_IRQ_7, PULSE_LINE, MC68020_INT_ACK_AUTOVECTOR);
|
| 505 | | }
|
| 506 | | |
| 507 | | static MACHINE_START( glasgow )
|
| 508 | | {
|
| 509 | | key_selector=0;
|
| 510 | | irq_flag=0;
|
| 511 | | lcd_shift_counter=3;
|
| 512 | | timer_pulse(ATTOTIME_IN_HZ(50), 0, update_nmi);
|
| 513 | | beep_set_frequency(0, 44);
|
| 514 | | }
|
| 515 | | |
| 516 | | |
| 517 | | static MACHINE_START( dallas32 )
|
| 518 | | {
|
| 519 | | lcd_shift_counter=3;
|
| 520 | | |
| 521 | | timer_pulse(ATTOTIME_IN_HZ(50), 0, update_nmi32);
|
| 522 | | beep_set_frequency(0, 44);
|
| 523 | | }
|
| 524 | | |
| 525 | | |
| 526 | | static MACHINE_RESET( glasgow )
|
| 527 | | {
|
| 528 | | lcd_shift_counter=3;
|
| 529 | | |
| 530 | | clear_layout();
|
| 531 | | set_render_board();
|
| 532 | | set_status_of_pieces();
|
| 533 | | }
|
| 534 | | |
| 535 | | |
| 536 | | |
| 537 | | static VIDEO_START( glasgow )
|
| 538 | | {
|
| 539 | | }
|
| 540 | | |
| 541 | | static VIDEO_UPDATE( glasgow )
|
| 542 | | {
|
| 543 | | // INT32 lg_x, lg_y;
|
| 544 | | // UINT8 p_key;
|
| 545 | | |
| 546 | | char *piece;
|
| 547 | | |
| 548 | | float save_x, save_y;
|
| 549 | | |
| 550 | | my_target = render_get_ui_target();
|
| 551 | | |
| 552 | | // Get view item of cursor
|
| 553 | | //
|
| 554 | | // my_cursor = my_target->curview->itemlist[3]->next;
|
| 555 | | if (my_cursor == NULL)
|
| 556 | | my_cursor = get_view_item(my_target,"CURSOR_1");
|
| 557 | | |
| 558 | | // my_cursor = my_target->curview->itemlist[2];
|
| 559 | | |
| 560 | | // Mouse movement
|
| 561 | | //
|
| 562 | | if (my_cursor != NULL)
|
| 563 | | set_cursor (my_cursor);
|
| 564 | | |
| 565 | | m_button1=readinputport(0x04);
|
| 566 | | m_button2=readinputport(0x05);
|
| 567 | | |
| 568 | | if ( m_button1) MOUSE_BUTTON1_WAIT = 0;
|
| 569 | | |
| 570 | | if ( m_button1 != 1 && !MOUSE_BUTTON1_WAIT )
|
| 571 | | {
|
| 572 | | |
| 573 | | MOUSE_BUTTON1_WAIT = 1;
|
| 574 | | |
| 575 | | if (MOUSE_MOVE == 0)
|
| 576 | | {
|
| 577 | | |
| 578 | | cursor_field = get_field(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0, MOUSE_MOVE);
|
| 579 | | if ( strcmp((char *)cursor_field.piece, "0") && (strcmp((char *)cursor_field.piece, EMP)) && strcmp(my_cursor->name, (char *)cursor_field.piece ) )
|
| 580 | | {
|
| 581 | | update_board(my_target,cursor_field, 0);
|
| 582 | | |
| 583 | | my_cursor->color.a = 0;
|
| 584 | | |
| 585 | | my_cursor = get_view_item(my_target, (char *)cursor_field.piece);
|
| 586 | | my_cursor->color.a = 0.5;
|
| 587 | | |
| 588 | | MOUSE_MOVE = 1;
|
| 589 | | |
| 590 | | }
|
| 591 | | } // ENDIF MOUSE_MOVE
|
| 592 | | else
|
| 593 | | {
|
| 594 | | |
| 595 | | save_x = my_cursor->rawbounds.x0;
|
| 596 | | save_y = my_cursor->rawbounds.y0;
|
| 597 | | |
| 598 | | cursor_field = get_field(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0, MOUSE_MOVE);
|
| 599 | | if ( strcmp((char *)cursor_field.piece, "0") && strcmp(my_cursor->name, "CURSOR_1") )
|
| 600 | | {
|
| 601 | | |
| 602 | | // Put piece back to board
|
| 603 | | //
|
| 604 | | strcpy((char *)cursor_field.piece, (char *)my_cursor->name);
|
| 605 | | update_board(my_target,cursor_field, 1);
|
| 606 | | my_cursor->color.a = 1;
|
| 607 | | |
| 608 | | // Set piece to field
|
| 609 | | //
|
| 610 | | calculate_bounds(my_cursor, (float) cursor_field.x, (float) cursor_field.y, 0 ,0 );
|
| 611 | | |
| 612 | | |
| 613 | | // Get old cursor and set new x,y
|
| 614 | | //
|
| 615 | | my_cursor = get_view_item(my_target,"CURSOR_1");
|
| 616 | | my_cursor->color.a = 1;
|
| 617 | | |
| 618 | | calculate_bounds(my_cursor, save_x, save_y,MOUSE_X ,MOUSE_Y );
|
| 619 | | |
| 620 | | MOUSE_MOVE = 0;
|
| 621 | | |
| 622 | | }//ENDIF curosr_field
|
| 623 | | |
| 624 | | // piece is set out of board -> remove it
|
| 625 | | //
|
| 626 | | if ( out_of_board(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0) )
|
| 627 | | {
|
| 628 | | |
| 629 | | save_x = my_cursor->rawbounds.x0;
|
| 630 | | save_y = my_cursor->rawbounds.y0;
|
| 631 | | |
| 632 | | my_cursor->color.a = 0;
|
| 633 | | my_cursor = get_view_item(my_target,"CURSOR_1");
|
| 634 | | my_cursor->color.a = 1;
|
| 635 | | calculate_bounds(my_cursor, save_x, save_y,MOUSE_X ,MOUSE_X );
|
| 636 | | |
| 637 | | MOUSE_MOVE = 0;
|
| 638 | | }
|
| 639 | | |
| 640 | | }//ELSE MOUSE_MOVE
|
| 641 | | |
| 642 | | } // ENDIF m_button1
|
| 643 | | |
| 644 | | |
| 645 | | // right mouse button -> set pieces
|
| 646 | | //
|
| 647 | | if ( m_button2) MOUSE_BUTTON2_WAIT = 0;
|
| 648 | | if ( m_button2 != 1 && !MOUSE_BUTTON2_WAIT )
|
| 649 | | {
|
| 650 | | |
| 651 | | MOUSE_BUTTON2_WAIT = 1;
|
| 652 | | |
| 653 | | // save cursor position
|
| 654 | | //
|
| 655 | | save_x = my_cursor->rawbounds.x0;
|
| 656 | | save_y = my_cursor->rawbounds.y0;
|
| 657 | | |
| 658 | | // cursor off
|
| 659 | | //
|
| 660 | | my_cursor->color.a = 0;
|
| 661 | | |
| 662 | | // change cursor to piece
|
| 663 | | //
|
| 664 | | piece = get_non_set_pieces(my_cursor->name);
|
| 665 | | |
| 666 | | if (strcmp(piece,NO_PIECE))
|
| 667 | | {
|
| 668 | | my_cursor = get_view_item(my_target,piece);
|
| 669 | | my_cursor->color.a = 0.5;
|
| 670 | | |
| 671 | | calculate_bounds(my_cursor, save_x, save_y, 0 ,0 );
|
| 672 | | |
| 673 | | MOUSE_MOVE = 1;
|
| 674 | | }
|
| 675 | | else
|
| 676 | | {
|
| 677 | | my_cursor = get_view_item(my_target,"CURSOR_1");
|
| 678 | | my_cursor->color.a = 1;
|
| 679 | | calculate_bounds(my_cursor, save_x, save_y, MOUSE_X ,MOUSE_X );
|
| 680 | | MOUSE_MOVE = 0;
|
| 681 | | }
|
| 682 | | |
| 683 | | }
|
| 684 | | |
| 685 | | // Put Item back to render
|
| 686 | | //
|
| 687 | | render_set_ui_target (my_target);
|
| 688 | | |
| 689 | | return 0;
|
| 690 | | }
|
| 691 | | |
| 692 | | |
| 693 | | static ADDRESS_MAP_START(glasgow_mem, ADDRESS_SPACE_PROGRAM, 16)
|
| 694 | | AM_RANGE( 0x0000, 0xffff ) AM_ROM
|
| 695 | | AM_RANGE( 0x00ff0000, 0x00ff0001) AM_MIRROR ( 0xfe0000 ) AM_WRITE ( write_lcd_gg )
|
| 696 | | AM_RANGE( 0x00ff0002, 0x00ff0003) AM_MIRROR ( 0xfe0002 ) AM_READWRITE ( read_keys,write_keys )
|
| 697 | | AM_RANGE( 0x00ff0004, 0x00ff0005) AM_MIRROR ( 0xfe0004 ) AM_WRITE ( write_lcd_flag_gg )
|
| 698 | | AM_RANGE( 0x00ff0006, 0x00ff0007) AM_MIRROR ( 0xfe0006 ) AM_READWRITE ( read_board, write_beeper )
|
| 699 | | AM_RANGE( 0x00ff0008, 0x00ff0009) AM_MIRROR ( 0xfe0008 ) AM_WRITE ( write_board )
|
| 700 | | AM_RANGE( 0x00ffC000, 0x00ffFFFF) AM_MIRROR ( 0xfeC000 ) AM_RAM // 16KB
|
| 701 | | ADDRESS_MAP_END
|
| 702 | | |
| 703 | | |
| 704 | | static ADDRESS_MAP_START(amsterd_mem, ADDRESS_SPACE_PROGRAM, 16)
|
| 705 | | // ADDRESS_MAP_FLAGS( AMEF_ABITS(19) )
|
| 706 | | AM_RANGE( 0x0000, 0xffff ) AM_ROM
|
| 707 | | AM_RANGE( 0x00800002, 0x00800003) AM_WRITE( write_lcd )
|
| 708 | | AM_RANGE( 0x00800008, 0x00800009) AM_WRITE( write_lcd_flag )
|
| 709 | | AM_RANGE( 0x00800004, 0x00800005) AM_WRITE( write_irq_flag )
|
| 710 | | AM_RANGE( 0x00800010, 0x00800011) AM_WRITE( write_board )
|
| 711 | | AM_RANGE( 0x00800020, 0x00800021) AM_READ ( read_board )
|
| 712 | | AM_RANGE( 0x00800040, 0x00800041) AM_READ ( read_newkeys16 )
|
| 713 | | AM_RANGE( 0x00800088, 0x00800089) AM_WRITE( write_beeper )
|
| 714 | | AM_RANGE( 0x00ffC000, 0x00ffFFFF) AM_RAM // 16KB
|
| 715 | | ADDRESS_MAP_END
|
| 716 | | |
| 717 | | |
| 718 | | static ADDRESS_MAP_START(dallas32_mem, ADDRESS_SPACE_PROGRAM, 32)
|
| 719 | | //ADDRESS_MAP_FLAGS( AMEF_ABITS(17) )
|
| 720 | | AM_RANGE( 0x0000, 0xffff ) AM_ROM
|
| 721 | | AM_RANGE( 0x00800000, 0x00800003) AM_WRITE ( write_lcd32 )
|
| 722 | | AM_RANGE( 0x00800004, 0x00800007) AM_WRITE ( write_beeper32 )
|
| 723 | | AM_RANGE( 0x00800008, 0x0080000B) AM_WRITE ( write_lcd_flag32 )
|
| 724 | | AM_RANGE( 0x00800010, 0x00800013) AM_WRITE ( write_board32 )
|
| 725 | | AM_RANGE( 0x00800020, 0x00800023) AM_READ ( read_board32 )
|
| 726 | | AM_RANGE( 0x00800040, 0x00800043) AM_READ ( read_newkeys32 )
|
| 727 | | AM_RANGE( 0x00800088, 0x0080008b) AM_WRITE ( write_keys32 )
|
| 728 | | AM_RANGE( 0x0010000, 0x001FFFF) AM_RAM // 64KB
|
| 729 | | ADDRESS_MAP_END
|
| 730 | | |
| 731 | | static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32
|
| 732 | | PORT_START
|
| 733 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_A )
|
| 734 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_B )
|
| 735 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_C )
|
| 736 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_D )
|
| 737 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_E )
|
| 738 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F )
|
| 739 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_1 )
|
| 740 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_2 )
|
| 741 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_3 )
|
| 742 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_4 )
|
| 743 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_5 )
|
| 744 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_6 )
|
| 745 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_9 )
|
| 746 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_0 )
|
| 747 | | PORT_START
|
| 748 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1 )
|
| 749 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2 )
|
| 750 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3 )
|
| 751 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4 )
|
| 752 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_F5 )
|
| 753 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER )
|
| 754 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_G )
|
| 755 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_H )
|
| 756 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7 )
|
| 757 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8 )
|
| 758 | | INPUT_PORTS_END
|
| 759 | | |
| 760 | | |
| 761 | | |
| 762 | | static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas
|
| 763 | | PORT_START
|
| 764 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9 )
|
| 765 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F5 )
|
| 766 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_C )
|
| 767 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_3 )
|
| 768 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER )
|
| 769 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_D )
|
| 770 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_4 )
|
| 771 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_A )
|
| 772 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_1 )
|
| 773 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F )
|
| 774 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_6 )
|
| 775 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_B )
|
| 776 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_2 )
|
| 777 | | PORT_START
|
| 778 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_E )
|
| 779 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_5 )
|
| 780 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1 )
|
| 781 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0 )
|
| 782 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2 )
|
| 783 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_H )
|
| 784 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8 )
|
| 785 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3)
|
| 786 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_G )
|
| 787 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7 )
|
| 788 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4)
|
| 789 | | |
| 790 | | PORT_START
|
| 791 | | PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535) PORT_PLAYER(1)
|
| 792 | | |
| 793 | | PORT_START
|
| 794 | | PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535) PORT_PLAYER(1)
|
| 795 | | |
| 796 | | PORT_START
|
| 797 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("left button")
|
| 798 | | |
| 799 | | PORT_START
|
| 800 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("right button")
|
| 801 | | |
| 802 | | |
| 803 | | INPUT_PORTS_END
|
| 804 | | |
| 805 | | |
| 806 | | |
| 807 | | static MACHINE_DRIVER_START(glasgow )
|
| 808 | | /* basic machine hardware */
|
| 809 | | MDRV_CPU_ADD_TAG("main", M68000, 12000000)
|
| 810 | | MDRV_CPU_PROGRAM_MAP(glasgow_mem, 0)
|
| 811 | | MDRV_MACHINE_START( glasgow )
|
| 812 | | MDRV_MACHINE_RESET( glasgow )
|
| 813 | | /* video hardware */
|
| 814 | | MDRV_SCREEN_REFRESH_RATE(60)
|
| 815 | | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
|
| 816 | | |
| 817 | | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
|
| 818 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
| 819 | | MDRV_SCREEN_SIZE(640, 480)
|
| 820 | | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
|
| 821 | | MDRV_PALETTE_LENGTH(4)
|
| 822 | | |
| 823 | | MDRV_DEFAULT_LAYOUT(layout_glasgow)
|
| 824 | | MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 825 | | MDRV_SOUND_ADD(BEEP, 0)
|
| 826 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
| 827 | | MDRV_VIDEO_START(glasgow)
|
| 828 | | MDRV_VIDEO_UPDATE(glasgow)
|
| 829 | | MACHINE_DRIVER_END
|
| 830 | | |
| 831 | | |
| 832 | | static MACHINE_DRIVER_START(amsterd )
|
| 833 | | MDRV_IMPORT_FROM( glasgow )
|
| 834 | | /* basic machine hardware */
|
| 835 | | MDRV_CPU_MODIFY("main")
|
| 836 | | MDRV_CPU_PROGRAM_MAP(amsterd_mem, 0)
|
| 837 | | MACHINE_DRIVER_END
|
| 838 | | |
| 839 | | |
| 840 | | static MACHINE_DRIVER_START(dallas32 )
|
| 841 | | MDRV_IMPORT_FROM( glasgow )
|
| 842 | | /* basic machine hardware */
|
| 843 | | MDRV_CPU_REPLACE("main", M68020, 14000000)
|
| 844 | | MDRV_CPU_PROGRAM_MAP(dallas32_mem, 0)
|
| 845 | | MDRV_MACHINE_START( dallas32 )
|
| 846 | | MACHINE_DRIVER_END
|
| 847 | | |
| 848 | | |
| 849 | | /***************************************************************************
|
| 850 | | ROM definitions
|
| 851 | | ***************************************************************************/
|
| 852 | | |
| 853 | | ROM_START( glasgow )
|
| 854 | | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 855 | | //ROM_LOAD("glasgow.rom", 0x000000, 0x10000, CRC(3e73eff3) )
|
| 856 | | ROM_LOAD16_BYTE("me3_3_1u.410",0x00000, 0x04000,CRC(bc8053ba) SHA1(57ea2d5652bfdd77b17d52ab1914de974bd6be12))
|
| 857 | | ROM_LOAD16_BYTE("me3_1_1l.410",0x00001, 0x04000,CRC(d5263c39) SHA1(1bef1cf3fd96221eb19faecb6ec921e26ac10ac4))
|
| 858 | | ROM_LOAD16_BYTE("me3_4_2u.410",0x08000, 0x04000,CRC(8dba504a) SHA1(6bfab03af835cdb6c98773164d32c76520937efe))
|
| 859 | | ROM_LOAD16_BYTE("me3_2_2l.410",0x08001, 0x04000,CRC(b3f27827) SHA1(864ba897d24024592d08c4ae090aa70a2cc5f213))
|
| 860 | | ROM_END
|
| 861 | | |
| 862 | | ROM_START( amsterd )
|
| 863 | | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 )
|
| 864 | | //ROM_LOAD16_BYTE("output.bin", 0x000000, 0x10000, CRC(3e73eff3) )
|
| 865 | | ROM_LOAD16_BYTE("amsterda-u.bin",0x00000, 0x05a00,CRC(16cefe29) SHA1(9f8c2896e92fbfd47159a59cb5e87706092c86f4))
|
| 866 | | ROM_LOAD16_BYTE("amsterda-l.bin",0x00001, 0x05a00,CRC(c859dfde) SHA1(b0bca6a8e698c322a8c597608db6735129d6cdf0))
|
| 867 | | ROM_END
|
| 868 | | |
| 869 | | |
| 870 | | ROM_START( dallas )
|
| 871 | | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 )
|
| 872 | | ROM_LOAD16_BYTE("dal_g_pr.dat",0x00000, 0x04000,CRC(66deade9) SHA1(07ec6b923f2f053172737f1fc94aec84f3ea8da1))
|
| 873 | | ROM_LOAD16_BYTE("dal_g_pl.dat",0x00001, 0x04000,CRC(c5b6171c) SHA1(663167a3839ed7508ecb44fd5a1b2d3d8e466763))
|
| 874 | | ROM_LOAD16_BYTE("dal_g_br.dat",0x08000, 0x04000,CRC(e24d7ec7) SHA1(a936f6fcbe9bfa49bf455f2d8a8243d1395768c1))
|
| 875 | | ROM_LOAD16_BYTE("dal_g_bl.dat",0x08001, 0x04000,CRC(144a15e2) SHA1(c4fcc23d55fa5262f5e01dbd000644a7feb78f32))
|
| 876 | | ROM_END
|
| 877 | | |
| 878 | | ROM_START( dallas16 )
|
| 879 | | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 )
|
| 880 | | ROM_LOAD16_BYTE("dallas-u.bin",0x00000, 0x06f00,CRC(8c1462b4) SHA1(8b5f5a774a835446d08dceacac42357b9e74cfe8))
|
| 881 | | ROM_LOAD16_BYTE("dallas-l.bin",0x00001, 0x06f00,CRC(f0d5bc03) SHA1(4b1b9a71663d5321820b4cf7da205e5fe5d3d001))
|
| 882 | | ROM_END
|
| 883 | | |
| 884 | | ROM_START( roma )
|
| 885 | | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 )
|
| 886 | | ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd))
|
| 887 | | ROM_END
|
| 888 | | |
| 889 | | ROM_START( dallas32 )
|
| 890 | | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 891 | | ROM_LOAD("dallas32.epr", 0x000000, 0x10000, CRC(83b9ff3f) SHA1(97bf4cb3c61f8ec328735b3c98281bba44b30a28) )
|
| 892 | | ROM_END
|
| 893 | | |
| 894 | | ROM_START( roma32 )
|
| 895 | | ROM_REGION( 0x10000, REGION_CPU1, 0 )
|
| 896 | | ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd) )
|
| 897 | | ROM_END
|
| 898 | | |
| 899 | | /***************************************************************************
|
| 900 | | System config
|
| 901 | | ***************************************************************************/
|
| 902 | | |
| 903 | | |
| 904 | | |
| 905 | | /***************************************************************************
|
| 906 | | Game drivers
|
| 907 | | ***************************************************************************/
|
| 908 | | |
| 909 | | /* YEAR, NAME, PARENT, BIOS, COMPAT MACHINE,INPUT, INIT, CONFIG, COMPANY, FULLNAME, FLAGS */
|
| 910 | | CONS( 1984, glasgow, 0, 0, glasgow, old_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", 0)
|
| 911 | | CONS( 1984, amsterd, 0, 0, amsterd, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", 0)
|
| 912 | | CONS( 1984, dallas, 0, 0, glasgow, old_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas", 0)
|
| 913 | | CONS( 1984, roma, 0, 0, glasgow, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Roma", 0)
|
| 914 | | CONS( 1984, dallas32, 0, 0, dallas32, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", 0)
|
| 915 | | CONS( 1984, roma32, 0, 0, dallas32, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", 0)
|
| 916 | | CONS( 1984, dallas16, 0, 0, amsterd, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", 0)
|
| 917 | | |
| 918 | | |
| 919 | | |
| 920 | | static void set_cursor (view_item *view_cursor)
|
| 921 | | {
|
| 922 | | |
| 923 | | static INT16 save_x, save_y;
|
| 924 | | static float diff_x, diff_y, del_x, del_y;
|
| 925 | | |
| 926 | | save_x = m_x;
|
| 927 | | save_y = m_y;
|
| 928 | | |
| 929 | | m_x=readinputport(0x02);
|
| 930 | | m_y=readinputport(0x03);
|
| 931 | | |
| 932 | | // logerror("m_x = %d \n ",m_x);
|
| 933 | | // logerror("m_y = %d \n ",m_y);
|
| 934 | | |
| 935 | | diff_x = (float) (save_x - m_x) / MOUSE_SPEED;
|
| 936 | | diff_y = (float) (save_y - m_y) / MOUSE_SPEED;
|
| 937 | | |
| 938 | | del_x = view_cursor->rawbounds.x1 - view_cursor->rawbounds.x0;
|
| 939 | | del_y = view_cursor->rawbounds.y1 - view_cursor->rawbounds.y0;
|
| 940 | | |
| 941 | | // Set Cursor, depending on limits
|
| 942 | | //
|
| 943 | | view_cursor->rawbounds.x0 = view_cursor->rawbounds.x0 - diff_x;
|
| 944 | | |
| 945 | | if ( view_cursor->rawbounds.x0 > MAX_CURSOR_X )
|
| 946 | | view_cursor->rawbounds.x0 = MAX_CURSOR_X;
|
| 947 | | |
| 948 | | if ( view_cursor->rawbounds.x0 < MIN_CURSOR_X )
|
| 949 | | view_cursor->rawbounds.x0 = MIN_CURSOR_X;
|
| 950 | | |
| 951 | | view_cursor->rawbounds.y0 = view_cursor->rawbounds.y0 - diff_y;
|
| 952 | | |
| 953 | | if ( view_cursor->rawbounds.y0 > MAX_CURSOR_Y )
|
| 954 | | view_cursor->rawbounds.y0 = MAX_CURSOR_Y;
|
| 955 | | |
| 956 | | if ( view_cursor->rawbounds.y0 < MIN_CURSOR_Y )
|
| 957 | | view_cursor->rawbounds.y0 = MIN_CURSOR_Y;
|
| 958 | | |
| 959 | | view_cursor->rawbounds.x1 = view_cursor->rawbounds.x0 + del_x;
|
| 960 | | view_cursor->rawbounds.y1 = view_cursor->rawbounds.y0 + del_y;
|
| 961 | | |
| 962 | | // Calculate bounds
|
| 963 | | //
|
| 964 | | view_cursor->bounds.x0 = view_cursor->rawbounds.x0 / MAX_X;
|
| 965 | | view_cursor->bounds.y0 = view_cursor->rawbounds.y0 / MAX_Y;
|
| 966 | | view_cursor->bounds.x1 = view_cursor->rawbounds.x1 / MAX_X;
|
| 967 | | view_cursor->bounds.y1 = view_cursor->rawbounds.y1 / MAX_Y;
|
| 968 | | |
| 969 | | }
|
| 970 | | |
| 971 | | //render_target *render_target_get_indexed
|
| 972 | | |
| 973 | | |
| 974 | | view_item *get_view_item(render_target *target, const char *v_name)
|
| 975 | | {
|
| 976 | | |
| 977 | | view_item *cur_view;
|
| 978 | | cur_view = target->curview->itemlist[3]->next;
|
| 979 | | |
| 980 | | for (; cur_view != NULL; cur_view = cur_view->next)
|
| 981 | | {
|
| 982 | | if (!strcmp(cur_view->name, v_name))
|
| 983 | | {
|
| 984 | | return (cur_view);
|
| 985 | | }
|
| 986 | | }
|
| 987 | | |
| 988 | | return (NULL);
|
| 989 | | }
|
| 990 | | |
| 991 | | |
| 992 | | BOARD_FIELD get_field( float i_x, float i_y, UINT8 mouse_move)
|
| 993 | | {
|
| 994 | | UINT8 i_AH, i_18;
|
| 995 | | float corr_x, corr_y;
|
| 996 | | |
| 997 | | |
| 998 | | float f_x, f_y;
|
| 999 | | |
| 1000 | | BOARD_FIELD null_board = { 0,0,0,"0"};
|
| 1001 | | |
| 1002 | | |
| 1003 | | // Correction of mouse pointer
|
| 1004 | | //
|
| 1005 | | if (!mouse_move)
|
| 1006 | | {
|
| 1007 | | corr_x = i_x+29.0;
|
| 1008 | | corr_y = i_y+22.0;
|
| 1009 | | }else
|
| 1010 | | {
|
| 1011 | | corr_x = i_x+28;
|
| 1012 | | corr_y = i_y+28;
|
| 1013 | | }
|
| 1014 | | |
| 1015 | | // Loop über alle Spalten
|
| 1016 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 1017 | | {
|
| 1018 | | |
| 1019 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 1020 | | {
|
| 1021 | | f_x = (float) m_board [i_18] [i_AH].x;
|
| 1022 | | f_y = (float) m_board [i_18] [i_AH].y;
|
| 1023 | | |
| 1024 | | if ( ( corr_x >= f_x && corr_x <= f_x+56 ) && ( corr_y >= f_y && corr_y <= f_y+56 ) )
|
| 1025 | | {
|
| 1026 | | return (m_board [i_18] [i_AH]);
|
| 1027 | | }
|
| 1028 | | |
| 1029 | | }
|
| 1030 | | }
|
| 1031 | | |
| 1032 | | return (null_board);
|
| 1033 | | }
|
| 1034 | | |
| 1035 | | |
| 1036 | | static unsigned int out_of_board( float x0, float y0)
|
| 1037 | | {
|
| 1038 | | |
| 1039 | | if ( ( x0 >= MIN_BOARD_X && x0 <= MAX_BOARD_X ) && ( y0 >= MIN_BOARD_Y && y0 <= MAX_BOARD_Y ) )
|
| 1040 | | {
|
| 1041 | | return (0);
|
| 1042 | | }
|
| 1043 | | else
|
| 1044 | | {
|
| 1045 | | return (1);
|
| 1046 | | }
|
| 1047 | | }
|
| 1048 | | |
| 1049 | | |
| 1050 | | |
| 1051 | | static void update_board(render_target *target, BOARD_FIELD board_field, unsigned int update_clear_flag)
|
| 1052 | | {
|
| 1053 | | |
| 1054 | | UINT8 i_18, i_AH;
|
| 1055 | | |
| 1056 | | view_item *view_item;
|
| 1057 | | |
| 1058 | | div_t div_result;
|
| 1059 | | |
| 1060 | | div_result = div(board_field.field, 8);
|
| 1061 | | |
| 1062 | | i_18 = div_result.quot;
|
| 1063 | | i_AH = 7 - div_result.rem;
|
| 1064 | | |
| 1065 | | if (update_clear_flag)
|
| 1066 | | {
|
| 1067 | | // there is already a piece on target field - > set it invisible
|
| 1068 | | //
|
| 1069 | | view_item = get_view_item(target, (char *)m_board[i_18][i_AH].piece);
|
| 1070 | | if (view_item != NULL)
|
| 1071 | | {
|
| 1072 | | view_item->color.a = 0;
|
| 1073 | | }
|
| 1074 | | strcpy ((char *)&m_board[i_18][i_AH].piece[0], (char *)&board_field.piece[0]);
|
| 1075 | | }else
|
| 1076 | | {
|
| 1077 | | strcpy ((char *)m_board[i_18][i_AH].piece, EMP);
|
| 1078 | | }
|
| 1079 | | |
| 1080 | | set_status_of_pieces();
|
| 1081 | | |
| 1082 | | }
|
| 1083 | | |
| 1084 | | static void calculate_bounds(view_item *view_item, float new_x0, float new_y0, float new_del_x, float new_del_y )
|
| 1085 | | {
|
| 1086 | | |
| 1087 | | static float del_x, del_y;
|
| 1088 | | |
| 1089 | | if (new_del_x)
|
| 1090 | | {
|
| 1091 | | del_x = new_del_x;
|
| 1092 | | }
|
| 1093 | | else
|
| 1094 | | {
|
| 1095 | | del_x = view_item->rawbounds.x1 - view_item->rawbounds.x0;
|
| 1096 | | }
|
| 1097 | | |
| 1098 | | if (new_del_y)
|
| 1099 | | {
|
| 1100 | | del_y = new_del_y;
|
| 1101 | | }
|
| 1102 | | else
|
| 1103 | | {
|
| 1104 | | del_y = view_item->rawbounds.y1 - view_item->rawbounds.y0;
|
| 1105 | | }
|
| 1106 | | |
| 1107 | | view_item->rawbounds.x0 = new_x0;
|
| 1108 | | view_item->rawbounds.y0 = new_y0;
|
| 1109 | | view_item->rawbounds.x1 = view_item->rawbounds.x0 + del_x;
|
| 1110 | | view_item->rawbounds.y1 = view_item->rawbounds.y0 + del_y;
|
| 1111 | | |
| 1112 | | // Calculate bounds
|
| 1113 | | //
|
| 1114 | | view_item->bounds.x0 = view_item->rawbounds.x0 / MAX_X;
|
| 1115 | | view_item->bounds.y0 = view_item->rawbounds.y0 / MAX_Y;
|
| 1116 | | view_item->bounds.x1 = view_item->rawbounds.x1 / MAX_X;
|
| 1117 | | view_item->bounds.y1 = view_item->rawbounds.y1 / MAX_Y;
|
| 1118 | | |
| 1119 | | }
|
| 1120 | | |
| 1121 | | |
| 1122 | | static void set_render_board()
|
| 1123 | | {
|
| 1124 | | |
| 1125 | | view_item *view_item;
|
| 1126 | | UINT8 i_AH, i_18;
|
| 1127 | | |
| 1128 | | my_target = render_get_ui_target();
|
| 1129 | | |
| 1130 | | |
| 1131 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 1132 | | {
|
| 1133 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 1134 | | {
|
| 1135 | | |
| 1136 | | // copy start postition to m_board
|
| 1137 | | //
|
| 1138 | | m_board[i_18][i_AH] = start_board [i_18] [i_AH];
|
| 1139 | | |
| 1140 | | // Get view item of this piece
|
| 1141 | | //
|
| 1142 | | if (strcmp((char *)m_board[i_18][i_AH].piece, EMP))
|
| 1143 | | {
|
| 1144 | | view_item = get_view_item(my_target, (char *)m_board[i_18][i_AH].piece);
|
| 1145 | | |
| 1146 | | // change all pieces
|
| 1147 | | //
|
| 1148 | | if (view_item != NULL)
|
| 1149 | | {
|
| 1150 | | calculate_bounds(view_item, m_board[i_18][i_AH].x, m_board[i_18][i_AH].y, 0, 0 );
|
| 1151 | | view_item->color.a = 1.0;
|
| 1152 | | }//ENDIF view_item
|
| 1153 | | |
| 1154 | | } // ENDIF strcmp
|
| 1155 | | }// FOR i_18
|
| 1156 | | }// FOR i_AH
|
| 1157 | | |
| 1158 | | render_set_ui_target (my_target);
|
| 1159 | | |
| 1160 | | }
|
| 1161 | | |
| 1162 | | static void clear_layout()
|
| 1163 | | {
|
| 1164 | | |
| 1165 | | view_item *view_item;
|
| 1166 | | UINT8 i;
|
| 1167 | | |
| 1168 | | my_target = render_get_ui_target();
|
| 1169 | | |
| 1170 | | for ( i = 0; i < 44; i = i + 1)
|
| 1171 | | {
|
| 1172 | | view_item = get_view_item(my_target,(char *)all_pieces[i].piece);
|
| 1173 | | if (view_item != NULL)
|
| 1174 | | {
|
| 1175 | | view_item->color.a = 0.0;
|
| 1176 | | }
|
| 1177 | | }
|
| 1178 | | |
| 1179 | | render_set_ui_target (my_target);
|
| 1180 | | |
| 1181 | | }
|
| 1182 | | |
| 1183 | | |
| 1184 | | |
| 1185 | | static void set_status_of_pieces()
|
| 1186 | | {
|
| 1187 | | |
| 1188 | | UINT8 i_AH, i_18 , i;
|
| 1189 | | BOARD_FIELD field;
|
| 1190 | | |
| 1191 | | |
| 1192 | | for ( i = 0; i < 47; i = i + 1)
|
| 1193 | | {
|
| 1194 | | |
| 1195 | | all_pieces[i].set = 0;
|
| 1196 | | |
| 1197 | | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1)
|
| 1198 | | {
|
| 1199 | | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1)
|
| 1200 | | {
|
| 1201 | | |
| 1202 | | // set status depending piece is in game or not
|
| 1203 | | //
|
| 1204 | | field = m_board[i_18][i_AH];
|
| 1205 | | |
| 1206 | | if (!strcmp((char *)m_board[i_18][i_AH].piece, (char *) all_pieces[i].piece))
|
| 1207 | | {
|
| 1208 | | all_pieces[i].set = 1;
|
| 1209 | | break;
|
| 1210 | | }
|
| 1211 | | |
| 1212 | | } // END for i_18=0
|
| 1213 | | |
| 1214 | | if (all_pieces[i].set) break;
|
| 1215 | | |
| 1216 | | }// END for i_AH=0
|
| 1217 | | } // END for i=0
|
| 1218 | | |
| 1219 | | }
|
| 1220 | | |
| 1221 | | |
| 1222 | | static char *get_non_set_pieces(const char *cur_piece)
|
| 1223 | | {
|
| 1224 | | UINT8 i=0;
|
| 1225 | | |
| 1226 | | do
|
| 1227 | | {
|
| 1228 | | |
| 1229 | | start_i = start_i+1;
|
| 1230 | | if ( start_i == 44) start_i = 0;
|
| 1231 | | |
| 1232 | | |
| 1233 | | if (!all_pieces[start_i].set && ( all_pieces[start_i].piece[0] != cur_piece[0] ||
|
| 1234 | | all_pieces[start_i].piece[1] != cur_piece[1]) )
|
| 1235 | | {
|
| 1236 | | return ((char *)&all_pieces[start_i].piece[0]);
|
| 1237 | | }
|
| 1238 | | |
| 1239 | | i=i+1;
|
| 1240 | | }
|
| 1241 | | while (i != 44);
|
| 1242 | | |
| 1243 | | return (NO_PIECE);
|
| 1244 | | }
|
| 1245 | | |
| 1246 | | |
| 1 | /*************************************************************************** |
| 2 | Mephisto Glasgow 3 S chess computer |
| 3 | Dirk V. |
| 4 | sp_rinter@gmx.de |
| 5 | |
| 6 | 68000 CPU |
| 7 | 64 KB ROM |
| 8 | 16 KB RAM |
| 9 | 4 Digit LC Display |
| 10 | |
| 11 | 3* 74LS138 Decoder/Multiplexer |
| 12 | 1*74LS74 Dual positive edge triggered D Flip Flop |
| 13 | 1*74LS139 1of4 Demultiplexer |
| 14 | 1*74LS05 HexInverter |
| 15 | 1*NE555 R=100K C=10uF |
| 16 | 2*74LS04 Hex Inverter |
| 17 | 1*74LS164 8 Bit Shift register |
| 18 | 1*74121 Monostable Multivibrator with Schmitt Trigger Inputs |
| 19 | 1*74LS20 Dual 4 Input NAND GAte |
| 20 | 1*74LS367 3 State Hex Buffers |
| 21 | |
| 22 | |
| 23 | ***************************************************************************/ |
| 24 | |
| 25 | #include "driver.h" |
| 26 | #include "cpu/m68000/m68k.h" |
| 27 | #include "cpu/m68000/m68000.h" |
| 28 | #include "glasgow.lh" |
| 29 | #include "sound/beep.h" |
| 30 | |
| 31 | #include "render.h" |
| 32 | #include "rendlay.h" |
| 33 | |
| 34 | static UINT8 lcd_shift_counter; |
| 35 | // static UINT8 led_status; |
| 36 | static UINT8 led7; |
| 37 | static UINT8 key_low, |
| 38 | key_hi, |
| 39 | key_select, |
| 40 | irq_flag, |
| 41 | lcd_invert, |
| 42 | key_selector; |
| 43 | UINT8 board_value; |
| 44 | static UINT16 beeper; |
| 45 | |
| 46 | |
| 47 | #define MOUSE_X 56 |
| 48 | #define MOUSE_Y 56 |
| 49 | #define MAX_X 530 |
| 50 | #define MAX_Y 660 |
| 51 | #define MOUSE_SPEED 3 |
| 52 | |
| 53 | #define MIN_BOARD_X 60.0 |
| 54 | #define MAX_BOARD_X 480.0 |
| 55 | |
| 56 | #define MIN_BOARD_Y 60.0 |
| 57 | #define MAX_BOARD_Y 480.0 |
| 58 | |
| 59 | #define MIN_CURSOR_X -10 |
| 60 | #define MAX_CURSOR_X 496 |
| 61 | |
| 62 | #define MIN_CURSOR_Y 0 |
| 63 | #define MAX_CURSOR_Y 622 |
| 64 | |
| 65 | static INT16 m_x, m_y; |
| 66 | static UINT8 m_button1 , m_button2; |
| 67 | static UINT8 MOUSE_MOVE = 0; |
| 68 | static UINT8 MOUSE_BUTTON1_WAIT = 0; |
| 69 | static UINT8 MOUSE_BUTTON2_WAIT = 0; |
| 70 | |
| 71 | static UINT16 Line18_LED; |
| 72 | static UINT16 Line18_REED; |
| 73 | |
| 74 | static UINT8 read_board_flag; |
| 75 | |
| 76 | static char EMP[4] = "EMP"; |
| 77 | static char NO_PIECE[4] = "NOP"; |
| 78 | |
| 79 | |
| 80 | typedef struct { |
| 81 | unsigned int field; |
| 82 | unsigned int x; |
| 83 | unsigned int y; |
| 84 | unsigned char piece[4]; |
| 85 | } BOARD_FIELD; |
| 86 | |
| 87 | |
| 88 | #define WR 12 |
| 89 | #define WB 13 |
| 90 | #define WKN 14 |
| 91 | #define WQ 15 |
| 92 | #define WK 16 |
| 93 | |
| 94 | #define BP 21 |
| 95 | #define BR 22 |
| 96 | #define BB 23 |
| 97 | #define BKN 24 |
| 98 | #define BQ 25 |
| 99 | #define BK 26 |
| 100 | |
| 101 | |
| 102 | |
| 103 | BOARD_FIELD m_board[8][8]; |
| 104 | |
| 105 | BOARD_FIELD start_board[8][8] = |
| 106 | { |
| 107 | { { 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"} }, |
| 108 | { {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"} }, |
| 109 | |
| 110 | { {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"} }, |
| 111 | { {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"} }, |
| 112 | { {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"} }, |
| 113 | { {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"} }, |
| 114 | |
| 115 | { {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"} }, |
| 116 | { {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"} } |
| 117 | |
| 118 | }; |
| 119 | |
| 120 | |
| 121 | static BOARD_FIELD cursor_field; |
| 122 | |
| 123 | |
| 124 | typedef struct { |
| 125 | unsigned char piece[4]; |
| 126 | unsigned int selected; |
| 127 | unsigned int set; |
| 128 | } P_STATUS; |
| 129 | |
| 130 | |
| 131 | static P_STATUS all_pieces[48] = |
| 132 | { |
| 133 | {"WR1",0,0}, {"WN1",0,0},{"WB1",0,0}, {"WQ1",0,0}, {"WK",0,0}, {"WB2",0,0}, {"WN2",0,0}, {"WR2",0,0}, |
| 134 | {"WP1",0,0}, {"WP2",0,0},{"WP3",0,0}, {"WP4",0,0}, {"WP5",0,0}, {"WP6",0,0}, {"WP7",0,0}, {"WP8",0,0}, |
| 135 | |
| 136 | |
| 137 | {"BP1",0,0}, {"BP2",0,0},{"BP3",0,0}, {"BP4",0,0}, {"BP5",0,0}, {"BP6",0,0}, {"BP7",0,0}, {"BP8",0,0}, |
| 138 | {"BR1",0,0}, {"BN1",0,0},{"BB1",0,0}, {"BQ1",0,0}, {"BK",0,0}, {"BB2",0,0}, {"BN2",0,0}, {"BR2",0,0}, |
| 139 | |
| 140 | |
| 141 | {"BQ2",0,0}, {"BQ3",0,0}, {"BQ4",0,0}, {"BQ5",0,0}, {"BQ6",0,0}, {"BQ7",0,0}, |
| 142 | |
| 143 | |
| 144 | {"WQ2",0,0}, {"WQ3",0,0}, {"WQ4",0,0}, {"WQ5",0,0}, {"WQ6",0,0}, {"WQ7",0,0} |
| 145 | |
| 146 | }; |
| 147 | |
| 148 | static UINT8 start_i; |
| 149 | |
| 150 | |
| 151 | struct _render_target |
| 152 | { |
| 153 | render_target * next; /* keep a linked list of targets */ |
| 154 | layout_view * curview; /* current view */ |
| 155 | layout_file * filelist; /* list of layout files */ |
| 156 | UINT32 flags; /* creation flags */ |
| 157 | render_primitive_list primlist[2];/* list of primitives */ |
| 158 | int listindex; /* index of next primlist to use */ |
| 159 | INT32 width; /* width in pixels */ |
| 160 | INT32 height; /* height in pixels */ |
| 161 | render_bounds bounds; /* bounds of the target */ |
| 162 | float pixel_aspect; /* aspect ratio of individual pixels */ |
| 163 | float max_refresh; /* maximum refresh rate, 0 or if none */ |
| 164 | int orientation; /* orientation */ |
| 165 | int layerconfig; /* layer configuration */ |
| 166 | layout_view * base_view; /* the view at the time of first frame */ |
| 167 | int base_orientation; /* the orientation at the time of first frame */ |
| 168 | int base_layerconfig; /* the layer configuration at the time of first frame */ |
| 169 | int maxtexwidth; /* maximum width of a texture */ |
| 170 | int maxtexheight; /* maximum height of a texture */ |
| 171 | }; |
| 172 | |
| 173 | static render_target *my_target; |
| 174 | |
| 175 | static view_item *my_cursor; |
| 176 | |
| 177 | static void set_cursor (view_item *view_cursor); |
| 178 | |
| 179 | static view_item *get_view_item(render_target *target, const char *v_name); |
| 180 | |
| 181 | static BOARD_FIELD get_field( float i_x, float i_y, UINT8 mouse_move); |
| 182 | static void update_board(render_target *target, BOARD_FIELD board_field, unsigned int update_clear_flag); |
| 183 | |
| 184 | static void calculate_bounds(view_item *view_item, float new_x0, float new_y0, float new_del_x, float new_del_y ); |
| 185 | |
| 186 | static void set_render_board(void); |
| 187 | static void clear_layout(void); |
| 188 | static void set_status_of_pieces(void); |
| 189 | |
| 190 | static char * get_non_set_pieces(const char *cur_piece); |
| 191 | |
| 192 | static unsigned int out_of_board( float x0, float y0); |
| 193 | |
| 194 | |
| 195 | |
| 196 | // Used by Glasgow and Dallas |
| 197 | static WRITE16_HANDLER ( write_lcd_gg ) |
| 198 | { |
| 199 | UINT8 lcd_data; |
| 200 | lcd_data = data>>8; |
| 201 | if (led7==0) output_set_digit_value(lcd_shift_counter,lcd_data); |
| 202 | lcd_shift_counter--; |
| 203 | lcd_shift_counter&=3; |
| 204 | // logerror("LCD Offset = %d Data low = %x \n ",offset,lcd_data); |
| 205 | } |
| 206 | |
| 207 | static WRITE16_HANDLER ( write_lcd ) |
| 208 | { |
| 209 | UINT8 lcd_data; |
| 210 | lcd_data = data>>8; |
| 211 | output_set_digit_value(lcd_shift_counter,lcd_invert&1?lcd_data^0xff:lcd_data); |
| 212 | lcd_shift_counter--; |
| 213 | lcd_shift_counter&=3; |
| 214 | // logerror("LCD Offset = %d Data low = %x \n ",offset,lcd_data); |
| 215 | } |
| 216 | static WRITE16_HANDLER ( write_lcd_flag ) |
| 217 | { |
| 218 | UINT8 lcd_flag; |
| 219 | lcd_invert=0; |
| 220 | lcd_flag=data>>8; |
| 221 | //beep_set_state(0,lcd_flag&1?1:0); |
| 222 | if (lcd_flag == 0) key_selector=1; |
| 223 | if (lcd_flag!=0) led7=255;else led7=0; |
| 224 | // logerror("LCD Flag 16 = %x \n ",data); |
| 225 | } |
| 226 | |
| 227 | |
| 228 | static WRITE16_HANDLER ( write_lcd_flag_gg ) |
| 229 | { |
| 230 | UINT8 lcd_flag; |
| 231 | lcd_flag=data>>8; |
| 232 | beep_set_state(0,lcd_flag&1?1:0); |
| 233 | if (lcd_flag == 0) key_selector=1; |
| 234 | if (lcd_flag!=0) led7=255;else led7=0; |
| 235 | |
| 236 | // logerror("LCD Flag gg = %x \n ",lcd_flag); |
| 237 | } |
| 238 | |
| 239 | static WRITE16_HANDLER ( write_keys ) |
| 240 | { |
| 241 | key_select=data>>8; |
| 242 | // logerror("Write Key = %x \n ",data); |
| 243 | } |
| 244 | |
| 245 | static WRITE16_HANDLER ( write_board ) |
| 246 | { |
| 247 | UINT8 beep_flag; |
| 248 | |
| 249 | Line18_REED=data>>8; |
| 250 | |
| 251 | // LED's or REED's ? |
| 252 | // |
| 253 | if (read_board_flag) |
| 254 | { |
| 255 | Line18_LED=0; |
| 256 | read_board_flag=0; |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | Line18_LED=data>>8; |
| 261 | } |
| 262 | |
| 263 | //logerror("write_board Line18_LED = %x \n ", Line18_LED); |
| 264 | //logerror("write_board Line18_REED = %x \n ",Line18_REED); |
| 265 | |
| 266 | lcd_invert=1; |
| 267 | beep_flag=data>>8; |
| 268 | //if ((beep_flag &02)== 0) key_selector=0;else key_selector=1; |
| 269 | //logerror("Write Beeper = %x \n ",data); |
| 270 | beeper=data; |
| 271 | } |
| 272 | |
| 273 | static WRITE16_HANDLER ( write_irq_flag ) |
| 274 | { |
| 275 | |
| 276 | beep_set_state(0,data&0x100); |
| 277 | logerror("Write 0x800004 = %x \n ",data); |
| 278 | irq_flag=1; |
| 279 | beeper=data; |
| 280 | } |
| 281 | |
| 282 | static READ16_HANDLER(read_keys) // Glasgow, Dallas |
| 283 | { |
| 284 | UINT16 data; |
| 285 | data=0x0300; |
| 286 | key_low=readinputport(0x00); |
| 287 | key_hi=readinputport(0x01); |
| 288 | //logerror("Keyboard Offset = %x Data = %x\n ",offset,data); |
| 289 | if (key_select==key_low){data=data&0x100;} |
| 290 | if (key_select==key_hi){data=data&0x200;} |
| 291 | return data; |
| 292 | } |
| 293 | |
| 294 | static READ16_HANDLER(read_newkeys16) //Amsterdam, Roma |
| 295 | { |
| 296 | UINT16 data; |
| 297 | |
| 298 | if (key_selector==0) data=readinputport(0x00);else data=readinputport(0x01); |
| 299 | logerror("read Keyboard Offset = %x Data = %x Select = %x \n ",offset,data,key_selector); |
| 300 | data=data<<8; |
| 301 | return data ; |
| 302 | } |
| 303 | |
| 304 | static READ16_HANDLER(read_board) |
| 305 | { |
| 306 | UINT8 i_18, i_AH; |
| 307 | UINT16 data; |
| 308 | |
| 309 | data = 0xff; |
| 310 | |
| 311 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 312 | { |
| 313 | |
| 314 | // Looking for cleared bit in Line18 -> current line |
| 315 | // |
| 316 | if ( !(Line18_REED & (1<<i_18)) ) |
| 317 | { |
| 318 | |
| 319 | // if there is a piece on the field -> set bit in data |
| 320 | // |
| 321 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 322 | { |
| 323 | if (strcmp ((char *)m_board[i_18][i_AH].piece, EMP)) |
| 324 | { |
| 325 | data &= ~(1 << i_AH); // clear bit |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | data = data<<8; |
| 332 | |
| 333 | read_board_flag = TRUE; |
| 334 | |
| 335 | logerror("read_board_data = %x \n ", data); |
| 336 | |
| 337 | |
| 338 | // return 0xff00; // Mephisto need it for working |
| 339 | |
| 340 | |
| 341 | return data; |
| 342 | |
| 343 | } |
| 344 | |
| 345 | static WRITE16_HANDLER(write_beeper) |
| 346 | { |
| 347 | // logerror("Write Board = %x \n ",data>>8); |
| 348 | |
| 349 | UINT8 i_AH, i_18; |
| 350 | UINT16 LineAH = 0; |
| 351 | |
| 352 | UINT8 LED; |
| 353 | |
| 354 | |
| 355 | // logerror("Write Board = %x \n ",data); |
| 356 | |
| 357 | LineAH = data>>8; |
| 358 | |
| 359 | if (LineAH && Line18_LED) |
| 360 | { |
| 361 | |
| 362 | // logerror("Line18_LED = %x \n ",Line18_LED); |
| 363 | // logerror("LineAH = %x \n ",LineAH); |
| 364 | |
| 365 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 366 | { |
| 367 | |
| 368 | if ( LineAH & (1<<i_AH) ) |
| 369 | { |
| 370 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 371 | { |
| 372 | if ( !(Line18_LED & (1<<i_18)) ) |
| 373 | { |
| 374 | |
| 375 | // logerror("i_18 = %d \n ",i_18); |
| 376 | // logerror("i_AH = %d \n ",i_AH); |
| 377 | // logerror("LED an: = %d \n ",m_board[i_18][i_AH]); |
| 378 | |
| 379 | LED = m_board[i_18][i_AH].field; |
| 380 | |
| 381 | output_set_led_value( LED, 1 ); |
| 382 | |
| 383 | // LED on |
| 384 | } |
| 385 | else |
| 386 | { |
| 387 | // LED off |
| 388 | |
| 389 | } // End IF 18 |
| 390 | } // End For 18 |
| 391 | } // End IF AH |
| 392 | |
| 393 | } // End For AH |
| 394 | |
| 395 | } // End IF LineAH |
| 396 | |
| 397 | else |
| 398 | { |
| 399 | // No LED -> all LED's off |
| 400 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 401 | { |
| 402 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 403 | { |
| 404 | // LED off |
| 405 | LED = m_board[i_18][i_AH].field; |
| 406 | output_set_led_value( LED, 0 ); |
| 407 | |
| 408 | } //End For 18 |
| 409 | } // End For AH |
| 410 | |
| 411 | } //End ELSE LineAH |
| 412 | |
| 413 | } |
| 414 | |
| 415 | /* |
| 416 | static READ16_HANDLER(read_test) |
| 417 | { |
| 418 | logerror("read test Offset = %x Data = %x\n ",offset,data); |
| 419 | return 0xffff; // Mephisto need it for working |
| 420 | } |
| 421 | |
| 422 | */ |
| 423 | |
| 424 | /* |
| 425 | |
| 426 | ***** 32 Bit Read and write Handler *********** |
| 427 | |
| 428 | */ |
| 429 | |
| 430 | static WRITE32_HANDLER ( write_lcd32 ) |
| 431 | { |
| 432 | UINT8 lcd_data; |
| 433 | lcd_data = data>>8; |
| 434 | output_set_digit_value(lcd_shift_counter,lcd_invert&1?lcd_data^0xff:lcd_data); |
| 435 | lcd_shift_counter--; |
| 436 | lcd_shift_counter&=3; |
| 437 | //logerror("LCD Offset = %d Data = %x \n ",offset,lcd_data); |
| 438 | } |
| 439 | static WRITE32_HANDLER ( write_lcd_flag32 ) |
| 440 | { |
| 441 | UINT8 lcd_flag; |
| 442 | lcd_invert=0; |
| 443 | lcd_flag=data>>24; |
| 444 | if (lcd_flag == 0) key_selector=1; |
| 445 | logerror("LCD Flag 32 = %x \n ",lcd_flag); |
| 446 | //beep_set_state(0,lcd_flag&1?1:0); |
| 447 | if (lcd_flag!=0) led7=255;else led7=0; |
| 448 | } |
| 449 | |
| 450 | |
| 451 | static WRITE32_HANDLER ( write_keys32 ) |
| 452 | { |
| 453 | lcd_invert=1; |
| 454 | key_select=data; |
| 455 | logerror("Write Key = %x \n ",key_select); |
| 456 | } |
| 457 | |
| 458 | static READ32_HANDLER(read_newkeys32) // Dallas 32, Roma 32 |
| 459 | { |
| 460 | UINT32 data; |
| 461 | if (key_selector==0) data=readinputport(0x00);else data=readinputport(0x01); |
| 462 | //if (key_selector==1) data=readinputport(0x00);else data=0; |
| 463 | logerror("read Keyboard Offset = %x Data = %x\n ",offset,data); |
| 464 | data=data<<24; |
| 465 | return data ; |
| 466 | } |
| 467 | |
| 468 | |
| 469 | |
| 470 | static READ32_HANDLER(read_board32) |
| 471 | { |
| 472 | logerror("read board 32 Offset = %x \n ",offset); |
| 473 | return 0x00000000; |
| 474 | } |
| 475 | |
| 476 | |
| 477 | |
| 478 | static WRITE32_HANDLER(write_board32) |
| 479 | { |
| 480 | UINT8 board; |
| 481 | board=data>>24; |
| 482 | if (board==0xff) key_selector=0; |
| 483 | logerror("Write Board = %x \n ",data); |
| 484 | } |
| 485 | |
| 486 | |
| 487 | static WRITE32_HANDLER ( write_beeper32 ) |
| 488 | { |
| 489 | beep_set_state(0,data&0x01000000); |
| 490 | logerror("Write 0x8000004 = %x \n ",data); |
| 491 | irq_flag=1; |
| 492 | beeper=data; |
| 493 | } |
| 494 | |
| 495 | static TIMER_CALLBACK( update_nmi ) |
| 496 | { |
| 497 | // if (irq_flag==0)cpunum_set_input_line_and_vector(0, MC68000_IRQ_7, PULSE_LINE, MC68000_INT_ACK_AUTOVECTOR); |
| 498 | cpunum_set_input_line_and_vector(0, MC68000_IRQ_7, PULSE_LINE, MC68000_INT_ACK_AUTOVECTOR); |
| 499 | |
| 500 | } |
| 501 | |
| 502 | static TIMER_CALLBACK( update_nmi32 ) |
| 503 | { |
| 504 | cpunum_set_input_line_and_vector(0, MC68020_IRQ_7, PULSE_LINE, MC68020_INT_ACK_AUTOVECTOR); |
| 505 | } |
| 506 | |
| 507 | static MACHINE_START( glasgow ) |
| 508 | { |
| 509 | key_selector=0; |
| 510 | irq_flag=0; |
| 511 | lcd_shift_counter=3; |
| 512 | timer_pulse(ATTOTIME_IN_HZ(50), 0, update_nmi); |
| 513 | beep_set_frequency(0, 44); |
| 514 | } |
| 515 | |
| 516 | |
| 517 | static MACHINE_START( dallas32 ) |
| 518 | { |
| 519 | lcd_shift_counter=3; |
| 520 | |
| 521 | timer_pulse(ATTOTIME_IN_HZ(50), 0, update_nmi32); |
| 522 | beep_set_frequency(0, 44); |
| 523 | } |
| 524 | |
| 525 | |
| 526 | static MACHINE_RESET( glasgow ) |
| 527 | { |
| 528 | lcd_shift_counter=3; |
| 529 | |
| 530 | clear_layout(); |
| 531 | set_render_board(); |
| 532 | set_status_of_pieces(); |
| 533 | } |
| 534 | |
| 535 | |
| 536 | |
| 537 | static VIDEO_START( glasgow ) |
| 538 | { |
| 539 | } |
| 540 | |
| 541 | static VIDEO_UPDATE( glasgow ) |
| 542 | { |
| 543 | // INT32 lg_x, lg_y; |
| 544 | // UINT8 p_key; |
| 545 | |
| 546 | char *piece; |
| 547 | |
| 548 | float save_x, save_y; |
| 549 | |
| 550 | my_target = render_get_ui_target(); |
| 551 | |
| 552 | // Get view item of cursor |
| 553 | // |
| 554 | // my_cursor = my_target->curview->itemlist[3]->next; |
| 555 | if (my_cursor == NULL) |
| 556 | my_cursor = get_view_item(my_target,"CURSOR_1"); |
| 557 | |
| 558 | // my_cursor = my_target->curview->itemlist[2]; |
| 559 | |
| 560 | // Mouse movement |
| 561 | // |
| 562 | if (my_cursor != NULL) |
| 563 | set_cursor (my_cursor); |
| 564 | |
| 565 | m_button1=readinputport(0x04); |
| 566 | m_button2=readinputport(0x05); |
| 567 | |
| 568 | if ( m_button1) MOUSE_BUTTON1_WAIT = 0; |
| 569 | |
| 570 | if ( m_button1 != 1 && !MOUSE_BUTTON1_WAIT ) |
| 571 | { |
| 572 | |
| 573 | MOUSE_BUTTON1_WAIT = 1; |
| 574 | |
| 575 | if (MOUSE_MOVE == 0) |
| 576 | { |
| 577 | |
| 578 | cursor_field = get_field(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0, MOUSE_MOVE); |
| 579 | if ( strcmp((char *)cursor_field.piece, "0") && (strcmp((char *)cursor_field.piece, EMP)) && strcmp(my_cursor->name, (char *)cursor_field.piece ) ) |
| 580 | { |
| 581 | update_board(my_target,cursor_field, 0); |
| 582 | |
| 583 | my_cursor->color.a = 0; |
| 584 | |
| 585 | my_cursor = get_view_item(my_target, (char *)cursor_field.piece); |
| 586 | my_cursor->color.a = 0.5; |
| 587 | |
| 588 | MOUSE_MOVE = 1; |
| 589 | |
| 590 | } |
| 591 | } // ENDIF MOUSE_MOVE |
| 592 | else |
| 593 | { |
| 594 | |
| 595 | save_x = my_cursor->rawbounds.x0; |
| 596 | save_y = my_cursor->rawbounds.y0; |
| 597 | |
| 598 | cursor_field = get_field(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0, MOUSE_MOVE); |
| 599 | if ( strcmp((char *)cursor_field.piece, "0") && strcmp(my_cursor->name, "CURSOR_1") ) |
| 600 | { |
| 601 | |
| 602 | // Put piece back to board |
| 603 | // |
| 604 | strcpy((char *)cursor_field.piece, (char *)my_cursor->name); |
| 605 | update_board(my_target,cursor_field, 1); |
| 606 | my_cursor->color.a = 1; |
| 607 | |
| 608 | // Set piece to field |
| 609 | // |
| 610 | calculate_bounds(my_cursor, (float) cursor_field.x, (float) cursor_field.y, 0 ,0 ); |
| 611 | |
| 612 | |
| 613 | // Get old cursor and set new x,y |
| 614 | // |
| 615 | my_cursor = get_view_item(my_target,"CURSOR_1"); |
| 616 | my_cursor->color.a = 1; |
| 617 | |
| 618 | calculate_bounds(my_cursor, save_x, save_y,MOUSE_X ,MOUSE_Y ); |
| 619 | |
| 620 | MOUSE_MOVE = 0; |
| 621 | |
| 622 | }//ENDIF curosr_field |
| 623 | |
| 624 | // piece is set out of board -> remove it |
| 625 | // |
| 626 | if ( out_of_board(my_cursor->rawbounds.x0,my_cursor->rawbounds.y0) ) |
| 627 | { |
| 628 | |
| 629 | save_x = my_cursor->rawbounds.x0; |
| 630 | save_y = my_cursor->rawbounds.y0; |
| 631 | |
| 632 | my_cursor->color.a = 0; |
| 633 | my_cursor = get_view_item(my_target,"CURSOR_1"); |
| 634 | my_cursor->color.a = 1; |
| 635 | calculate_bounds(my_cursor, save_x, save_y,MOUSE_X ,MOUSE_X ); |
| 636 | |
| 637 | MOUSE_MOVE = 0; |
| 638 | } |
| 639 | |
| 640 | }//ELSE MOUSE_MOVE |
| 641 | |
| 642 | } // ENDIF m_button1 |
| 643 | |
| 644 | |
| 645 | // right mouse button -> set pieces |
| 646 | // |
| 647 | if ( m_button2) MOUSE_BUTTON2_WAIT = 0; |
| 648 | if ( m_button2 != 1 && !MOUSE_BUTTON2_WAIT ) |
| 649 | { |
| 650 | |
| 651 | MOUSE_BUTTON2_WAIT = 1; |
| 652 | |
| 653 | // save cursor position |
| 654 | // |
| 655 | save_x = my_cursor->rawbounds.x0; |
| 656 | save_y = my_cursor->rawbounds.y0; |
| 657 | |
| 658 | // cursor off |
| 659 | // |
| 660 | my_cursor->color.a = 0; |
| 661 | |
| 662 | // change cursor to piece |
| 663 | // |
| 664 | piece = get_non_set_pieces(my_cursor->name); |
| 665 | |
| 666 | if (strcmp(piece,NO_PIECE)) |
| 667 | { |
| 668 | my_cursor = get_view_item(my_target,piece); |
| 669 | my_cursor->color.a = 0.5; |
| 670 | |
| 671 | calculate_bounds(my_cursor, save_x, save_y, 0 ,0 ); |
| 672 | |
| 673 | MOUSE_MOVE = 1; |
| 674 | } |
| 675 | else |
| 676 | { |
| 677 | my_cursor = get_view_item(my_target,"CURSOR_1"); |
| 678 | my_cursor->color.a = 1; |
| 679 | calculate_bounds(my_cursor, save_x, save_y, MOUSE_X ,MOUSE_X ); |
| 680 | MOUSE_MOVE = 0; |
| 681 | } |
| 682 | |
| 683 | } |
| 684 | |
| 685 | // Put Item back to render |
| 686 | // |
| 687 | render_set_ui_target (my_target); |
| 688 | |
| 689 | return 0; |
| 690 | } |
| 691 | |
| 692 | |
| 693 | static ADDRESS_MAP_START(glasgow_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 694 | AM_RANGE( 0x0000, 0xffff ) AM_ROM |
| 695 | AM_RANGE( 0x00ff0000, 0x00ff0001) AM_MIRROR ( 0xfe0000 ) AM_WRITE ( write_lcd_gg ) |
| 696 | AM_RANGE( 0x00ff0002, 0x00ff0003) AM_MIRROR ( 0xfe0002 ) AM_READWRITE ( read_keys,write_keys ) |
| 697 | AM_RANGE( 0x00ff0004, 0x00ff0005) AM_MIRROR ( 0xfe0004 ) AM_WRITE ( write_lcd_flag_gg ) |
| 698 | AM_RANGE( 0x00ff0006, 0x00ff0007) AM_MIRROR ( 0xfe0006 ) AM_READWRITE ( read_board, write_beeper ) |
| 699 | AM_RANGE( 0x00ff0008, 0x00ff0009) AM_MIRROR ( 0xfe0008 ) AM_WRITE ( write_board ) |
| 700 | AM_RANGE( 0x00ffC000, 0x00ffFFFF) AM_MIRROR ( 0xfeC000 ) AM_RAM // 16KB |
| 701 | ADDRESS_MAP_END |
| 702 | |
| 703 | |
| 704 | static ADDRESS_MAP_START(amsterd_mem, ADDRESS_SPACE_PROGRAM, 16) |
| 705 | // ADDRESS_MAP_FLAGS( AMEF_ABITS(19) ) |
| 706 | AM_RANGE( 0x0000, 0xffff ) AM_ROM |
| 707 | AM_RANGE( 0x00800002, 0x00800003) AM_WRITE( write_lcd ) |
| 708 | AM_RANGE( 0x00800008, 0x00800009) AM_WRITE( write_lcd_flag ) |
| 709 | AM_RANGE( 0x00800004, 0x00800005) AM_WRITE( write_irq_flag ) |
| 710 | AM_RANGE( 0x00800010, 0x00800011) AM_WRITE( write_board ) |
| 711 | AM_RANGE( 0x00800020, 0x00800021) AM_READ ( read_board ) |
| 712 | AM_RANGE( 0x00800040, 0x00800041) AM_READ ( read_newkeys16 ) |
| 713 | AM_RANGE( 0x00800088, 0x00800089) AM_WRITE( write_beeper ) |
| 714 | AM_RANGE( 0x00ffC000, 0x00ffFFFF) AM_RAM // 16KB |
| 715 | ADDRESS_MAP_END |
| 716 | |
| 717 | |
| 718 | static ADDRESS_MAP_START(dallas32_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 719 | //ADDRESS_MAP_FLAGS( AMEF_ABITS(17) ) |
| 720 | AM_RANGE( 0x0000, 0xffff ) AM_ROM |
| 721 | AM_RANGE( 0x00800000, 0x00800003) AM_WRITE ( write_lcd32 ) |
| 722 | AM_RANGE( 0x00800004, 0x00800007) AM_WRITE ( write_beeper32 ) |
| 723 | AM_RANGE( 0x00800008, 0x0080000B) AM_WRITE ( write_lcd_flag32 ) |
| 724 | AM_RANGE( 0x00800010, 0x00800013) AM_WRITE ( write_board32 ) |
| 725 | AM_RANGE( 0x00800020, 0x00800023) AM_READ ( read_board32 ) |
| 726 | AM_RANGE( 0x00800040, 0x00800043) AM_READ ( read_newkeys32 ) |
| 727 | AM_RANGE( 0x00800088, 0x0080008b) AM_WRITE ( write_keys32 ) |
| 728 | AM_RANGE( 0x0010000, 0x001FFFF) AM_RAM // 64KB |
| 729 | ADDRESS_MAP_END |
| 730 | |
| 731 | static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32 |
| 732 | PORT_START |
| 733 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_A ) |
| 734 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_B ) |
| 735 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_C ) |
| 736 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_D ) |
| 737 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_E ) |
| 738 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F ) |
| 739 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_1 ) |
| 740 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_2 ) |
| 741 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_3 ) |
| 742 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_4 ) |
| 743 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_5 ) |
| 744 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_6 ) |
| 745 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_9 ) |
| 746 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_0 ) |
| 747 | PORT_START |
| 748 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1 ) |
| 749 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2 ) |
| 750 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3 ) |
| 751 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4 ) |
| 752 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CLR") PORT_CODE(KEYCODE_F5 ) |
| 753 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER ) |
| 754 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_G ) |
| 755 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_H ) |
| 756 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7 ) |
| 757 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8 ) |
| 758 | INPUT_PORTS_END |
| 759 | |
| 760 | |
| 761 | |
| 762 | static INPUT_PORTS_START( old_keyboard ) //Glasgow,Dallas |
| 763 | PORT_START |
| 764 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9 ) |
| 765 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_F5 ) |
| 766 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_C ) |
| 767 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C3") PORT_CODE(KEYCODE_3 ) |
| 768 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER ) |
| 769 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_D ) |
| 770 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D4") PORT_CODE(KEYCODE_4 ) |
| 771 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_A ) |
| 772 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A1") PORT_CODE(KEYCODE_1 ) |
| 773 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F ) |
| 774 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_6 ) |
| 775 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_B ) |
| 776 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B2") PORT_CODE(KEYCODE_2 ) |
| 777 | PORT_START |
| 778 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_E ) |
| 779 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E5") PORT_CODE(KEYCODE_5 ) |
| 780 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INF") PORT_CODE(KEYCODE_F1 ) |
| 781 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0 ) |
| 782 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2 ) |
| 783 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_H ) |
| 784 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H8") PORT_CODE(KEYCODE_8 ) |
| 785 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F3) |
| 786 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_G ) |
| 787 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G7") PORT_CODE(KEYCODE_7 ) |
| 788 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F4) |
| 789 | |
| 790 | PORT_START |
| 791 | PORT_BIT( 0xffff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535) PORT_PLAYER(1) |
| 792 | |
| 793 | PORT_START |
| 794 | PORT_BIT( 0xffff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(0, 65535) PORT_PLAYER(1) |
| 795 | |
| 796 | PORT_START |
| 797 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("left button") |
| 798 | |
| 799 | PORT_START |
| 800 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("right button") |
| 801 | |
| 802 | |
| 803 | INPUT_PORTS_END |
| 804 | |
| 805 | |
| 806 | |
| 807 | static MACHINE_DRIVER_START(glasgow ) |
| 808 | /* basic machine hardware */ |
| 809 | MDRV_CPU_ADD_TAG("main", M68000, 12000000) |
| 810 | MDRV_CPU_PROGRAM_MAP(glasgow_mem, 0) |
| 811 | MDRV_MACHINE_START( glasgow ) |
| 812 | MDRV_MACHINE_RESET( glasgow ) |
| 813 | /* video hardware */ |
| 814 | MDRV_SCREEN_REFRESH_RATE(60) |
| 815 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 816 | |
| 817 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 818 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 819 | MDRV_SCREEN_SIZE(640, 480) |
| 820 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 479) |
| 821 | MDRV_PALETTE_LENGTH(4) |
| 822 | |
| 823 | MDRV_DEFAULT_LAYOUT(layout_glasgow) |
| 824 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 825 | MDRV_SOUND_ADD(BEEP, 0) |
| 826 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 827 | MDRV_VIDEO_START(glasgow) |
| 828 | MDRV_VIDEO_UPDATE(glasgow) |
| 829 | MACHINE_DRIVER_END |
| 830 | |
| 831 | |
| 832 | static MACHINE_DRIVER_START(amsterd ) |
| 833 | MDRV_IMPORT_FROM( glasgow ) |
| 834 | /* basic machine hardware */ |
| 835 | MDRV_CPU_MODIFY("main") |
| 836 | MDRV_CPU_PROGRAM_MAP(amsterd_mem, 0) |
| 837 | MACHINE_DRIVER_END |
| 838 | |
| 839 | |
| 840 | static MACHINE_DRIVER_START(dallas32 ) |
| 841 | MDRV_IMPORT_FROM( glasgow ) |
| 842 | /* basic machine hardware */ |
| 843 | MDRV_CPU_REPLACE("main", M68020, 14000000) |
| 844 | MDRV_CPU_PROGRAM_MAP(dallas32_mem, 0) |
| 845 | MDRV_MACHINE_START( dallas32 ) |
| 846 | MACHINE_DRIVER_END |
| 847 | |
| 848 | |
| 849 | /*************************************************************************** |
| 850 | ROM definitions |
| 851 | ***************************************************************************/ |
| 852 | |
| 853 | ROM_START( glasgow ) |
| 854 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 855 | //ROM_LOAD("glasgow.rom", 0x000000, 0x10000, CRC(3e73eff3) ) |
| 856 | ROM_LOAD16_BYTE("me3_3_1u.410",0x00000, 0x04000,CRC(bc8053ba) SHA1(57ea2d5652bfdd77b17d52ab1914de974bd6be12)) |
| 857 | ROM_LOAD16_BYTE("me3_1_1l.410",0x00001, 0x04000,CRC(d5263c39) SHA1(1bef1cf3fd96221eb19faecb6ec921e26ac10ac4)) |
| 858 | ROM_LOAD16_BYTE("me3_4_2u.410",0x08000, 0x04000,CRC(8dba504a) SHA1(6bfab03af835cdb6c98773164d32c76520937efe)) |
| 859 | ROM_LOAD16_BYTE("me3_2_2l.410",0x08001, 0x04000,CRC(b3f27827) SHA1(864ba897d24024592d08c4ae090aa70a2cc5f213)) |
| 860 | ROM_END |
| 861 | |
| 862 | ROM_START( amsterd ) |
| 863 | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 ) |
| 864 | //ROM_LOAD16_BYTE("output.bin", 0x000000, 0x10000, CRC(3e73eff3) ) |
| 865 | ROM_LOAD16_BYTE("amsterda-u.bin",0x00000, 0x05a00,CRC(16cefe29) SHA1(9f8c2896e92fbfd47159a59cb5e87706092c86f4)) |
| 866 | ROM_LOAD16_BYTE("amsterda-l.bin",0x00001, 0x05a00,CRC(c859dfde) SHA1(b0bca6a8e698c322a8c597608db6735129d6cdf0)) |
| 867 | ROM_END |
| 868 | |
| 869 | |
| 870 | ROM_START( dallas ) |
| 871 | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 ) |
| 872 | ROM_LOAD16_BYTE("dal_g_pr.dat",0x00000, 0x04000,CRC(66deade9) SHA1(07ec6b923f2f053172737f1fc94aec84f3ea8da1)) |
| 873 | ROM_LOAD16_BYTE("dal_g_pl.dat",0x00001, 0x04000,CRC(c5b6171c) SHA1(663167a3839ed7508ecb44fd5a1b2d3d8e466763)) |
| 874 | ROM_LOAD16_BYTE("dal_g_br.dat",0x08000, 0x04000,CRC(e24d7ec7) SHA1(a936f6fcbe9bfa49bf455f2d8a8243d1395768c1)) |
| 875 | ROM_LOAD16_BYTE("dal_g_bl.dat",0x08001, 0x04000,CRC(144a15e2) SHA1(c4fcc23d55fa5262f5e01dbd000644a7feb78f32)) |
| 876 | ROM_END |
| 877 | |
| 878 | ROM_START( dallas16 ) |
| 879 | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 ) |
| 880 | ROM_LOAD16_BYTE("dallas-u.bin",0x00000, 0x06f00,CRC(8c1462b4) SHA1(8b5f5a774a835446d08dceacac42357b9e74cfe8)) |
| 881 | ROM_LOAD16_BYTE("dallas-l.bin",0x00001, 0x06f00,CRC(f0d5bc03) SHA1(4b1b9a71663d5321820b4cf7da205e5fe5d3d001)) |
| 882 | ROM_END |
| 883 | |
| 884 | ROM_START( roma ) |
| 885 | ROM_REGION16_BE( 0x1000000, REGION_CPU1, 0 ) |
| 886 | ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd)) |
| 887 | ROM_END |
| 888 | |
| 889 | ROM_START( dallas32 ) |
| 890 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 891 | ROM_LOAD("dallas32.epr", 0x000000, 0x10000, CRC(83b9ff3f) SHA1(97bf4cb3c61f8ec328735b3c98281bba44b30a28) ) |
| 892 | ROM_END |
| 893 | |
| 894 | ROM_START( roma32 ) |
| 895 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 896 | ROM_LOAD("roma32.bin", 0x000000, 0x10000, CRC(587d03bf) SHA1(504e9ff958084700076d633f9c306fc7baf64ffd) ) |
| 897 | ROM_END |
| 898 | |
| 899 | /*************************************************************************** |
| 900 | System config |
| 901 | ***************************************************************************/ |
| 902 | |
| 903 | |
| 904 | |
| 905 | /*************************************************************************** |
| 906 | Game drivers |
| 907 | ***************************************************************************/ |
| 908 | |
| 909 | /* YEAR, NAME, PARENT, BIOS, COMPAT MACHINE,INPUT, INIT, CONFIG, COMPANY, FULLNAME, FLAGS */ |
| 910 | CONS( 1984, glasgow, 0, 0, glasgow, old_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto III S Glasgow", 0) |
| 911 | CONS( 1984, amsterd, 0, 0, amsterd, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Amsterdam", 0) |
| 912 | CONS( 1984, dallas, 0, 0, glasgow, old_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas", 0) |
| 913 | CONS( 1984, roma, 0, 0, glasgow, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Roma", 0) |
| 914 | CONS( 1984, dallas32, 0, 0, dallas32, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas 32 Bit", 0) |
| 915 | CONS( 1984, roma32, 0, 0, dallas32, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Roma 32 Bit", 0) |
| 916 | CONS( 1984, dallas16, 0, 0, amsterd, new_keyboard, NULL, NULL, "Hegener & Glaser Muenchen", "Mephisto Dallas 16 Bit", 0) |
| 917 | |
| 918 | |
| 919 | |
| 920 | static void set_cursor (view_item *view_cursor) |
| 921 | { |
| 922 | |
| 923 | static INT16 save_x, save_y; |
| 924 | static float diff_x, diff_y, del_x, del_y; |
| 925 | |
| 926 | save_x = m_x; |
| 927 | save_y = m_y; |
| 928 | |
| 929 | m_x=readinputport(0x02); |
| 930 | m_y=readinputport(0x03); |
| 931 | |
| 932 | // logerror("m_x = %d \n ",m_x); |
| 933 | // logerror("m_y = %d \n ",m_y); |
| 934 | |
| 935 | diff_x = (float) (save_x - m_x) / MOUSE_SPEED; |
| 936 | diff_y = (float) (save_y - m_y) / MOUSE_SPEED; |
| 937 | |
| 938 | del_x = view_cursor->rawbounds.x1 - view_cursor->rawbounds.x0; |
| 939 | del_y = view_cursor->rawbounds.y1 - view_cursor->rawbounds.y0; |
| 940 | |
| 941 | // Set Cursor, depending on limits |
| 942 | // |
| 943 | view_cursor->rawbounds.x0 = view_cursor->rawbounds.x0 - diff_x; |
| 944 | |
| 945 | if ( view_cursor->rawbounds.x0 > MAX_CURSOR_X ) |
| 946 | view_cursor->rawbounds.x0 = MAX_CURSOR_X; |
| 947 | |
| 948 | if ( view_cursor->rawbounds.x0 < MIN_CURSOR_X ) |
| 949 | view_cursor->rawbounds.x0 = MIN_CURSOR_X; |
| 950 | |
| 951 | view_cursor->rawbounds.y0 = view_cursor->rawbounds.y0 - diff_y; |
| 952 | |
| 953 | if ( view_cursor->rawbounds.y0 > MAX_CURSOR_Y ) |
| 954 | view_cursor->rawbounds.y0 = MAX_CURSOR_Y; |
| 955 | |
| 956 | if ( view_cursor->rawbounds.y0 < MIN_CURSOR_Y ) |
| 957 | view_cursor->rawbounds.y0 = MIN_CURSOR_Y; |
| 958 | |
| 959 | view_cursor->rawbounds.x1 = view_cursor->rawbounds.x0 + del_x; |
| 960 | view_cursor->rawbounds.y1 = view_cursor->rawbounds.y0 + del_y; |
| 961 | |
| 962 | // Calculate bounds |
| 963 | // |
| 964 | view_cursor->bounds.x0 = view_cursor->rawbounds.x0 / MAX_X; |
| 965 | view_cursor->bounds.y0 = view_cursor->rawbounds.y0 / MAX_Y; |
| 966 | view_cursor->bounds.x1 = view_cursor->rawbounds.x1 / MAX_X; |
| 967 | view_cursor->bounds.y1 = view_cursor->rawbounds.y1 / MAX_Y; |
| 968 | |
| 969 | } |
| 970 | |
| 971 | //render_target *render_target_get_indexed |
| 972 | |
| 973 | |
| 974 | view_item *get_view_item(render_target *target, const char *v_name) |
| 975 | { |
| 976 | |
| 977 | view_item *cur_view; |
| 978 | cur_view = target->curview->itemlist[3]->next; |
| 979 | |
| 980 | for (; cur_view != NULL; cur_view = cur_view->next) |
| 981 | { |
| 982 | if (!strcmp(cur_view->name, v_name)) |
| 983 | { |
| 984 | return (cur_view); |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | return (NULL); |
| 989 | } |
| 990 | |
| 991 | |
| 992 | BOARD_FIELD get_field( float i_x, float i_y, UINT8 mouse_move) |
| 993 | { |
| 994 | UINT8 i_AH, i_18; |
| 995 | float corr_x, corr_y; |
| 996 | |
| 997 | |
| 998 | float f_x, f_y; |
| 999 | |
| 1000 | BOARD_FIELD null_board = { 0,0,0,"0"}; |
| 1001 | |
| 1002 | |
| 1003 | // Correction of mouse pointer |
| 1004 | // |
| 1005 | if (!mouse_move) |
| 1006 | { |
| 1007 | corr_x = i_x+29.0; |
| 1008 | corr_y = i_y+22.0; |
| 1009 | }else |
| 1010 | { |
| 1011 | corr_x = i_x+28; |
| 1012 | corr_y = i_y+28; |
| 1013 | } |
| 1014 | |
| 1015 | // Loop über alle Spalten |
| 1016 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 1017 | { |
| 1018 | |
| 1019 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 1020 | { |
| 1021 | f_x = (float) m_board [i_18] [i_AH].x; |
| 1022 | f_y = (float) m_board [i_18] [i_AH].y; |
| 1023 | |
| 1024 | if ( ( corr_x >= f_x && corr_x <= f_x+56 ) && ( corr_y >= f_y && corr_y <= f_y+56 ) ) |
| 1025 | { |
| 1026 | return (m_board [i_18] [i_AH]); |
| 1027 | } |
| 1028 | |
| 1029 | } |
| 1030 | } |
| 1031 | |
| 1032 | return (null_board); |
| 1033 | } |
| 1034 | |
| 1035 | |
| 1036 | static unsigned int out_of_board( float x0, float y0) |
| 1037 | { |
| 1038 | |
| 1039 | if ( ( x0 >= MIN_BOARD_X && x0 <= MAX_BOARD_X ) && ( y0 >= MIN_BOARD_Y && y0 <= MAX_BOARD_Y ) ) |
| 1040 | { |
| 1041 | return (0); |
| 1042 | } |
| 1043 | else |
| 1044 | { |
| 1045 | return (1); |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | static void update_board(render_target *target, BOARD_FIELD board_field, unsigned int update_clear_flag) |
| 1052 | { |
| 1053 | |
| 1054 | UINT8 i_18, i_AH; |
| 1055 | |
| 1056 | view_item *view_item; |
| 1057 | |
| 1058 | div_t div_result; |
| 1059 | |
| 1060 | div_result = div(board_field.field, 8); |
| 1061 | |
| 1062 | i_18 = div_result.quot; |
| 1063 | i_AH = 7 - div_result.rem; |
| 1064 | |
| 1065 | if (update_clear_flag) |
| 1066 | { |
| 1067 | // there is already a piece on target field - > set it invisible |
| 1068 | // |
| 1069 | view_item = get_view_item(target, (char *)m_board[i_18][i_AH].piece); |
| 1070 | if (view_item != NULL) |
| 1071 | { |
| 1072 | view_item->color.a = 0; |
| 1073 | } |
| 1074 | strcpy ((char *)&m_board[i_18][i_AH].piece[0], (char *)&board_field.piece[0]); |
| 1075 | }else |
| 1076 | { |
| 1077 | strcpy ((char *)m_board[i_18][i_AH].piece, EMP); |
| 1078 | } |
| 1079 | |
| 1080 | set_status_of_pieces(); |
| 1081 | |
| 1082 | } |
| 1083 | |
| 1084 | static void calculate_bounds(view_item *view_item, float new_x0, float new_y0, float new_del_x, float new_del_y ) |
| 1085 | { |
| 1086 | |
| 1087 | static float del_x, del_y; |
| 1088 | |
| 1089 | if (new_del_x) |
| 1090 | { |
| 1091 | del_x = new_del_x; |
| 1092 | } |
| 1093 | else |
| 1094 | { |
| 1095 | del_x = view_item->rawbounds.x1 - view_item->rawbounds.x0; |
| 1096 | } |
| 1097 | |
| 1098 | if (new_del_y) |
| 1099 | { |
| 1100 | del_y = new_del_y; |
| 1101 | } |
| 1102 | else |
| 1103 | { |
| 1104 | del_y = view_item->rawbounds.y1 - view_item->rawbounds.y0; |
| 1105 | } |
| 1106 | |
| 1107 | view_item->rawbounds.x0 = new_x0; |
| 1108 | view_item->rawbounds.y0 = new_y0; |
| 1109 | view_item->rawbounds.x1 = view_item->rawbounds.x0 + del_x; |
| 1110 | view_item->rawbounds.y1 = view_item->rawbounds.y0 + del_y; |
| 1111 | |
| 1112 | // Calculate bounds |
| 1113 | // |
| 1114 | view_item->bounds.x0 = view_item->rawbounds.x0 / MAX_X; |
| 1115 | view_item->bounds.y0 = view_item->rawbounds.y0 / MAX_Y; |
| 1116 | view_item->bounds.x1 = view_item->rawbounds.x1 / MAX_X; |
| 1117 | view_item->bounds.y1 = view_item->rawbounds.y1 / MAX_Y; |
| 1118 | |
| 1119 | } |
| 1120 | |
| 1121 | |
| 1122 | static void set_render_board() |
| 1123 | { |
| 1124 | |
| 1125 | view_item *view_item; |
| 1126 | UINT8 i_AH, i_18; |
| 1127 | |
| 1128 | my_target = render_get_ui_target(); |
| 1129 | |
| 1130 | |
| 1131 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 1132 | { |
| 1133 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 1134 | { |
| 1135 | |
| 1136 | // copy start postition to m_board |
| 1137 | // |
| 1138 | m_board[i_18][i_AH] = start_board [i_18] [i_AH]; |
| 1139 | |
| 1140 | // Get view item of this piece |
| 1141 | // |
| 1142 | if (strcmp((char *)m_board[i_18][i_AH].piece, EMP)) |
| 1143 | { |
| 1144 | view_item = get_view_item(my_target, (char *)m_board[i_18][i_AH].piece); |
| 1145 | |
| 1146 | // change all pieces |
| 1147 | // |
| 1148 | if (view_item != NULL) |
| 1149 | { |
| 1150 | calculate_bounds(view_item, m_board[i_18][i_AH].x, m_board[i_18][i_AH].y, 0, 0 ); |
| 1151 | view_item->color.a = 1.0; |
| 1152 | }//ENDIF view_item |
| 1153 | |
| 1154 | } // ENDIF strcmp |
| 1155 | }// FOR i_18 |
| 1156 | }// FOR i_AH |
| 1157 | |
| 1158 | render_set_ui_target (my_target); |
| 1159 | |
| 1160 | } |
| 1161 | |
| 1162 | static void clear_layout() |
| 1163 | { |
| 1164 | |
| 1165 | view_item *view_item; |
| 1166 | UINT8 i; |
| 1167 | |
| 1168 | my_target = render_get_ui_target(); |
| 1169 | |
| 1170 | for ( i = 0; i < 44; i = i + 1) |
| 1171 | { |
| 1172 | view_item = get_view_item(my_target,(char *)all_pieces[i].piece); |
| 1173 | if (view_item != NULL) |
| 1174 | { |
| 1175 | view_item->color.a = 0.0; |
| 1176 | } |
| 1177 | } |
| 1178 | |
| 1179 | render_set_ui_target (my_target); |
| 1180 | |
| 1181 | } |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | static void set_status_of_pieces() |
| 1186 | { |
| 1187 | |
| 1188 | UINT8 i_AH, i_18 , i; |
| 1189 | BOARD_FIELD field; |
| 1190 | |
| 1191 | |
| 1192 | for ( i = 0; i < 47; i = i + 1) |
| 1193 | { |
| 1194 | |
| 1195 | all_pieces[i].set = 0; |
| 1196 | |
| 1197 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 1198 | { |
| 1199 | for ( i_18 = 0; i_18 < 8; i_18 = i_18 + 1) |
| 1200 | { |
| 1201 | |
| 1202 | // set status depending piece is in game or not |
| 1203 | // |
| 1204 | field = m_board[i_18][i_AH]; |
| 1205 | |
| 1206 | if (!strcmp((char *)m_board[i_18][i_AH].piece, (char *) all_pieces[i].piece)) |
| 1207 | { |
| 1208 | all_pieces[i].set = 1; |
| 1209 | break; |
| 1210 | } |
| 1211 | |
| 1212 | } // END for i_18=0 |
| 1213 | |
| 1214 | if (all_pieces[i].set) break; |
| 1215 | |
| 1216 | }// END for i_AH=0 |
| 1217 | } // END for i=0 |
| 1218 | |
| 1219 | } |
| 1220 | |
| 1221 | |
| 1222 | static char *get_non_set_pieces(const char *cur_piece) |
| 1223 | { |
| 1224 | UINT8 i=0; |
| 1225 | |
| 1226 | do |
| 1227 | { |
| 1228 | |
| 1229 | start_i = start_i+1; |
| 1230 | if ( start_i == 44) start_i = 0; |
| 1231 | |
| 1232 | |
| 1233 | if (!all_pieces[start_i].set && ( all_pieces[start_i].piece[0] != cur_piece[0] || |
| 1234 | all_pieces[start_i].piece[1] != cur_piece[1]) ) |
| 1235 | { |
| 1236 | return ((char *)&all_pieces[start_i].piece[0]); |
| 1237 | } |
| 1238 | |
| 1239 | i=i+1; |
| 1240 | } |
| 1241 | while (i != 44); |
| 1242 | |
| 1243 | return (NO_PIECE); |
| 1244 | } |
| 1245 | |
| 1246 | |
src/mess/drivers/ex800.c
| r1301 | r1302 | |
| 1 | | /******************************************************************************
|
| 2 | | Epson EX-800 Dot Matrix printer
|
| 3 | |
|
| 4 | | Written by Dirk Best, October 2007
|
| 5 | |
|
| 6 | | --
|
| 7 | |
|
| 8 | | Main CPU is a UPD7810H6 running at 12 MHz.
|
| 9 | |
|
| 10 | | --
|
| 11 | |
|
| 12 | | On startup, the ports are initialized as follows:
|
| 13 | |
|
| 14 | | Port A lines PA0-PA7 are configured as output
|
| 15 | | Port B lines PB0-PB7 are configured as output
|
| 16 | | Port C lines PC2, PC4 and PC5 are configured as output
|
| 17 | | the other lines are control lines
|
| 18 | | PC0: TxD output
|
| 19 | | PC1: RxD input
|
| 20 | | PC3: TI input
|
| 21 | | PC6: CO0 output
|
| 22 | | PC7: CO1 output
|
| 23 | | |
| 24 | | The I/O lines are connected as follows: |
| 25 | | |
| 26 | | PA0: \
|
| 27 | | PA1: Carriage motor
|
| 28 | | PA2: driving pulses
|
| 29 | | PA3: /
|
| 30 | | PA4: High when carriage assembly reaches either end
|
| 31 | | PA5: High when carriage assembly reaches either end
|
| 32 | | PA6: Bank 0
|
| 33 | | PA7: Bank 1
|
| 34 | | |
| 35 | | PB0: Line feed motor driving pulses
|
| 36 | | PB1: Line feed motor driving pulses
|
| 37 | | PB2: Line feed motor current control
|
| 38 | | PB3: LED09, Online
|
| 39 | | PB4: (used for serial port)
|
| 40 | | PB5: ERR signal
|
| 41 | | PB6: ACKNLG signal, data received at printer
|
| 42 | | PB7: LED12, Paper empty
|
| 43 | | |
| 44 | | PC0: TxD output
|
| 45 | | PC1: RxD input
|
| 46 | | PC2:
|
| 47 | | PC3: TI input
|
| 48 | | PC4:
|
| 49 | | PC5:
|
| 50 | | PC6: PWD signal of 5a
|
| 51 | | PC7: Buzzer
|
| 52 | | |
| 53 | | PD0-7: Data bus D0-D7
|
| 54 | | |
| 55 | | PF0-7: Address bus A8-A15
|
| 56 | | |
| 57 | | AN0: DSW 2
|
| 58 | | AN1: DSW 1
|
| 59 | | AN2:
|
| 60 | | AN3:
|
| 61 | | AN4: Print head operating temperature sensor
|
| 62 | | AN5: Scanner Unit, Color Home sensor
|
| 63 | | AN6:
|
| 64 | | AN7: Color Home sensor adjust
|
| 65 | | |
| 66 | | INT: Online switch |
| 67 | | |
| 68 | | |
| 69 | | Gate array 5a (parallel port, printer head)
|
| 70 | | |
| 71 | | IN0-IN7: DATA1 to DATA8 from parallel port
|
| 72 | | HD1-HD9: Head driving pulses
|
| 73 | | STROBE: STROBE signal
|
| 74 | | PWD: PC6 of CPU
|
| 75 | | ALE: ALE of CPU
|
| 76 | | |
| 77 | | Gate array 7a (inputs)
|
| 78 | | |
| 79 | | - activated when carriage assembly reaches either end?
|
| 80 | | |
| 81 | | PA0: Draft switch
|
| 82 | | PA1: NLQ Roman switch
|
| 83 | | PA2: Pica switch
|
| 84 | | PA3: NLQ sans-serif switch
|
| 85 | | PA4: Elite switch
|
| 86 | | PA5: Proportional switch
|
| 87 | | PA6: Normal switch
|
| 88 | | PA7: Condensed switch
|
| 89 | | |
| 90 | | PB0: Form feed switch
|
| 91 | | PB1: Line feed switch
|
| 92 | | PB2: Autoload switch
|
| 93 | | PB3: Low when paper empty
|
| 94 | | PB4: Low when carriage assembly is in home position
|
| 95 | | PB5: SLCTIN (connected to parallel port), disable with DSW2-1
|
| 96 | | PB6: AUTO FEEDXT (connected to parallel port), disable with DSW2-4
|
| 97 | | "When this signal is LOW, the paper is automatically fed 1 line after
|
| 98 | | printing."
|
| 99 | | PB7:
|
| 100 | | |
| 101 | | PC0: Dipswitch SW1-1 and SW1-2, Draft LED
|
| 102 | | PC1: Dipswitch SW1-3 and SW1-4, Roman LED
|
| 103 | | PC2: Dipswitch SW1-5 and SW1-6, Pica LED
|
| 104 | | PC3: Dipswitch SW1-7 and SW1-8, Sans-Serif LED
|
| 105 | | PC4: Dipswitch SW2-2 and SW2-3, Elite LED
|
| 106 | | PC5: Dipswitch SW2-5 and SW2-6, Proportional LED
|
| 107 | | PC6: Normal LED
|
| 108 | | PC7: Condensed LED
|
| 109 | | |
| 110 | | --
|
| 111 | | |
| 112 | | LED state on startup:
|
| 113 | | |
| 114 | | The power light comes on, then draft, pica and normal. If there is no paper,
|
| 115 | | the paper empty LED comes on.
|
| 116 | | |
| 117 | | Power LED is green, selectype LED is orange, paper out LED is red.
|
| 118 | | |
| 119 | | --
|
| 120 | | |
| 121 | | TODO: - The UPD7810 core is missing analog port emulation
|
| 122 | | - Figure out the gate arrays (using trojan code?)
|
| 123 | | - (much later) write an interface so that other drivers can hook
|
| 124 | | into this one and use to print
|
| 125 | | |
| 126 | | |
| 127 | | ******************************************************************************/
|
| 128 | | |
| 129 | | #include "driver.h"
|
| 130 | | #include "cpu/upd7810/upd7810.h"
|
| 131 | | #include "sound/beep.h"
|
| 132 | | |
| 133 | | #define PA0 (data & 0x01)
|
| 134 | | #define PA1 (data & 0x02)
|
| 135 | | #define PA2 (data & 0x04)
|
| 136 | | #define PA3 (data & 0x08)
|
| 137 | | #define PA4 (data & 0x10)
|
| 138 | | #define PA5 (data & 0x20)
|
| 139 | | #define PA6 (data & 0x40)
|
| 140 | | #define PA7 (data & 0x80)
|
| 141 | | |
| 142 | | #define PB0 (data & 0x01)
|
| 143 | | #define PB1 (data & 0x02)
|
| 144 | | #define PB2 (data & 0x04)
|
| 145 | | #define PB3 (data & 0x08)
|
| 146 | | #define PB4 (data & 0x10)
|
| 147 | | #define PB5 (data & 0x20)
|
| 148 | | #define PB6 (data & 0x40)
|
| 149 | | #define PB7 (data & 0x80)
|
| 150 | | |
| 151 | | #define PC0 (data & 0x01)
|
| 152 | | #define PC1 (data & 0x02)
|
| 153 | | #define PC2 (data & 0x04)
|
| 154 | | #define PC3 (data & 0x08)
|
| 155 | | #define PC4 (data & 0x10)
|
| 156 | | #define PC5 (data & 0x20)
|
| 157 | | #define PC6 (data & 0x40)
|
| 158 | | #define PC7 (data & 0x80)
|
| 159 | | |
| 160 | | |
| 161 | | /******************************************************************************
|
| 162 | | Misc (will be moved to other files)
|
| 163 | | ******************************************************************************/
|
| 164 | | |
| 165 | | |
| 166 | | /* The ON LINE switch is directly connected to the INT1 input of the CPU */
|
| 167 | | static void online_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
|
| 168 | | {
|
| 169 | | static int state = ASSERT_LINE;
|
| 170 | | |
| 171 | | if (newvalue)
|
| 172 | | {
|
| 173 | | cpunum_set_input_line(0, UPD7810_INTF1, state);
|
| 174 | | state = (state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
|
| 175 | | }
|
| 176 | | }
|
| 177 | | |
| 178 | | |
| 179 | | static void feed_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
|
| 180 | | {
|
| 181 | | |
| 182 | | }
|
| 183 | | |
| 184 | | |
| 185 | | static void selectype_switch(void *param, UINT32 oldvalue, UINT32 newvalue)
|
| 186 | | {
|
| 187 | | |
| 188 | | }
|
| 189 | | |
| 190 | | |
| 191 | | static DRIVER_INIT(ex800)
|
| 192 | | {
|
| 193 | | input_port_set_changed_callback(port_tag_to_index("ONLISW"), 0xff, online_switch, NULL);
|
| 194 | | input_port_set_changed_callback(port_tag_to_index("FEED"), 0xff, feed_switch, NULL);
|
| 195 | | input_port_set_changed_callback(port_tag_to_index("SelecType"), 0xff, selectype_switch, NULL);
|
| 196 | | }
|
| 197 | | |
| 198 | | |
| 199 | | static MACHINE_START(ex800)
|
| 200 | | {
|
| 201 | | /* Setup beep */
|
| 202 | | beep_set_state(0, 0);
|
| 203 | | beep_set_frequency(0, 4000); /* measured at 4000 hz */
|
| 204 | | }
|
| 205 | | |
| 206 | | |
| 207 | | #if 0
|
| 208 | | static VIDEO_START(ex800)
|
| 209 | | {
|
| 210 | | }
|
| 211 | | |
| 212 | | |
| 213 | | static VIDEO_UPDATE(ex800)
|
| 214 | | {
|
| 215 | | return 0;
|
| 216 | | }
|
| 217 | | #endif
|
| 218 | | |
| 219 | | |
| 220 | | static READ8_HANDLER(ex800_porta_r)
|
| 221 | | {
|
| 222 | | logerror("PA R @%x\n", activecpu_get_pc());
|
| 223 | | return mame_rand(Machine);
|
| 224 | | }
|
| 225 | | |
| 226 | | static READ8_HANDLER(ex800_portb_r)
|
| 227 | | {
|
| 228 | | logerror("PB R @%x\n", activecpu_get_pc());
|
| 229 | | return mame_rand(Machine);
|
| 230 | | }
|
| 231 | | |
| 232 | | static READ8_HANDLER(ex800_portc_r)
|
| 233 | | {
|
| 234 | | logerror("PC R @%x\n", activecpu_get_pc());
|
| 235 | | return mame_rand(Machine);
|
| 236 | | }
|
| 237 | | |
| 238 | | static WRITE8_HANDLER(ex800_porta_w)
|
| 239 | | {
|
| 240 | | if (PA6) logerror("BNK0 selected.\n");
|
| 241 | | if (PA7) logerror("BNK1 selected.\n");
|
| 242 | |
|
| 243 | | logerror("PA W %x @%x\n", data, activecpu_get_pc());
|
| 244 | | }
|
| 245 | | |
| 246 | | static WRITE8_HANDLER(ex800_portb_w)
|
| 247 | | {
|
| 248 | | if (data & 3)
|
| 249 | | logerror("PB0/1 Line feed @%x\n", activecpu_get_pc());
|
| 250 | | if (!(data & 4))
|
| 251 | | logerror("PB2 Line feed @%x\n", activecpu_get_pc());
|
| 252 | | if (data & 8)
|
| 253 | | logerror("PB3 Online LED on @%x\n", activecpu_get_pc());
|
| 254 | | else
|
| 255 | | logerror("PB3 Online LED off @%x\n", activecpu_get_pc());
|
| 256 | | if (data & 16)
|
| 257 | | logerror("PB4 Serial @%x\n", activecpu_get_pc());
|
| 258 | | if (data & 32)
|
| 259 | | logerror("PB4 Serial @%x\n", activecpu_get_pc());
|
| 260 | | if (data & 64)
|
| 261 | | logerror("PB4 Serial @%x\n", activecpu_get_pc());
|
| 262 | | if (data & 128)
|
| 263 | | logerror("PB3 Paper empty LED on @%x\n", activecpu_get_pc());
|
| 264 | | else
|
| 265 | | logerror("PB3 Paper empty LED off @%x\n", activecpu_get_pc());
|
| 266 | |
|
| 267 | | // logerror("PB W %x @%x\n", data, activecpu_get_pc());
|
| 268 | | }
|
| 269 | | |
| 270 | | static WRITE8_HANDLER(ex800_portc_w)
|
| 271 | | {
|
| 272 | | if (data & 0x80)
|
| 273 | | beep_set_state(0, 0);
|
| 274 | | else
|
| 275 | | beep_set_state(0, 1);
|
| 276 | |
|
| 277 | | logerror("PC W %x @%x\n", data, activecpu_get_pc());
|
| 278 | | }
|
| 279 | | |
| 280 | | |
| 281 | | /* Memory mapped I/O access */
|
| 282 | | |
| 283 | | static READ8_HANDLER(ex800_devsel_r)
|
| 284 | | {
|
| 285 | | logerror("DEVSEL R @%x with offset %x\n", activecpu_get_pc(), offset);
|
| 286 | | return mame_rand(Machine);
|
| 287 | | }
|
| 288 | | |
| 289 | | static WRITE8_HANDLER(ex800_devsel_w)
|
| 290 | | {
|
| 291 | | logerror("DEVSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset);
|
| 292 | | }
|
| 293 | | |
| 294 | | static READ8_HANDLER(ex800_gate5a_r)
|
| 295 | | {
|
| 296 | | logerror("GATE5A R @%x with offset %x\n", activecpu_get_pc(), offset);
|
| 297 | | return mame_rand(Machine);
|
| 298 | | }
|
| 299 | | |
| 300 | | static WRITE8_HANDLER(ex800_gate5a_w)
|
| 301 | | {
|
| 302 | | logerror("GATE5A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset);
|
| 303 | | }
|
| 304 | | |
| 305 | | static READ8_HANDLER(ex800_iosel_r)
|
| 306 | | {
|
| 307 | | logerror("IOSEL R @%x with offset %x\n", activecpu_get_pc(), offset);
|
| 308 | | return mame_rand(Machine);
|
| 309 | | }
|
| 310 | | |
| 311 | | static WRITE8_HANDLER(ex800_iosel_w)
|
| 312 | | {
|
| 313 | | logerror("IOSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset);
|
| 314 | | }
|
| 315 | | |
| 316 | | static READ8_HANDLER(ex800_gate7a_r)
|
| 317 | | {
|
| 318 | | logerror("GATE7A R @%x with offset %x\n", activecpu_get_pc(), offset);
|
| 319 | | return mame_rand(Machine);
|
| 320 | | }
|
| 321 | | |
| 322 | | static WRITE8_HANDLER(ex800_gate7a_w)
|
| 323 | | {
|
| 324 | | logerror("GATE7A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset);
|
| 325 | | }
|
| 326 | | |
| 327 | | |
| 328 | | |
| 329 | | /******************************************************************************
|
| 330 | | Address Maps
|
| 331 | | ******************************************************************************/
|
| 332 | | |
| 333 | | |
| 334 | | static ADDRESS_MAP_START( ex800_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
| 335 | | AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION(REGION_CPU1, 0)
|
| 336 | | AM_RANGE(0x8000, 0xbfff) AM_RAM /* external RAM */
|
| 337 | | AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_READWRITE(ex800_devsel_r, ex800_devsel_w)
|
| 338 | | AM_RANGE(0xe000, 0xe7ff) AM_READWRITE(ex800_gate5a_r, ex800_gate5a_w)
|
| 339 | | AM_RANGE(0xe800, 0xefff) AM_READWRITE(ex800_iosel_r, ex800_iosel_w)
|
| 340 | | AM_RANGE(0xf000, 0xf001) AM_MIRROR(0x07fc) AM_READ(ex800_gate7a_r)
|
| 341 | | AM_RANGE(0xf002, 0xf003) AM_MIRROR(0x07fc) AM_WRITE(ex800_gate7a_w)
|
| 342 | | AM_RANGE(0xf800, 0xfeff) AM_NOP /* not connected */
|
| 343 | | AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */
|
| 344 | | ADDRESS_MAP_END
|
| 345 | | |
| 346 | | |
| 347 | | static ADDRESS_MAP_START( ex800_io, ADDRESS_SPACE_IO, 8 )
|
| 348 | | AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READ(ex800_porta_r) AM_WRITE(ex800_porta_w)
|
| 349 | | AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ(ex800_portb_r) AM_WRITE(ex800_portb_w)
|
| 350 | | AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READ(ex800_portc_r) AM_WRITE(ex800_portc_w)
|
| 351 | | ADDRESS_MAP_END
|
| 352 | | |
| 353 | | |
| 354 | | |
| 355 | | /******************************************************************************
|
| 356 | | Inputs and DIP switches
|
| 357 | | ******************************************************************************/
|
| 358 | | |
| 359 | | |
| 360 | | static INPUT_PORTS_START( ex800 )
|
| 361 | | PORT_START_TAG("ONLISW")
|
| 362 | | PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED)
|
| 363 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE") PORT_CODE(KEYCODE_F9)
|
| 364 | | |
| 365 | | PORT_START_TAG("FEED")
|
| 366 | | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
|
| 367 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10)
|
| 368 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11)
|
| 369 | |
|
| 370 | | PORT_START_TAG("SelecType")
|
| 371 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft") PORT_CODE(KEYCODE_F8)
|
| 372 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman") PORT_CODE(KEYCODE_F7)
|
| 373 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pica") PORT_CODE(KEYCODE_F6)
|
| 374 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Sans Serif") PORT_CODE(KEYCODE_F5)
|
| 375 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Elite") PORT_CODE(KEYCODE_F4)
|
| 376 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional") PORT_CODE(KEYCODE_F3)
|
| 377 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal)) PORT_CODE(KEYCODE_F2)
|
| 378 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed") PORT_CODE(KEYCODE_F1)
|
| 379 | |
|
| 380 | | PORT_START_TAG("DSW_1")
|
| 381 | | PORT_DIPNAME(0x01, 0x00, "Condensed characters")
|
| 382 | | PORT_DIPSETTING( 0x00, DEF_STR(Off))
|
| 383 | | PORT_DIPSETTING( 0x01, DEF_STR(On))
|
| 384 | | PORT_DIPNAME(0x02, 0x00, "Slashed zero")
|
| 385 | | PORT_DIPSETTING( 0x00, DEF_STR(Off))
|
| 386 | | PORT_DIPSETTING( 0x02, DEF_STR(On))
|
| 387 | | PORT_DIPNAME(0x04, 0x00, "Character table")
|
| 388 | | PORT_DIPSETTING( 0x00, "Italics")
|
| 389 | | PORT_DIPSETTING( 0x04, "Graphics")
|
| 390 | | PORT_DIPNAME(0x08, 0x00, "Printer commands")
|
| 391 | | PORT_DIPSETTING( 0x00, "ESC/P")
|
| 392 | | PORT_DIPSETTING( 0x08, "IBM printer emulation")
|
| 393 | | PORT_DIPNAME(0x10, 0x00, "Print quality")
|
| 394 | | PORT_DIPSETTING( 0x00, "Draft")
|
| 395 | | PORT_DIPSETTING( 0x10, "NLQ")
|
| 396 | | PORT_DIPNAME(0xe0, 0x00, "Int. character set")
|
| 397 | | PORT_DIPSETTING( 0x00, DEF_STR(USA))
|
| 398 | | PORT_DIPSETTING( 0x20, DEF_STR(French))
|
| 399 | | PORT_DIPSETTING( 0x30, DEF_STR(German))
|
| 400 | | PORT_DIPSETTING( 0x40, "UK")
|
| 401 | | PORT_DIPSETTING( 0x50, "Danish")
|
| 402 | | PORT_DIPSETTING( 0x60, "Swedish")
|
| 403 | | PORT_DIPSETTING( 0x70, DEF_STR(Italian))
|
| 404 | | PORT_DIPSETTING( 0x80, DEF_STR(Spanish))
|
| 405 | | |
| 406 | | PORT_START_TAG("DSW_2")
|
| 407 | | PORT_DIPNAME(0x01, 0x00, "Page length")
|
| 408 | | PORT_DIPSETTING( 0x00, "11 inch")
|
| 409 | | PORT_DIPSETTING( 0x01, "12 inch")
|
| 410 | | PORT_DIPNAME(0x02, 0x00, "Auto. sheet feeder")
|
| 411 | | PORT_DIPSETTING( 0x00, "Canceled")
|
| 412 | | PORT_DIPSETTING( 0x02, "Selected")
|
| 413 | | PORT_DIPNAME(0x04, 0x00, "Skip-over-perforation")
|
| 414 | | PORT_DIPSETTING( 0x00, DEF_STR(None))
|
| 415 | | PORT_DIPSETTING( 0x04, "1 inch")
|
| 416 | | PORT_DIPNAME(0x08, 0x00, "Add LF after CR")
|
| 417 | | PORT_DIPSETTING( 0x00, "CR only")
|
| 418 | | PORT_DIPSETTING( 0x08, "CR + LF")
|
| 419 | | PORT_DIPNAME(0x30, 0x00, "Interface type")
|
| 420 | | PORT_DIPSETTING( 0x00, "Parallel")
|
| 421 | | PORT_DIPSETTING( 0x10, "Serial (odd parity)")
|
| 422 | | PORT_DIPSETTING( 0x20, "Serial (even parity)")
|
| 423 | | PORT_DIPSETTING( 0x30, "Serial (no parity)")
|
| 424 | | PORT_DIPNAME(0xc0, 0x00, "Baud rate")
|
| 425 | | PORT_DIPSETTING( 0x00, "9600")
|
| 426 | | PORT_DIPSETTING( 0x40, "4800")
|
| 427 | | PORT_DIPSETTING( 0x80, "1200")
|
| 428 | | PORT_DIPSETTING( 0xc0, "300")
|
| 429 | | INPUT_PORTS_END
|
| 430 | | |
| 431 | | |
| 432 | | |
| 433 | | /******************************************************************************
|
| 434 | | CPU config
|
| 435 | | ******************************************************************************/
|
| 436 | | |
| 437 | | |
| 438 | | static UPD7810_CONFIG ex800_cpu_config =
|
| 439 | | {
|
| 440 | | TYPE_7810,
|
| 441 | | 0
|
| 442 | | };
|
| 443 | | |
| 444 | | |
| 445 | | |
| 446 | | /******************************************************************************
|
| 447 | | Machine Drivers
|
| 448 | | ******************************************************************************/
|
| 449 | | |
| 450 | | |
| 451 | | static MACHINE_DRIVER_START(ex800)
|
| 452 | | /* basic machine hardware */
|
| 453 | | MDRV_CPU_ADD_TAG("main", UPD7810, 12000000) /* 12 Mhz? */
|
| 454 | | MDRV_CPU_CONFIG(ex800_cpu_config)
|
| 455 | | MDRV_CPU_PROGRAM_MAP(ex800_mem, 0)
|
| 456 | | MDRV_CPU_IO_MAP(ex800_io, 0)
|
| 457 | | |
| 458 | | MDRV_MACHINE_START(ex800)
|
| 459 | |
|
| 460 | | /* "video" hardware */
|
| 461 | | MDRV_SCREEN_REFRESH_RATE(60)
|
| 462 | | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
|
| 463 | | // MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
|
| 464 | | // MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
| 465 | | // MDRV_SCREEN_SIZE(480, 640)
|
| 466 | | // MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639)
|
| 467 | | // MDRV_PALETTE_LENGTH(4)
|
| 468 | | |
| 469 | | // MDRV_VIDEO_START(ex800)
|
| 470 | | // MDRV_VIDEO_UPDATE(ex800)
|
| 471 | | |
| 472 | | /* audio hardware */
|
| 473 | | MDRV_SPEAKER_STANDARD_MONO("mono")
|
| 474 | | MDRV_SOUND_ADD(BEEP, 0)
|
| 475 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
| 476 | | MACHINE_DRIVER_END
|
| 477 | | |
| 478 | | |
| 479 | | |
| 480 | | /******************************************************************************
|
| 481 | | ROM Definitions
|
| 482 | | ******************************************************************************/
|
| 483 | | |
| 484 | | |
| 485 | | ROM_START( ex800 )
|
| 486 | | ROM_REGION(0x8000, REGION_CPU1, 0)
|
| 487 | | ROM_LOAD("w8_pe9.9b", 0x0000, 0x8000, CRC(6dd41e9b) SHA1(8e30ead727b9317154742efd881206e9f9bbf95b))
|
| 488 | | ROM_END
|
| 489 | | |
| 490 | | |
| 491 | | |
| 492 | | /******************************************************************************
|
| 493 | | Drivers
|
| 494 | | ******************************************************************************/
|
| 495 | | |
| 496 | | |
| 497 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */
|
| 498 | | COMP( 1986, ex800, 0, 0, ex800, ex800, ex800, NULL, "Epson", "EX-800", GAME_NO_SOUND | GAME_NOT_WORKING)
|
| 1 | /****************************************************************************** |
| 2 | Epson EX-800 Dot Matrix printer |
| 3 | |
| 4 | Written by Dirk Best, October 2007 |
| 5 | |
| 6 | -- |
| 7 | |
| 8 | Main CPU is a UPD7810H6 running at 12 MHz. |
| 9 | |
| 10 | -- |
| 11 | |
| 12 | On startup, the ports are initialized as follows: |
| 13 | |
| 14 | Port A lines PA0-PA7 are configured as output |
| 15 | Port B lines PB0-PB7 are configured as output |
| 16 | Port C lines PC2, PC4 and PC5 are configured as output |
| 17 | the other lines are control lines |
| 18 | PC0: TxD output |
| 19 | PC1: RxD input |
| 20 | PC3: TI input |
| 21 | PC6: CO0 output |
| 22 | PC7: CO1 output |
| 23 | |
| 24 | The I/O lines are connected as follows: |
| 25 | |
| 26 | PA0: \ |
| 27 | PA1: Carriage motor |
| 28 | PA2: driving pulses |
| 29 | PA3: / |
| 30 | PA4: High when carriage assembly reaches either end |
| 31 | PA5: High when carriage assembly reaches either end |
| 32 | PA6: Bank 0 |
| 33 | PA7: Bank 1 |
| 34 | |
| 35 | PB0: Line feed motor driving pulses |
| 36 | PB1: Line feed motor driving pulses |
| 37 | PB2: Line feed motor current control |
| 38 | PB3: LED09, Online |
| 39 | PB4: (used for serial port) |
| 40 | PB5: ERR signal |
| 41 | PB6: ACKNLG signal, data received at printer |
| 42 | PB7: LED12, Paper empty |
| 43 | |
| 44 | PC0: TxD output |
| 45 | PC1: RxD input |
| 46 | PC2: |
| 47 | PC3: TI input |
| 48 | PC4: |
| 49 | PC5: |
| 50 | PC6: PWD signal of 5a |
| 51 | PC7: Buzzer |
| 52 | |
| 53 | PD0-7: Data bus D0-D7 |
| 54 | |
| 55 | PF0-7: Address bus A8-A15 |
| 56 | |
| 57 | AN0: DSW 2 |
| 58 | AN1: DSW 1 |
| 59 | AN2: |
| 60 | AN3: |
| 61 | AN4: Print head operating temperature sensor |
| 62 | AN5: Scanner Unit, Color Home sensor |
| 63 | AN6: |
| 64 | AN7: Color Home sensor adjust |
| 65 | |
| 66 | INT: Online switch |
| 67 | |
| 68 | |
| 69 | Gate array 5a (parallel port, printer head) |
| 70 | |
| 71 | IN0-IN7: DATA1 to DATA8 from parallel port |
| 72 | HD1-HD9: Head driving pulses |
| 73 | STROBE: STROBE signal |
| 74 | PWD: PC6 of CPU |
| 75 | ALE: ALE of CPU |
| 76 | |
| 77 | Gate array 7a (inputs) |
| 78 | |
| 79 | - activated when carriage assembly reaches either end? |
| 80 | |
| 81 | PA0: Draft switch |
| 82 | PA1: NLQ Roman switch |
| 83 | PA2: Pica switch |
| 84 | PA3: NLQ sans-serif switch |
| 85 | PA4: Elite switch |
| 86 | PA5: Proportional switch |
| 87 | PA6: Normal switch |
| 88 | PA7: Condensed switch |
| 89 | |
| 90 | PB0: Form feed switch |
| 91 | PB1: Line feed switch |
| 92 | PB2: Autoload switch |
| 93 | PB3: Low when paper empty |
| 94 | PB4: Low when carriage assembly is in home position |
| 95 | PB5: SLCTIN (connected to parallel port), disable with DSW2-1 |
| 96 | PB6: AUTO FEEDXT (connected to parallel port), disable with DSW2-4 |
| 97 | "When this signal is LOW, the paper is automatically fed 1 line after |
| 98 | printing." |
| 99 | PB7: |
| 100 | |
| 101 | PC0: Dipswitch SW1-1 and SW1-2, Draft LED |
| 102 | PC1: Dipswitch SW1-3 and SW1-4, Roman LED |
| 103 | PC2: Dipswitch SW1-5 and SW1-6, Pica LED |
| 104 | PC3: Dipswitch SW1-7 and SW1-8, Sans-Serif LED |
| 105 | PC4: Dipswitch SW2-2 and SW2-3, Elite LED |
| 106 | PC5: Dipswitch SW2-5 and SW2-6, Proportional LED |
| 107 | PC6: Normal LED |
| 108 | PC7: Condensed LED |
| 109 | |
| 110 | -- |
| 111 | |
| 112 | LED state on startup: |
| 113 | |
| 114 | The power light comes on, then draft, pica and normal. If there is no paper, |
| 115 | the paper empty LED comes on. |
| 116 | |
| 117 | Power LED is green, selectype LED is orange, paper out LED is red. |
| 118 | |
| 119 | -- |
| 120 | |
| 121 | TODO: - The UPD7810 core is missing analog port emulation |
| 122 | - Figure out the gate arrays (using trojan code?) |
| 123 | - (much later) write an interface so that other drivers can hook |
| 124 | into this one and use to print |
| 125 | |
| 126 | |
| 127 | ******************************************************************************/ |
| 128 | |
| 129 | #include "driver.h" |
| 130 | #include "cpu/upd7810/upd7810.h" |
| 131 | #include "sound/beep.h" |
| 132 | |
| 133 | #define PA0 (data & 0x01) |
| 134 | #define PA1 (data & 0x02) |
| 135 | #define PA2 (data & 0x04) |
| 136 | #define PA3 (data & 0x08) |
| 137 | #define PA4 (data & 0x10) |
| 138 | #define PA5 (data & 0x20) |
| 139 | #define PA6 (data & 0x40) |
| 140 | #define PA7 (data & 0x80) |
| 141 | |
| 142 | #define PB0 (data & 0x01) |
| 143 | #define PB1 (data & 0x02) |
| 144 | #define PB2 (data & 0x04) |
| 145 | #define PB3 (data & 0x08) |
| 146 | #define PB4 (data & 0x10) |
| 147 | #define PB5 (data & 0x20) |
| 148 | #define PB6 (data & 0x40) |
| 149 | #define PB7 (data & 0x80) |
| 150 | |
| 151 | #define PC0 (data & 0x01) |
| 152 | #define PC1 (data & 0x02) |
| 153 | #define PC2 (data & 0x04) |
| 154 | #define PC3 (data & 0x08) |
| 155 | #define PC4 (data & 0x10) |
| 156 | #define PC5 (data & 0x20) |
| 157 | #define PC6 (data & 0x40) |
| 158 | #define PC7 (data & 0x80) |
| 159 | |
| 160 | |
| 161 | /****************************************************************************** |
| 162 | Misc (will be moved to other files) |
| 163 | ******************************************************************************/ |
| 164 | |
| 165 | |
| 166 | /* The ON LINE switch is directly connected to the INT1 input of the CPU */ |
| 167 | static void online_switch(void *param, UINT32 oldvalue, UINT32 newvalue) |
| 168 | { |
| 169 | static int state = ASSERT_LINE; |
| 170 | |
| 171 | if (newvalue) |
| 172 | { |
| 173 | cpunum_set_input_line(0, UPD7810_INTF1, state); |
| 174 | state = (state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 179 | static void feed_switch(void *param, UINT32 oldvalue, UINT32 newvalue) |
| 180 | { |
| 181 | |
| 182 | } |
| 183 | |
| 184 | |
| 185 | static void selectype_switch(void *param, UINT32 oldvalue, UINT32 newvalue) |
| 186 | { |
| 187 | |
| 188 | } |
| 189 | |
| 190 | |
| 191 | static DRIVER_INIT(ex800) |
| 192 | { |
| 193 | input_port_set_changed_callback(port_tag_to_index("ONLISW"), 0xff, online_switch, NULL); |
| 194 | input_port_set_changed_callback(port_tag_to_index("FEED"), 0xff, feed_switch, NULL); |
| 195 | input_port_set_changed_callback(port_tag_to_index("SelecType"), 0xff, selectype_switch, NULL); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | static MACHINE_START(ex800) |
| 200 | { |
| 201 | /* Setup beep */ |
| 202 | beep_set_state(0, 0); |
| 203 | beep_set_frequency(0, 4000); /* measured at 4000 hz */ |
| 204 | } |
| 205 | |
| 206 | |
| 207 | #if 0 |
| 208 | static VIDEO_START(ex800) |
| 209 | { |
| 210 | } |
| 211 | |
| 212 | |
| 213 | static VIDEO_UPDATE(ex800) |
| 214 | { |
| 215 | return 0; |
| 216 | } |
| 217 | #endif |
| 218 | |
| 219 | |
| 220 | static READ8_HANDLER(ex800_porta_r) |
| 221 | { |
| 222 | logerror("PA R @%x\n", activecpu_get_pc()); |
| 223 | return mame_rand(Machine); |
| 224 | } |
| 225 | |
| 226 | static READ8_HANDLER(ex800_portb_r) |
| 227 | { |
| 228 | logerror("PB R @%x\n", activecpu_get_pc()); |
| 229 | return mame_rand(Machine); |
| 230 | } |
| 231 | |
| 232 | static READ8_HANDLER(ex800_portc_r) |
| 233 | { |
| 234 | logerror("PC R @%x\n", activecpu_get_pc()); |
| 235 | return mame_rand(Machine); |
| 236 | } |
| 237 | |
| 238 | static WRITE8_HANDLER(ex800_porta_w) |
| 239 | { |
| 240 | if (PA6) logerror("BNK0 selected.\n"); |
| 241 | if (PA7) logerror("BNK1 selected.\n"); |
| 242 | |
| 243 | logerror("PA W %x @%x\n", data, activecpu_get_pc()); |
| 244 | } |
| 245 | |
| 246 | static WRITE8_HANDLER(ex800_portb_w) |
| 247 | { |
| 248 | if (data & 3) |
| 249 | logerror("PB0/1 Line feed @%x\n", activecpu_get_pc()); |
| 250 | if (!(data & 4)) |
| 251 | logerror("PB2 Line feed @%x\n", activecpu_get_pc()); |
| 252 | if (data & 8) |
| 253 | logerror("PB3 Online LED on @%x\n", activecpu_get_pc()); |
| 254 | else |
| 255 | logerror("PB3 Online LED off @%x\n", activecpu_get_pc()); |
| 256 | if (data & 16) |
| 257 | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 258 | if (data & 32) |
| 259 | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 260 | if (data & 64) |
| 261 | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 262 | if (data & 128) |
| 263 | logerror("PB3 Paper empty LED on @%x\n", activecpu_get_pc()); |
| 264 | else |
| 265 | logerror("PB3 Paper empty LED off @%x\n", activecpu_get_pc()); |
| 266 | |
| 267 | // logerror("PB W %x @%x\n", data, activecpu_get_pc()); |
| 268 | } |
| 269 | |
| 270 | static WRITE8_HANDLER(ex800_portc_w) |
| 271 | { |
| 272 | if (data & 0x80) |
| 273 | beep_set_state(0, 0); |
| 274 | else |
| 275 | beep_set_state(0, 1); |
| 276 | |
| 277 | logerror("PC W %x @%x\n", data, activecpu_get_pc()); |
| 278 | } |
| 279 | |
| 280 | |
| 281 | /* Memory mapped I/O access */ |
| 282 | |
| 283 | static READ8_HANDLER(ex800_devsel_r) |
| 284 | { |
| 285 | logerror("DEVSEL R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 286 | return mame_rand(Machine); |
| 287 | } |
| 288 | |
| 289 | static WRITE8_HANDLER(ex800_devsel_w) |
| 290 | { |
| 291 | logerror("DEVSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 292 | } |
| 293 | |
| 294 | static READ8_HANDLER(ex800_gate5a_r) |
| 295 | { |
| 296 | logerror("GATE5A R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 297 | return mame_rand(Machine); |
| 298 | } |
| 299 | |
| 300 | static WRITE8_HANDLER(ex800_gate5a_w) |
| 301 | { |
| 302 | logerror("GATE5A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 303 | } |
| 304 | |
| 305 | static READ8_HANDLER(ex800_iosel_r) |
| 306 | { |
| 307 | logerror("IOSEL R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 308 | return mame_rand(Machine); |
| 309 | } |
| 310 | |
| 311 | static WRITE8_HANDLER(ex800_iosel_w) |
| 312 | { |
| 313 | logerror("IOSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 314 | } |
| 315 | |
| 316 | static READ8_HANDLER(ex800_gate7a_r) |
| 317 | { |
| 318 | logerror("GATE7A R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 319 | return mame_rand(Machine); |
| 320 | } |
| 321 | |
| 322 | static WRITE8_HANDLER(ex800_gate7a_w) |
| 323 | { |
| 324 | logerror("GATE7A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 325 | } |
| 326 | |
| 327 | |
| 328 | |
| 329 | /****************************************************************************** |
| 330 | Address Maps |
| 331 | ******************************************************************************/ |
| 332 | |
| 333 | |
| 334 | static ADDRESS_MAP_START( ex800_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 335 | AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION(REGION_CPU1, 0) |
| 336 | AM_RANGE(0x8000, 0xbfff) AM_RAM /* external RAM */ |
| 337 | AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_READWRITE(ex800_devsel_r, ex800_devsel_w) |
| 338 | AM_RANGE(0xe000, 0xe7ff) AM_READWRITE(ex800_gate5a_r, ex800_gate5a_w) |
| 339 | AM_RANGE(0xe800, 0xefff) AM_READWRITE(ex800_iosel_r, ex800_iosel_w) |
| 340 | AM_RANGE(0xf000, 0xf001) AM_MIRROR(0x07fc) AM_READ(ex800_gate7a_r) |
| 341 | AM_RANGE(0xf002, 0xf003) AM_MIRROR(0x07fc) AM_WRITE(ex800_gate7a_w) |
| 342 | AM_RANGE(0xf800, 0xfeff) AM_NOP /* not connected */ |
| 343 | AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */ |
| 344 | ADDRESS_MAP_END |
| 345 | |
| 346 | |
| 347 | static ADDRESS_MAP_START( ex800_io, ADDRESS_SPACE_IO, 8 ) |
| 348 | AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READ(ex800_porta_r) AM_WRITE(ex800_porta_w) |
| 349 | AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ(ex800_portb_r) AM_WRITE(ex800_portb_w) |
| 350 | AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READ(ex800_portc_r) AM_WRITE(ex800_portc_w) |
| 351 | ADDRESS_MAP_END |
| 352 | |
| 353 | |
| 354 | |
| 355 | /****************************************************************************** |
| 356 | Inputs and DIP switches |
| 357 | ******************************************************************************/ |
| 358 | |
| 359 | |
| 360 | static INPUT_PORTS_START( ex800 ) |
| 361 | PORT_START_TAG("ONLISW") |
| 362 | PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 363 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE") PORT_CODE(KEYCODE_F9) |
| 364 | |
| 365 | PORT_START_TAG("FEED") |
| 366 | PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED) |
| 367 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10) |
| 368 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11) |
| 369 | |
| 370 | PORT_START_TAG("SelecType") |
| 371 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft") PORT_CODE(KEYCODE_F8) |
| 372 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman") PORT_CODE(KEYCODE_F7) |
| 373 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pica") PORT_CODE(KEYCODE_F6) |
| 374 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Sans Serif") PORT_CODE(KEYCODE_F5) |
| 375 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Elite") PORT_CODE(KEYCODE_F4) |
| 376 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional") PORT_CODE(KEYCODE_F3) |
| 377 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal)) PORT_CODE(KEYCODE_F2) |
| 378 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed") PORT_CODE(KEYCODE_F1) |
| 379 | |
| 380 | PORT_START_TAG("DSW_1") |
| 381 | PORT_DIPNAME(0x01, 0x00, "Condensed characters") |
| 382 | PORT_DIPSETTING( 0x00, DEF_STR(Off)) |
| 383 | PORT_DIPSETTING( 0x01, DEF_STR(On)) |
| 384 | PORT_DIPNAME(0x02, 0x00, "Slashed zero") |
| 385 | PORT_DIPSETTING( 0x00, DEF_STR(Off)) |
| 386 | PORT_DIPSETTING( 0x02, DEF_STR(On)) |
| 387 | PORT_DIPNAME(0x04, 0x00, "Character table") |
| 388 | PORT_DIPSETTING( 0x00, "Italics") |
| 389 | PORT_DIPSETTING( 0x04, "Graphics") |
| 390 | PORT_DIPNAME(0x08, 0x00, "Printer commands") |
| 391 | PORT_DIPSETTING( 0x00, "ESC/P") |
| 392 | PORT_DIPSETTING( 0x08, "IBM printer emulation") |
| 393 | PORT_DIPNAME(0x10, 0x00, "Print quality") |
| 394 | PORT_DIPSETTING( 0x00, "Draft") |
| 395 | PORT_DIPSETTING( 0x10, "NLQ") |
| 396 | PORT_DIPNAME(0xe0, 0x00, "Int. character set") |
| 397 | PORT_DIPSETTING( 0x00, DEF_STR(USA)) |
| 398 | PORT_DIPSETTING( 0x20, DEF_STR(French)) |
| 399 | PORT_DIPSETTING( 0x30, DEF_STR(German)) |
| 400 | PORT_DIPSETTING( 0x40, "UK") |
| 401 | PORT_DIPSETTING( 0x50, "Danish") |
| 402 | PORT_DIPSETTING( 0x60, "Swedish") |
| 403 | PORT_DIPSETTING( 0x70, DEF_STR(Italian)) |
| 404 | PORT_DIPSETTING( 0x80, DEF_STR(Spanish)) |
| 405 | |
| 406 | PORT_START_TAG("DSW_2") |
| 407 | PORT_DIPNAME(0x01, 0x00, "Page length") |
| 408 | PORT_DIPSETTING( 0x00, "11 inch") |
| 409 | PORT_DIPSETTING( 0x01, "12 inch") |
| 410 | PORT_DIPNAME(0x02, 0x00, "Auto. sheet feeder") |
| 411 | PORT_DIPSETTING( 0x00, "Canceled") |
| 412 | PORT_DIPSETTING( 0x02, "Selected") |
| 413 | PORT_DIPNAME(0x04, 0x00, "Skip-over-perforation") |
| 414 | PORT_DIPSETTING( 0x00, DEF_STR(None)) |
| 415 | PORT_DIPSETTING( 0x04, "1 inch") |
| 416 | PORT_DIPNAME(0x08, 0x00, "Add LF after CR") |
| 417 | PORT_DIPSETTING( 0x00, "CR only") |
| 418 | PORT_DIPSETTING( 0x08, "CR + LF") |
| 419 | PORT_DIPNAME(0x30, 0x00, "Interface type") |
| 420 | PORT_DIPSETTING( 0x00, "Parallel") |
| 421 | PORT_DIPSETTING( 0x10, "Serial (odd parity)") |
| 422 | PORT_DIPSETTING( 0x20, "Serial (even parity)") |
| 423 | PORT_DIPSETTING( 0x30, "Serial (no parity)") |
| 424 | PORT_DIPNAME(0xc0, 0x00, "Baud rate") |
| 425 | PORT_DIPSETTING( 0x00, "9600") |
| 426 | PORT_DIPSETTING( 0x40, "4800") |
| 427 | PORT_DIPSETTING( 0x80, "1200") |
| 428 | PORT_DIPSETTING( 0xc0, "300") |
| 429 | INPUT_PORTS_END |
| 430 | |
| 431 | |
| 432 | |
| 433 | /****************************************************************************** |
| 434 | CPU config |
| 435 | ******************************************************************************/ |
| 436 | |
| 437 | |
| 438 | static UPD7810_CONFIG ex800_cpu_config = |
| 439 | { |
| 440 | TYPE_7810, |
| 441 | 0 |
| 442 | }; |
| 443 | |
| 444 | |
| 445 | |
| 446 | /****************************************************************************** |
| 447 | Machine Drivers |
| 448 | ******************************************************************************/ |
| 449 | |
| 450 | |
| 451 | static MACHINE_DRIVER_START(ex800) |
| 452 | /* basic machine hardware */ |
| 453 | MDRV_CPU_ADD_TAG("main", UPD7810, 12000000) /* 12 Mhz? */ |
| 454 | MDRV_CPU_CONFIG(ex800_cpu_config) |
| 455 | MDRV_CPU_PROGRAM_MAP(ex800_mem, 0) |
| 456 | MDRV_CPU_IO_MAP(ex800_io, 0) |
| 457 | |
| 458 | MDRV_MACHINE_START(ex800) |
| 459 | |
| 460 | /* "video" hardware */ |
| 461 | MDRV_SCREEN_REFRESH_RATE(60) |
| 462 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 463 | // MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 464 | // MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 465 | // MDRV_SCREEN_SIZE(480, 640) |
| 466 | // MDRV_SCREEN_VISIBLE_AREA(0, 479, 0, 639) |
| 467 | // MDRV_PALETTE_LENGTH(4) |
| 468 | |
| 469 | // MDRV_VIDEO_START(ex800) |
| 470 | // MDRV_VIDEO_UPDATE(ex800) |
| 471 | |
| 472 | /* audio hardware */ |
| 473 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 474 | MDRV_SOUND_ADD(BEEP, 0) |
| 475 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 476 | MACHINE_DRIVER_END |
| 477 | |
| 478 | |
| 479 | |
| 480 | /****************************************************************************** |
| 481 | ROM Definitions |
| 482 | ******************************************************************************/ |
| 483 | |
| 484 | |
| 485 | ROM_START( ex800 ) |
| 486 | ROM_REGION(0x8000, REGION_CPU1, 0) |
| 487 | ROM_LOAD("w8_pe9.9b", 0x0000, 0x8000, CRC(6dd41e9b) SHA1(8e30ead727b9317154742efd881206e9f9bbf95b)) |
| 488 | ROM_END |
| 489 | |
| 490 | |
| 491 | |
| 492 | /****************************************************************************** |
| 493 | Drivers |
| 494 | ******************************************************************************/ |
| 495 | |
| 496 | |
| 497 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 498 | COMP( 1986, ex800, 0, 0, ex800, ex800, ex800, NULL, "Epson", "EX-800", GAME_NO_SOUND | GAME_NOT_WORKING) |