src/mess/includes/pc1401.h
| r2340 | r2341 | |
| 10 | 10 | #define PC1401_H_ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | | #define KEY_OFF readinputport(0)&0x80 |
| 14 | | #define KEY_CAL readinputport(0)&0x40 |
| 15 | | #define KEY_BASIC readinputport(0)&0x20 |
| 16 | | #define KEY_BRK readinputport(0)&0x10 |
| 17 | | #define KEY_DEF readinputport(0)&8 |
| 18 | | #define KEY_DOWN readinputport(0)&4 |
| 19 | | #define KEY_UP readinputport(0)&2 |
| 20 | | #define KEY_LEFT readinputport(0)&1 |
| 13 | #define KEY_OFF input_port_read_indexed(machine, 0)&0x80 |
| 14 | #define KEY_CAL input_port_read_indexed(machine, 0)&0x40 |
| 15 | #define KEY_BASIC input_port_read_indexed(machine, 0)&0x20 |
| 16 | #define KEY_BRK input_port_read_indexed(machine, 0)&0x10 |
| 17 | #define KEY_DEF input_port_read_indexed(machine, 0)&8 |
| 18 | #define KEY_DOWN input_port_read_indexed(machine, 0)&4 |
| 19 | #define KEY_UP input_port_read_indexed(machine, 0)&2 |
| 20 | #define KEY_LEFT input_port_read_indexed(machine, 0)&1 |
| 21 | 21 | |
| 22 | | #define KEY_RIGHT readinputport(1)&0x80 |
| 22 | #define KEY_RIGHT input_port_read_indexed(machine, 1)&0x80 |
| 23 | 23 | // pc1403 sml |
| 24 | | #define KEY_SHIFT readinputport(1)&0x20 |
| 25 | | #define KEY_Q readinputport(1)&0x10 |
| 26 | | #define KEY_W readinputport(1)&8 |
| 27 | | #define KEY_E readinputport(1)&4 |
| 28 | | #define KEY_R readinputport(1)&2 |
| 29 | | #define KEY_T readinputport(1)&1 |
| 24 | #define KEY_SHIFT input_port_read_indexed(machine, 1)&0x20 |
| 25 | #define KEY_Q input_port_read_indexed(machine, 1)&0x10 |
| 26 | #define KEY_W input_port_read_indexed(machine, 1)&8 |
| 27 | #define KEY_E input_port_read_indexed(machine, 1)&4 |
| 28 | #define KEY_R input_port_read_indexed(machine, 1)&2 |
| 29 | #define KEY_T input_port_read_indexed(machine, 1)&1 |
| 30 | 30 | |
| 31 | | #define KEY_Y readinputport(2)&0x80 |
| 32 | | #define KEY_U readinputport(2)&0x40 |
| 33 | | #define KEY_I readinputport(2)&0x20 |
| 34 | | #define KEY_O readinputport(2)&0x10 |
| 35 | | #define KEY_P readinputport(2)&8 |
| 36 | | #define KEY_A readinputport(2)&4 |
| 37 | | #define KEY_S readinputport(2)&2 |
| 38 | | #define KEY_D readinputport(2)&1 |
| 31 | #define KEY_Y input_port_read_indexed(machine, 2)&0x80 |
| 32 | #define KEY_U input_port_read_indexed(machine, 2)&0x40 |
| 33 | #define KEY_I input_port_read_indexed(machine, 2)&0x20 |
| 34 | #define KEY_O input_port_read_indexed(machine, 2)&0x10 |
| 35 | #define KEY_P input_port_read_indexed(machine, 2)&8 |
| 36 | #define KEY_A input_port_read_indexed(machine, 2)&4 |
| 37 | #define KEY_S input_port_read_indexed(machine, 2)&2 |
| 38 | #define KEY_D input_port_read_indexed(machine, 2)&1 |
| 39 | 39 | |
| 40 | | #define KEY_F readinputport(3)&0x80 |
| 41 | | #define KEY_G readinputport(3)&0x40 |
| 42 | | #define KEY_H readinputport(3)&0x20 |
| 43 | | #define KEY_J readinputport(3)&0x10 |
| 44 | | #define KEY_K readinputport(3)&8 |
| 45 | | #define KEY_L readinputport(3)&4 |
| 46 | | #define KEY_COMMA readinputport(3)&2 |
| 47 | | #define KEY_Z readinputport(3)&1 |
| 40 | #define KEY_F input_port_read_indexed(machine, 3)&0x80 |
| 41 | #define KEY_G input_port_read_indexed(machine, 3)&0x40 |
| 42 | #define KEY_H input_port_read_indexed(machine, 3)&0x20 |
| 43 | #define KEY_J input_port_read_indexed(machine, 3)&0x10 |
| 44 | #define KEY_K input_port_read_indexed(machine, 3)&8 |
| 45 | #define KEY_L input_port_read_indexed(machine, 3)&4 |
| 46 | #define KEY_COMMA input_port_read_indexed(machine, 3)&2 |
| 47 | #define KEY_Z input_port_read_indexed(machine, 3)&1 |
| 48 | 48 | |
| 49 | | #define KEY_X readinputport(4)&0x80 |
| 50 | | #define KEY_C readinputport(4)&0x40 |
| 51 | | #define KEY_V readinputport(4)&0x20 |
| 52 | | #define KEY_B readinputport(4)&0x10 |
| 53 | | #define KEY_N readinputport(4)&8 |
| 54 | | #define KEY_M readinputport(4)&4 |
| 55 | | #define KEY_SPC readinputport(4)&2 |
| 56 | | #define KEY_ENTER readinputport(4)&1 |
| 49 | #define KEY_X input_port_read_indexed(machine, 4)&0x80 |
| 50 | #define KEY_C input_port_read_indexed(machine, 4)&0x40 |
| 51 | #define KEY_V input_port_read_indexed(machine, 4)&0x20 |
| 52 | #define KEY_B input_port_read_indexed(machine, 4)&0x10 |
| 53 | #define KEY_N input_port_read_indexed(machine, 4)&8 |
| 54 | #define KEY_M input_port_read_indexed(machine, 4)&4 |
| 55 | #define KEY_SPC input_port_read_indexed(machine, 4)&2 |
| 56 | #define KEY_ENTER input_port_read_indexed(machine, 4)&1 |
| 57 | 57 | |
| 58 | | #define KEY_HYP readinputport(5)&0x80 |
| 59 | | #define KEY_SIN readinputport(5)&0x40 |
| 60 | | #define KEY_COS readinputport(5)&0x20 |
| 61 | | #define KEY_TAN readinputport(5)&0x10 |
| 62 | | #define KEY_FE readinputport(5)&8 |
| 63 | | #define KEY_CCE readinputport(5)&4 |
| 64 | | #define KEY_HEX readinputport(5)&2 |
| 65 | | #define KEY_DEG readinputport(5)&1 |
| 58 | #define KEY_HYP input_port_read_indexed(machine, 5)&0x80 |
| 59 | #define KEY_SIN input_port_read_indexed(machine, 5)&0x40 |
| 60 | #define KEY_COS input_port_read_indexed(machine, 5)&0x20 |
| 61 | #define KEY_TAN input_port_read_indexed(machine, 5)&0x10 |
| 62 | #define KEY_FE input_port_read_indexed(machine, 5)&8 |
| 63 | #define KEY_CCE input_port_read_indexed(machine, 5)&4 |
| 64 | #define KEY_HEX input_port_read_indexed(machine, 5)&2 |
| 65 | #define KEY_DEG input_port_read_indexed(machine, 5)&1 |
| 66 | 66 | |
| 67 | | #define KEY_LN readinputport(6)&0x80 |
| 68 | | #define KEY_LOG readinputport(6)&0x40 |
| 69 | | #define KEY_1X readinputport(6)&0x20 |
| 70 | | #define KEY_STAT readinputport(6)&0x10 |
| 71 | | #define KEY_EXP readinputport(6)&8 |
| 72 | | #define KEY_POT readinputport(6)&4 |
| 73 | | #define KEY_ROOT readinputport(6)&2 |
| 74 | | #define KEY_SQUARE readinputport(6)&1 |
| 67 | #define KEY_LN input_port_read_indexed(machine, 6)&0x80 |
| 68 | #define KEY_LOG input_port_read_indexed(machine, 6)&0x40 |
| 69 | #define KEY_1X input_port_read_indexed(machine, 6)&0x20 |
| 70 | #define KEY_STAT input_port_read_indexed(machine, 6)&0x10 |
| 71 | #define KEY_EXP input_port_read_indexed(machine, 6)&8 |
| 72 | #define KEY_POT input_port_read_indexed(machine, 6)&4 |
| 73 | #define KEY_ROOT input_port_read_indexed(machine, 6)&2 |
| 74 | #define KEY_SQUARE input_port_read_indexed(machine, 6)&1 |
| 75 | 75 | |
| 76 | | #define KEY_BRACE_LEFT readinputport(7)&0x80 |
| 77 | | #define KEY_BRACE_RIGHT readinputport(7)&0x40 |
| 78 | | #define KEY_7 readinputport(7)&0x20 |
| 79 | | #define KEY_8 readinputport(7)&0x10 |
| 80 | | #define KEY_9 readinputport(7)&8 |
| 81 | | #define KEY_DIV readinputport(7)&4 |
| 82 | | #define KEY_XM readinputport(7)&2 |
| 83 | | #define KEY_4 readinputport(7)&1 |
| 76 | #define KEY_BRACE_LEFT input_port_read_indexed(machine, 7)&0x80 |
| 77 | #define KEY_BRACE_RIGHT input_port_read_indexed(machine, 7)&0x40 |
| 78 | #define KEY_7 input_port_read_indexed(machine, 7)&0x20 |
| 79 | #define KEY_8 input_port_read_indexed(machine, 7)&0x10 |
| 80 | #define KEY_9 input_port_read_indexed(machine, 7)&8 |
| 81 | #define KEY_DIV input_port_read_indexed(machine, 7)&4 |
| 82 | #define KEY_XM input_port_read_indexed(machine, 7)&2 |
| 83 | #define KEY_4 input_port_read_indexed(machine, 7)&1 |
| 84 | 84 | |
| 85 | | #define KEY_5 readinputport(8)&0x80 |
| 86 | | #define KEY_6 readinputport(8)&0x40 |
| 87 | | #define KEY_MUL readinputport(8)&0x20 |
| 88 | | #define KEY_RM readinputport(8)&0x10 |
| 89 | | #define KEY_1 readinputport(8)&8 |
| 90 | | #define KEY_2 readinputport(8)&4 |
| 91 | | #define KEY_3 readinputport(8)&2 |
| 92 | | #define KEY_MINUS readinputport(8)&1 |
| 85 | #define KEY_5 input_port_read_indexed(machine, 8)&0x80 |
| 86 | #define KEY_6 input_port_read_indexed(machine, 8)&0x40 |
| 87 | #define KEY_MUL input_port_read_indexed(machine, 8)&0x20 |
| 88 | #define KEY_RM input_port_read_indexed(machine, 8)&0x10 |
| 89 | #define KEY_1 input_port_read_indexed(machine, 8)&8 |
| 90 | #define KEY_2 input_port_read_indexed(machine, 8)&4 |
| 91 | #define KEY_3 input_port_read_indexed(machine, 8)&2 |
| 92 | #define KEY_MINUS input_port_read_indexed(machine, 8)&1 |
| 93 | 93 | |
| 94 | | #define KEY_MPLUS readinputport(9)&0x80 |
| 95 | | #define KEY_0 readinputport(9)&0x40 |
| 96 | | #define KEY_SIGN readinputport(9)&0x20 |
| 97 | | #define KEY_POINT readinputport(9)&0x10 |
| 98 | | #define KEY_PLUS readinputport(9)&8 |
| 99 | | #define KEY_EQUALS readinputport(9)&4 |
| 100 | | #define KEY_RESET readinputport(9)&2 |
| 94 | #define KEY_MPLUS input_port_read_indexed(machine, 9)&0x80 |
| 95 | #define KEY_0 input_port_read_indexed(machine, 9)&0x40 |
| 96 | #define KEY_SIGN input_port_read_indexed(machine, 9)&0x20 |
| 97 | #define KEY_POINT input_port_read_indexed(machine, 9)&0x10 |
| 98 | #define KEY_PLUS input_port_read_indexed(machine, 9)&8 |
| 99 | #define KEY_EQUALS input_port_read_indexed(machine, 9)&4 |
| 100 | #define KEY_RESET input_port_read_indexed(machine, 9)&2 |
| 101 | 101 | |
| 102 | | #define RAM4K (readinputport(10)&0xc0)==0x40 |
| 103 | | #define RAM10K (readinputport(10)&0xc0)==0x80 |
| 104 | | #define CONTRAST (readinputport(10)&7) |
| 102 | #define RAM4K (input_port_read_indexed(machine, 10)&0xc0)==0x40 |
| 103 | #define RAM10K (input_port_read_indexed(machine, 10)&0xc0)==0x80 |
| 104 | #define CONTRAST (input_port_read_indexed(machine, 10)&7) |
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | /*----------- defined in machine/pc1401.c -----------*/ |
src/mess/includes/hp48.h
| r2340 | r2341 | |
| 8 | 8 | #define HP48_H_ |
| 9 | 9 | |
| 10 | 10 | |
| 11 | | #define KEY_A readinputport(0)&0x80 |
| 12 | | #define KEY_B readinputport(0)&0x40 |
| 13 | | #define KEY_C readinputport(0)&0x20 |
| 14 | | #define KEY_D readinputport(0)&0x10 |
| 15 | | #define KEY_E readinputport(0)&8 |
| 16 | | #define KEY_F readinputport(0)&4 |
| 17 | | #define KEY_G readinputport(0)&2 |
| 18 | | #define KEY_H readinputport(0)&1 |
| 19 | | #define KEY_I readinputport(1)&0x80 |
| 20 | | #define KEY_J readinputport(1)&0x40 |
| 21 | | #define KEY_K readinputport(1)&0x20 |
| 22 | | #define KEY_L readinputport(1)&0x10 |
| 23 | | #define KEY_M readinputport(1)&8 |
| 24 | | #define KEY_N readinputport(1)&4 |
| 25 | | #define KEY_O readinputport(1)&2 |
| 26 | | #define KEY_P readinputport(1)&1 |
| 27 | | #define KEY_Q readinputport(2)&0x80 |
| 28 | | #define KEY_R readinputport(2)&0x40 |
| 29 | | #define KEY_S readinputport(2)&0x20 |
| 30 | | #define KEY_T readinputport(2)&0x10 |
| 31 | | #define KEY_U readinputport(2)&8 |
| 32 | | #define KEY_V readinputport(2)&4 |
| 33 | | #define KEY_W readinputport(2)&2 |
| 34 | | #define KEY_X readinputport(2)&1 |
| 35 | | #define KEY_ENTER readinputport(3)&0x80 |
| 36 | | #define KEY_Y readinputport(3)&0x40 |
| 37 | | #define KEY_Z readinputport(3)&0x20 |
| 38 | | #define KEY_DEL readinputport(3)&0x10 |
| 39 | | #define KEY_LEFT readinputport(3)&8 |
| 40 | | #define KEY_ALPHA readinputport(3)&4 |
| 41 | | #define KEY_7 readinputport(3)&2 |
| 42 | | #define KEY_8 readinputport(3)&1 |
| 43 | | #define KEY_9 readinputport(4)&0x80 |
| 44 | | #define KEY_DIVIDE readinputport(4)&0x40 |
| 45 | | #define KEY_ORANGE readinputport(4)&0x20 |
| 46 | | #define KEY_4 readinputport(4)&0x10 |
| 47 | | #define KEY_5 readinputport(4)&8 |
| 48 | | #define KEY_6 readinputport(4)&4 |
| 49 | | #define KEY_MULTIPLY readinputport(4)&2 |
| 50 | | #define KEY_BLUE readinputport(4)&1 |
| 51 | | #define KEY_1 readinputport(5)&0x80 |
| 52 | | #define KEY_2 readinputport(5)&0x40 |
| 53 | | #define KEY_3 readinputport(5)&0x20 |
| 54 | | #define KEY_MINUS readinputport(5)&0x10 |
| 55 | | #define KEY_ON readinputport(5)&8 |
| 56 | | #define KEY_0 readinputport(5)&4 |
| 57 | | #define KEY_POINT readinputport(5)&2 |
| 58 | | #define KEY_SPC readinputport(5)&1 |
| 59 | | #define KEY_PLUS readinputport(6)&0x80 |
| 11 | #define KEY_A input_port_read_indexed(Machine, 0)&0x80 |
| 12 | #define KEY_B input_port_read_indexed(Machine, 0)&0x40 |
| 13 | #define KEY_C input_port_read_indexed(Machine, 0)&0x20 |
| 14 | #define KEY_D input_port_read_indexed(Machine, 0)&0x10 |
| 15 | #define KEY_E input_port_read_indexed(Machine, 0)&8 |
| 16 | #define KEY_F input_port_read_indexed(Machine, 0)&4 |
| 17 | #define KEY_G input_port_read_indexed(Machine, 0)&2 |
| 18 | #define KEY_H input_port_read_indexed(Machine, 0)&1 |
| 19 | #define KEY_I input_port_read_indexed(Machine, 1)&0x80 |
| 20 | #define KEY_J input_port_read_indexed(Machine, 1)&0x40 |
| 21 | #define KEY_K input_port_read_indexed(Machine, 1)&0x20 |
| 22 | #define KEY_L input_port_read_indexed(Machine, 1)&0x10 |
| 23 | #define KEY_M input_port_read_indexed(Machine, 1)&8 |
| 24 | #define KEY_N input_port_read_indexed(Machine, 1)&4 |
| 25 | #define KEY_O input_port_read_indexed(Machine, 1)&2 |
| 26 | #define KEY_P input_port_read_indexed(Machine, 1)&1 |
| 27 | #define KEY_Q input_port_read_indexed(Machine, 2)&0x80 |
| 28 | #define KEY_R input_port_read_indexed(Machine, 2)&0x40 |
| 29 | #define KEY_S input_port_read_indexed(Machine, 2)&0x20 |
| 30 | #define KEY_T input_port_read_indexed(Machine, 2)&0x10 |
| 31 | #define KEY_U input_port_read_indexed(Machine, 2)&8 |
| 32 | #define KEY_V input_port_read_indexed(Machine, 2)&4 |
| 33 | #define KEY_W input_port_read_indexed(Machine, 2)&2 |
| 34 | #define KEY_X input_port_read_indexed(Machine, 2)&1 |
| 35 | #define KEY_ENTER input_port_read_indexed(Machine, 3)&0x80 |
| 36 | #define KEY_Y input_port_read_indexed(Machine, 3)&0x40 |
| 37 | #define KEY_Z input_port_read_indexed(Machine, 3)&0x20 |
| 38 | #define KEY_DEL input_port_read_indexed(Machine, 3)&0x10 |
| 39 | #define KEY_LEFT input_port_read_indexed(Machine, 3)&8 |
| 40 | #define KEY_ALPHA input_port_read_indexed(Machine, 3)&4 |
| 41 | #define KEY_7 input_port_read_indexed(Machine, 3)&2 |
| 42 | #define KEY_8 input_port_read_indexed(Machine, 3)&1 |
| 43 | #define KEY_9 input_port_read_indexed(Machine, 4)&0x80 |
| 44 | #define KEY_DIVIDE input_port_read_indexed(Machine, 4)&0x40 |
| 45 | #define KEY_ORANGE input_port_read_indexed(Machine, 4)&0x20 |
| 46 | #define KEY_4 input_port_read_indexed(Machine, 4)&0x10 |
| 47 | #define KEY_5 input_port_read_indexed(Machine, 4)&8 |
| 48 | #define KEY_6 input_port_read_indexed(Machine, 4)&4 |
| 49 | #define KEY_MULTIPLY input_port_read_indexed(Machine, 4)&2 |
| 50 | #define KEY_BLUE input_port_read_indexed(Machine, 4)&1 |
| 51 | #define KEY_1 input_port_read_indexed(Machine, 5)&0x80 |
| 52 | #define KEY_2 input_port_read_indexed(Machine, 5)&0x40 |
| 53 | #define KEY_3 input_port_read_indexed(Machine, 5)&0x20 |
| 54 | #define KEY_MINUS input_port_read_indexed(Machine, 5)&0x10 |
| 55 | #define KEY_ON input_port_read_indexed(Machine, 5)&8 |
| 56 | #define KEY_0 input_port_read_indexed(Machine, 5)&4 |
| 57 | #define KEY_POINT input_port_read_indexed(Machine, 5)&2 |
| 58 | #define KEY_SPC input_port_read_indexed(Machine, 5)&1 |
| 59 | #define KEY_PLUS input_port_read_indexed(Machine, 6)&0x80 |
| 60 | 60 | |
| 61 | 61 | |
| 62 | | /*----------- defined in machine/hp48.c -----------*/ |
| 62 | /*----------- defined in Machine/hp48.c -----------*/ |
| 63 | 63 | |
| 64 | 64 | typedef struct { |
| 65 | 65 | int data[0x40]; |
src/mess/includes/cbmb.h
| r2340 | r2341 | |
| 77 | 77 | #define JOYSTICK2 ((input_port_20_word_r(0,0)&0xe00)==0x200) |
| 78 | 78 | #define JOYSTICK_SWAP (input_port_20_word_r(0,0)&0x100) |
| 79 | 79 | |
| 80 | | #define PADDLE1_BUTTON ((readinputport(14)&0x100)) |
| 81 | | #define PADDLE1_VALUE (readinputport(14)&0xff) |
| 80 | #define PADDLE1_BUTTON ((input_port_read_indexed(machine, 14)&0x100)) |
| 81 | #define PADDLE1_VALUE (input_port_read_indexed(machine, 14)&0xff) |
| 82 | 82 | #define PADDLE2_BUTTON ((input_port_15_word_r(0,0)&0x100)) |
| 83 | 83 | #define PADDLE2_VALUE (input_port_15_word_r(0,0)&0xff) |
| 84 | 84 | #define PADDLE3_BUTTON ((input_port_16_word_r(0,0)&0x100)) |
| r2340 | r2341 | |
| 86 | 86 | #define PADDLE4_BUTTON ((input_port_17_word_r(0,0)&0x100)) |
| 87 | 87 | #define PADDLE4_VALUE (input_port_17_word_r(0,0)&0xff) |
| 88 | 88 | |
| 89 | | #define LIGHTPEN_BUTTON (LIGHTPEN&&(readinputport(18)&0x8000)) |
| 90 | | #define LIGHTPEN_X_VALUE ((readinputport(18)&0x3ff)&~1) /* effectiv resolution */ |
| 91 | | #define LIGHTPEN_Y_VALUE (readinputport(19)&~1) /* effectiv resolution */ |
| 89 | #define LIGHTPEN_BUTTON (LIGHTPEN&&(input_port_read_indexed(machine, 18)&0x8000)) |
| 90 | #define LIGHTPEN_X_VALUE ((input_port_read_indexed(machine, 18)&0x3ff)&~1) /* effectiv resolution */ |
| 91 | #define LIGHTPEN_Y_VALUE (input_port_read_indexed(machine, 19)&~1) /* effectiv resolution */ |
| 92 | 92 | |
| 93 | | #define JOYSTICK_1_LEFT ((readinputport(13)&0x8000)) |
| 94 | | #define JOYSTICK_1_RIGHT ((readinputport(13)&0x4000)) |
| 95 | | #define JOYSTICK_1_UP ((readinputport(13)&0x2000)) |
| 96 | | #define JOYSTICK_1_DOWN ((readinputport(13)&0x1000)) |
| 97 | | #define JOYSTICK_1_BUTTON ((readinputport(13)&0x800)) |
| 98 | | #define JOYSTICK_1_BUTTON2 ((readinputport(13)&0x400)) |
| 99 | | #define JOYSTICK_2_LEFT ((readinputport(13)&0x80)) |
| 100 | | #define JOYSTICK_2_RIGHT ((readinputport(13)&0x40)) |
| 101 | | #define JOYSTICK_2_UP ((readinputport(13)&0x20)) |
| 102 | | #define JOYSTICK_2_DOWN ((readinputport(13)&0x10)) |
| 103 | | #define JOYSTICK_2_BUTTON ((readinputport(13)&8)) |
| 104 | | #define JOYSTICK_2_BUTTON2 ((readinputport(13)&4)) |
| 93 | #define JOYSTICK_1_LEFT ((input_port_read_indexed(machine, 13)&0x8000)) |
| 94 | #define JOYSTICK_1_RIGHT ((input_port_read_indexed(machine, 13)&0x4000)) |
| 95 | #define JOYSTICK_1_UP ((input_port_read_indexed(machine, 13)&0x2000)) |
| 96 | #define JOYSTICK_1_DOWN ((input_port_read_indexed(machine, 13)&0x1000)) |
| 97 | #define JOYSTICK_1_BUTTON ((input_port_read_indexed(machine, 13)&0x800)) |
| 98 | #define JOYSTICK_1_BUTTON2 ((input_port_read_indexed(machine, 13)&0x400)) |
| 99 | #define JOYSTICK_2_LEFT ((input_port_read_indexed(machine, 13)&0x80)) |
| 100 | #define JOYSTICK_2_RIGHT ((input_port_read_indexed(machine, 13)&0x40)) |
| 101 | #define JOYSTICK_2_UP ((input_port_read_indexed(machine, 13)&0x20)) |
| 102 | #define JOYSTICK_2_DOWN ((input_port_read_indexed(machine, 13)&0x10)) |
| 103 | #define JOYSTICK_2_BUTTON ((input_port_read_indexed(machine, 13)&8)) |
| 104 | #define JOYSTICK_2_BUTTON2 ((input_port_read_indexed(machine, 13)&4)) |
| 105 | 105 | |
| 106 | 106 | #define IEEE8ON 0 |
| 107 | 107 | #define IEEE9ON 0 |
src/mess/includes/pc1350.h
| r2340 | r2341 | |
| 10 | 10 | #define PC1350_H_ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | | #define PC1350_KEY_OFF readinputport(0)&0x80 |
| 14 | | #define PC1350_KEY_DOWN readinputport(0)&0x40 |
| 15 | | #define PC1350_KEY_UP readinputport(0)&0x20 |
| 16 | | #define PC1350_KEY_MODE readinputport(0)&0x10 |
| 17 | | #define PC1350_KEY_CLS readinputport(0)&8 |
| 18 | | #define PC1350_KEY_LEFT readinputport(0)&4 |
| 19 | | #define PC1350_KEY_RIGHT readinputport(0)&2 |
| 20 | | #define PC1350_KEY_DEL readinputport(0)&1 |
| 13 | #define PC1350_KEY_OFF input_port_read_indexed(machine, 0)&0x80 |
| 14 | #define PC1350_KEY_DOWN input_port_read_indexed(machine, 0)&0x40 |
| 15 | #define PC1350_KEY_UP input_port_read_indexed(machine, 0)&0x20 |
| 16 | #define PC1350_KEY_MODE input_port_read_indexed(machine, 0)&0x10 |
| 17 | #define PC1350_KEY_CLS input_port_read_indexed(machine, 0)&8 |
| 18 | #define PC1350_KEY_LEFT input_port_read_indexed(machine, 0)&4 |
| 19 | #define PC1350_KEY_RIGHT input_port_read_indexed(machine, 0)&2 |
| 20 | #define PC1350_KEY_DEL input_port_read_indexed(machine, 0)&1 |
| 21 | 21 | |
| 22 | | #define PC1350_KEY_INS readinputport(1)&0x80 |
| 23 | | #define PC1350_KEY_BRK readinputport(1)&0x40 |
| 24 | | #define PC1350_KEY_RSHIFT readinputport(1)&0x20 |
| 25 | | #define PC1350_KEY_7 readinputport(1)&0x10 |
| 26 | | #define PC1350_KEY_8 readinputport(1)&8 |
| 27 | | #define PC1350_KEY_9 readinputport(1)&4 |
| 28 | | #define PC1350_KEY_BRACE_OPEN readinputport(1)&2 |
| 29 | | #define PC1350_KEY_BRACE_CLOSE readinputport(1)&1 |
| 22 | #define PC1350_KEY_INS input_port_read_indexed(machine, 1)&0x80 |
| 23 | #define PC1350_KEY_BRK input_port_read_indexed(machine, 1)&0x40 |
| 24 | #define PC1350_KEY_RSHIFT input_port_read_indexed(machine, 1)&0x20 |
| 25 | #define PC1350_KEY_7 input_port_read_indexed(machine, 1)&0x10 |
| 26 | #define PC1350_KEY_8 input_port_read_indexed(machine, 1)&8 |
| 27 | #define PC1350_KEY_9 input_port_read_indexed(machine, 1)&4 |
| 28 | #define PC1350_KEY_BRACE_OPEN input_port_read_indexed(machine, 1)&2 |
| 29 | #define PC1350_KEY_BRACE_CLOSE input_port_read_indexed(machine, 1)&1 |
| 30 | 30 | |
| 31 | | #define PC1350_KEY_4 readinputport(2)&0x80 |
| 32 | | #define PC1350_KEY_5 readinputport(2)&0x40 |
| 33 | | #define PC1350_KEY_6 readinputport(2)&0x20 |
| 34 | | #define PC1350_KEY_SLASH readinputport(2)&0x10 |
| 35 | | #define PC1350_KEY_COLON readinputport(2)&8 |
| 36 | | #define PC1350_KEY_1 readinputport(2)&4 |
| 37 | | #define PC1350_KEY_2 readinputport(2)&2 |
| 38 | | #define PC1350_KEY_3 readinputport(2)&1 |
| 31 | #define PC1350_KEY_4 input_port_read_indexed(machine, 2)&0x80 |
| 32 | #define PC1350_KEY_5 input_port_read_indexed(machine, 2)&0x40 |
| 33 | #define PC1350_KEY_6 input_port_read_indexed(machine, 2)&0x20 |
| 34 | #define PC1350_KEY_SLASH input_port_read_indexed(machine, 2)&0x10 |
| 35 | #define PC1350_KEY_COLON input_port_read_indexed(machine, 2)&8 |
| 36 | #define PC1350_KEY_1 input_port_read_indexed(machine, 2)&4 |
| 37 | #define PC1350_KEY_2 input_port_read_indexed(machine, 2)&2 |
| 38 | #define PC1350_KEY_3 input_port_read_indexed(machine, 2)&1 |
| 39 | 39 | |
| 40 | | #define PC1350_KEY_ASTERIX readinputport(3)&0x80 |
| 41 | | #define PC1350_KEY_SEMICOLON readinputport(3)&0x40 |
| 42 | | #define PC1350_KEY_0 readinputport(3)&0x20 |
| 43 | | #define PC1350_KEY_POINT readinputport(3)&0x10 |
| 44 | | #define PC1350_KEY_PLUS readinputport(3)&8 |
| 45 | | #define PC1350_KEY_MINUS readinputport(3)&4 |
| 46 | | #define PC1350_KEY_COMMA readinputport(3)&2 |
| 47 | | #define PC1350_KEY_LSHIFT readinputport(3)&1 |
| 40 | #define PC1350_KEY_ASTERIX input_port_read_indexed(machine, 3)&0x80 |
| 41 | #define PC1350_KEY_SEMICOLON input_port_read_indexed(machine, 3)&0x40 |
| 42 | #define PC1350_KEY_0 input_port_read_indexed(machine, 3)&0x20 |
| 43 | #define PC1350_KEY_POINT input_port_read_indexed(machine, 3)&0x10 |
| 44 | #define PC1350_KEY_PLUS input_port_read_indexed(machine, 3)&8 |
| 45 | #define PC1350_KEY_MINUS input_port_read_indexed(machine, 3)&4 |
| 46 | #define PC1350_KEY_COMMA input_port_read_indexed(machine, 3)&2 |
| 47 | #define PC1350_KEY_LSHIFT input_port_read_indexed(machine, 3)&1 |
| 48 | 48 | |
| 49 | | #define PC1350_KEY_Q readinputport(4)&0x80 |
| 50 | | #define PC1350_KEY_W readinputport(4)&0x40 |
| 51 | | #define PC1350_KEY_E readinputport(4)&0x20 |
| 52 | | #define PC1350_KEY_R readinputport(4)&0x10 |
| 53 | | #define PC1350_KEY_T readinputport(4)&8 |
| 54 | | #define PC1350_KEY_Y readinputport(4)&4 |
| 55 | | #define PC1350_KEY_U readinputport(4)&2 |
| 56 | | #define PC1350_KEY_I readinputport(4)&1 |
| 49 | #define PC1350_KEY_Q input_port_read_indexed(machine, 4)&0x80 |
| 50 | #define PC1350_KEY_W input_port_read_indexed(machine, 4)&0x40 |
| 51 | #define PC1350_KEY_E input_port_read_indexed(machine, 4)&0x20 |
| 52 | #define PC1350_KEY_R input_port_read_indexed(machine, 4)&0x10 |
| 53 | #define PC1350_KEY_T input_port_read_indexed(machine, 4)&8 |
| 54 | #define PC1350_KEY_Y input_port_read_indexed(machine, 4)&4 |
| 55 | #define PC1350_KEY_U input_port_read_indexed(machine, 4)&2 |
| 56 | #define PC1350_KEY_I input_port_read_indexed(machine, 4)&1 |
| 57 | 57 | |
| 58 | | #define PC1350_KEY_O readinputport(5)&0x80 |
| 59 | | #define PC1350_KEY_P readinputport(5)&0x40 |
| 60 | | #define PC1350_KEY_DEF readinputport(5)&0x20 |
| 61 | | #define PC1350_KEY_A readinputport(5)&0x10 |
| 62 | | #define PC1350_KEY_S readinputport(5)&8 |
| 63 | | #define PC1350_KEY_D readinputport(5)&4 |
| 64 | | #define PC1350_KEY_F readinputport(5)&2 |
| 65 | | #define PC1350_KEY_G readinputport(5)&1 |
| 58 | #define PC1350_KEY_O input_port_read_indexed(machine, 5)&0x80 |
| 59 | #define PC1350_KEY_P input_port_read_indexed(machine, 5)&0x40 |
| 60 | #define PC1350_KEY_DEF input_port_read_indexed(machine, 5)&0x20 |
| 61 | #define PC1350_KEY_A input_port_read_indexed(machine, 5)&0x10 |
| 62 | #define PC1350_KEY_S input_port_read_indexed(machine, 5)&8 |
| 63 | #define PC1350_KEY_D input_port_read_indexed(machine, 5)&4 |
| 64 | #define PC1350_KEY_F input_port_read_indexed(machine, 5)&2 |
| 65 | #define PC1350_KEY_G input_port_read_indexed(machine, 5)&1 |
| 66 | 66 | |
| 67 | | #define PC1350_KEY_H readinputport(6)&0x80 |
| 68 | | #define PC1350_KEY_J readinputport(6)&0x40 |
| 69 | | #define PC1350_KEY_K readinputport(6)&0x20 |
| 70 | | #define PC1350_KEY_L readinputport(6)&0x10 |
| 71 | | #define PC1350_KEY_EQUALS readinputport(6)&8 |
| 72 | | #define PC1350_KEY_SML readinputport(6)&4 |
| 73 | | #define PC1350_KEY_Z readinputport(6)&2 |
| 74 | | #define PC1350_KEY_X readinputport(6)&1 |
| 67 | #define PC1350_KEY_H input_port_read_indexed(machine, 6)&0x80 |
| 68 | #define PC1350_KEY_J input_port_read_indexed(machine, 6)&0x40 |
| 69 | #define PC1350_KEY_K input_port_read_indexed(machine, 6)&0x20 |
| 70 | #define PC1350_KEY_L input_port_read_indexed(machine, 6)&0x10 |
| 71 | #define PC1350_KEY_EQUALS input_port_read_indexed(machine, 6)&8 |
| 72 | #define PC1350_KEY_SML input_port_read_indexed(machine, 6)&4 |
| 73 | #define PC1350_KEY_Z input_port_read_indexed(machine, 6)&2 |
| 74 | #define PC1350_KEY_X input_port_read_indexed(machine, 6)&1 |
| 75 | 75 | |
| 76 | | #define PC1350_KEY_C readinputport(7)&0x80 |
| 77 | | #define PC1350_KEY_V readinputport(7)&0x40 |
| 78 | | #define PC1350_KEY_B readinputport(7)&0x20 |
| 79 | | #define PC1350_KEY_N readinputport(7)&0x10 |
| 80 | | #define PC1350_KEY_M readinputport(7)&8 |
| 81 | | #define PC1350_KEY_SPACE readinputport(7)&4 |
| 82 | | #define PC1350_KEY_ENTER readinputport(7)&2 |
| 76 | #define PC1350_KEY_C input_port_read_indexed(machine, 7)&0x80 |
| 77 | #define PC1350_KEY_V input_port_read_indexed(machine, 7)&0x40 |
| 78 | #define PC1350_KEY_B input_port_read_indexed(machine, 7)&0x20 |
| 79 | #define PC1350_KEY_N input_port_read_indexed(machine, 7)&0x10 |
| 80 | #define PC1350_KEY_M input_port_read_indexed(machine, 7)&8 |
| 81 | #define PC1350_KEY_SPACE input_port_read_indexed(machine, 7)&4 |
| 82 | #define PC1350_KEY_ENTER input_port_read_indexed(machine, 7)&2 |
| 83 | 83 | |
| 84 | | #define PC1350_CONTRAST (readinputport(8)&7) |
| 84 | #define PC1350_CONTRAST (input_port_read_indexed(machine, 8)&7) |
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | /*----------- defined in machine/pc1350.c -----------*/ |
src/mess/includes/c16.h
| r2340 | r2341 | |
| 8 | 8 | #define C16_H_ |
| 9 | 9 | |
| 10 | 10 | |
| 11 | | #define JOYSTICK1_PORT ( readinputportbytag("CFG0") & 0x80 ) |
| 12 | | #define JOYSTICK2_PORT ( readinputportbytag("CFG0") & 0x40 ) |
| 11 | #define JOYSTICK1_PORT ( input_port_read(Machine, "CFG0") & 0x80 ) |
| 12 | #define JOYSTICK2_PORT ( input_port_read(Machine, "CFG0") & 0x40 ) |
| 13 | 13 | |
| 14 | | #define JOYSTICK_2_LEFT ( readinputportbytag("JOY1") & 0x80 ) |
| 15 | | #define JOYSTICK_2_RIGHT ( readinputportbytag("JOY1") & 0x40 ) |
| 16 | | #define JOYSTICK_2_UP ( readinputportbytag("JOY1") & 0x20 ) |
| 17 | | #define JOYSTICK_2_DOWN ( readinputportbytag("JOY1") & 0x10 ) |
| 18 | | #define JOYSTICK_2_BUTTON ( readinputportbytag("JOY1") & 0x08 ) |
| 14 | #define JOYSTICK_2_LEFT ( input_port_read(Machine, "JOY1") & 0x80 ) |
| 15 | #define JOYSTICK_2_RIGHT ( input_port_read(Machine, "JOY1") & 0x40 ) |
| 16 | #define JOYSTICK_2_UP ( input_port_read(Machine, "JOY1") & 0x20 ) |
| 17 | #define JOYSTICK_2_DOWN ( input_port_read(Machine, "JOY1") & 0x10 ) |
| 18 | #define JOYSTICK_2_BUTTON ( input_port_read(Machine, "JOY1") & 0x08 ) |
| 19 | 19 | |
| 20 | | #define JOYSTICK_1_LEFT ( readinputportbytag("JOY0") & 0x80 ) |
| 21 | | #define JOYSTICK_1_RIGHT ( readinputportbytag("JOY0") & 0x40 ) |
| 22 | | #define JOYSTICK_1_UP ( readinputportbytag("JOY0") & 0x20 ) |
| 23 | | #define JOYSTICK_1_DOWN ( readinputportbytag("JOY0") & 0x10 ) |
| 24 | | #define JOYSTICK_1_BUTTON ( readinputportbytag("JOY0") & 0x08 ) |
| 20 | #define JOYSTICK_1_LEFT ( input_port_read(Machine, "JOY0") & 0x80 ) |
| 21 | #define JOYSTICK_1_RIGHT ( input_port_read(Machine, "JOY0") & 0x40 ) |
| 22 | #define JOYSTICK_1_UP ( input_port_read(Machine, "JOY0") & 0x20 ) |
| 23 | #define JOYSTICK_1_DOWN ( input_port_read(Machine, "JOY0") & 0x10 ) |
| 24 | #define JOYSTICK_1_BUTTON ( input_port_read(Machine, "JOY0") & 0x08 ) |
| 25 | 25 | |
| 26 | | #define JOYSTICK_SWAP ( readinputportbytag("Special") & 0x80 ) |
| 26 | #define JOYSTICK_SWAP ( input_port_read(Machine, "Special") & 0x80 ) |
| 27 | 27 | |
| 28 | | #define DATASSETTE_PLAY ( readinputportbytag("CFG0") & 0x04 ) |
| 29 | | #define DATASSETTE_RECORD ( readinputportbytag("CFG0") & 0x02 ) |
| 30 | | #define DATASSETTE_STOP ( readinputportbytag("CFG0") & 0x01 ) |
| 28 | #define DATASSETTE_PLAY ( input_port_read(Machine, "CFG0") & 0x04 ) |
| 29 | #define DATASSETTE_RECORD ( input_port_read(Machine, "CFG0") & 0x02 ) |
| 30 | #define DATASSETTE_STOP ( input_port_read(Machine, "CFG0") & 0x01 ) |
| 31 | 31 | |
| 32 | | #define QUICKLOAD ( readinputportbytag("CFG0") & 0x08 ) |
| 32 | #define QUICKLOAD ( input_port_read(Machine, "CFG0") & 0x08 ) |
| 33 | 33 | |
| 34 | 34 | |
| 35 | | #define DATASSETTE ( readinputportbytag("CFG0") & 0x20 ) |
| 36 | | #define DATASSETTE_TONE ( readinputportbytag("CFG0") & 0x10 ) |
| 35 | #define DATASSETTE ( input_port_read(Machine, "CFG0") & 0x20 ) |
| 36 | #define DATASSETTE_TONE ( input_port_read(Machine, "CFG0") & 0x10 ) |
| 37 | 37 | |
| 38 | | #define NO_REAL_FLOPPY (( readinputportbytag("CFG1") & 0xc0 ) == 0x00 ) |
| 39 | | #define REAL_C1551 (( readinputportbytag("CFG1") & 0xc0 ) == 0x40 ) |
| 40 | | #define REAL_VC1541 (( readinputportbytag("CFG1") & 0xc0 ) == 0x80 ) |
| 38 | #define NO_REAL_FLOPPY (( input_port_read(Machine, "CFG1") & 0xc0 ) == 0x00 ) |
| 39 | #define REAL_C1551 (( input_port_read(Machine, "CFG1") & 0xc0 ) == 0x40 ) |
| 40 | #define REAL_VC1541 (( input_port_read(Machine, "CFG1") & 0xc0 ) == 0x80 ) |
| 41 | 41 | |
| 42 | | #define IEC8ON (( readinputportbytag("CFG1") & 0x38 ) ==8 ) |
| 43 | | #define IEC8ON (( readinputportbytag("CFG1") & 0x38 ) ==8 ) |
| 44 | | #define IEC9ON (( readinputportbytag("CFG1") & 0x07 ) ==1 ) |
| 42 | #define IEC8ON (( input_port_read(Machine, "CFG1") & 0x38 ) ==8 ) |
| 43 | #define IEC8ON (( input_port_read(Machine, "CFG1") & 0x38 ) ==8 ) |
| 44 | #define IEC9ON (( input_port_read(Machine, "CFG1") & 0x07 ) ==1 ) |
| 45 | 45 | |
| 46 | | #define SIDCARD ( readinputportbytag("CFG2") & 0x80 ) |
| 46 | #define SIDCARD ( input_port_read(Machine, "CFG2") & 0x80 ) |
| 47 | 47 | // a lot of c64 software has been converted to c16 |
| 48 | 48 | // these oftenly still produce the commands for the sid chip at 0xd400 |
| 49 | 49 | // with following hack you can hear these sounds |
| 50 | | #define SIDCARD_HACK ( readinputportbytag("CFG2") & 0x40 ) |
| 50 | #define SIDCARD_HACK ( input_port_read(Machine, "CFG2") & 0x40 ) |
| 51 | 51 | |
| 52 | | #define C16_PAL (( readinputportbytag("CFG2") & 0x10 ) == 0x00 ) |
| 52 | #define C16_PAL (( input_port_read(Machine, "CFG2") & 0x10 ) == 0x00 ) |
| 53 | 53 | |
| 54 | | #define TYPE_C16 (( readinputportbytag("CFG2") & 0x0c ) == 0x00 ) |
| 55 | | #define TYPE_PLUS4 (( readinputportbytag("CFG2") & 0x0c ) == 0x04 ) |
| 56 | | #define TYPE_364 (( readinputportbytag("CFG2") & 0x0c ) == 0x08 ) |
| 54 | #define TYPE_C16 (( input_port_read(Machine, "CFG2") & 0x0c ) == 0x00 ) |
| 55 | #define TYPE_PLUS4 (( input_port_read(Machine, "CFG2") & 0x0c ) == 0x04 ) |
| 56 | #define TYPE_364 (( input_port_read(Machine, "CFG2") & 0x0c ) == 0x08 ) |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | /*----------- defined in machine/c16.c -----------*/ |
src/mess/includes/vc20.h
| r2340 | r2341 | |
| 35 | 35 | paddle 2 button to joystick right |
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | | #define JOYSTICK (readinputportbytag( TAG_DEVICES )&0x80) |
| 39 | | #define PADDLES (readinputportbytag( TAG_DEVICES )&0x40) |
| 40 | | #define LIGHTPEN (readinputportbytag( TAG_DEVICES )&0x20) |
| 41 | | #define LIGHTPEN_POINTER (LIGHTPEN&&(readinputportbytag( TAG_DEVICES )&0x10)) |
| 42 | | #define LIGHTPEN_X_VALUE (readinputportbytag( TAG_LIGHTPENX )&~1) /* effectiv resolution */ |
| 43 | | #define LIGHTPEN_Y_VALUE (readinputportbytag( TAG_LIGHTPENY )&~1) /* effectiv resolution */ |
| 44 | | #define LIGHTPEN_BUTTON (LIGHTPEN&&(readinputportbytag( TAG_JOYSTICK )&0x80)) |
| 38 | #define JOYSTICK (input_port_read(machine, TAG_DEVICES )&0x80) |
| 39 | #define PADDLES (input_port_read(machine, TAG_DEVICES )&0x40) |
| 40 | #define LIGHTPEN (input_port_read(machine, TAG_DEVICES )&0x20) |
| 41 | #define LIGHTPEN_POINTER (LIGHTPEN&&(input_port_read(machine, TAG_DEVICES )&0x10)) |
| 42 | #define LIGHTPEN_X_VALUE (input_port_read(machine, TAG_LIGHTPENX )&~1) /* effectiv resolution */ |
| 43 | #define LIGHTPEN_Y_VALUE (input_port_read(machine, TAG_LIGHTPENY )&~1) /* effectiv resolution */ |
| 44 | #define LIGHTPEN_BUTTON (LIGHTPEN&&(input_port_read(machine, TAG_JOYSTICK )&0x80)) |
| 45 | 45 | |
| 46 | | #define JOYSTICK_UP (readinputportbytag( TAG_JOYSTICK )&1) |
| 47 | | #define JOYSTICK_DOWN (readinputportbytag( TAG_JOYSTICK )&2) |
| 48 | | #define JOYSTICK_LEFT (readinputportbytag( TAG_JOYSTICK )&4) |
| 49 | | #define JOYSTICK_RIGHT (readinputportbytag( TAG_JOYSTICK )&8) |
| 50 | | #define JOYSTICK_BUTTON (readinputportbytag( TAG_JOYSTICK )&0x10) |
| 46 | #define JOYSTICK_UP (input_port_read(machine, TAG_JOYSTICK )&1) |
| 47 | #define JOYSTICK_DOWN (input_port_read(machine, TAG_JOYSTICK )&2) |
| 48 | #define JOYSTICK_LEFT (input_port_read(machine, TAG_JOYSTICK )&4) |
| 49 | #define JOYSTICK_RIGHT (input_port_read(machine, TAG_JOYSTICK )&8) |
| 50 | #define JOYSTICK_BUTTON (input_port_read(machine, TAG_JOYSTICK )&0x10) |
| 51 | 51 | |
| 52 | | #define PADDLE1_BUTTON (readinputportbytag( TAG_JOYSTICK )&0x20) |
| 53 | | #define PADDLE2_BUTTON (readinputportbytag( TAG_JOYSTICK )&0x40) |
| 52 | #define PADDLE1_BUTTON (input_port_read(machine, TAG_JOYSTICK )&0x20) |
| 53 | #define PADDLE2_BUTTON (input_port_read(machine, TAG_JOYSTICK )&0x40) |
| 54 | 54 | |
| 55 | | #define PADDLE1_VALUE readinputportbytag( TAG_PADDLE1 ) |
| 56 | | #define PADDLE2_VALUE readinputportbytag( TAG_PADDLE2 ) |
| 55 | #define PADDLE1_VALUE input_port_read(machine, TAG_PADDLE1 ) |
| 56 | #define PADDLE2_VALUE input_port_read(machine, TAG_PADDLE2 ) |
| 57 | 57 | |
| 58 | 58 | |
| 59 | | #define DATASSETTE (readinputportbytag( TAG_DEVICES )&0x8) |
| 60 | | #define DATASSETTE_TONE (readinputportbytag( TAG_DEVICES )&4) |
| 59 | #define DATASSETTE (input_port_read(machine, TAG_DEVICES )&0x8) |
| 60 | #define DATASSETTE_TONE (input_port_read(machine, TAG_DEVICES )&4) |
| 61 | 61 | |
| 62 | | #define QUICKLOAD (readinputportbytag( TAG_CASSETTE )&8) |
| 62 | #define QUICKLOAD (input_port_read(machine, TAG_CASSETTE )&8) |
| 63 | 63 | |
| 64 | | #define DATASSETTE_PLAY (readinputportbytag( TAG_CASSETTE )&4) |
| 65 | | #define DATASSETTE_RECORD (readinputportbytag( TAG_CASSETTE )&2) |
| 66 | | #define DATASSETTE_STOP (readinputportbytag( TAG_CASSETTE )&1) |
| 64 | #define DATASSETTE_PLAY (input_port_read(machine, TAG_CASSETTE )&4) |
| 65 | #define DATASSETTE_RECORD (input_port_read(machine, TAG_CASSETTE )&2) |
| 66 | #define DATASSETTE_STOP (input_port_read(machine, TAG_CASSETTE )&1) |
| 67 | 67 | |
| 68 | 68 | #define VC20ADDR2VIC6560ADDR(a) (((a)>0x8000)?((a)&0x1fff):((a)|0x2000)) |
| 69 | 69 | #define VIC6560ADDR2VC20ADDR(a) (((a)>0x2000)?((a)&0x1fff):((a)|0x8000)) |
src/mess/includes/c64.h
| r2340 | r2341 | |
| 75 | 75 | PORT_DIPSETTING( 0x0100, DEF_STR( Yes ) ) |
| 76 | 76 | |
| 77 | 77 | |
| 78 | | #define LIGHTPEN (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0xa000 ) |
| 79 | | #define MOUSE1 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x8000 ) |
| 80 | | #define JOYSTICK1_2BUTTON (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x6000 ) |
| 81 | | #define PADDLES12 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x4000 ) |
| 82 | | #define JOYSTICK1 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x2000 ) |
| 83 | | #define LIGHTPEN_POINTER ( LIGHTPEN && ( readinputportbytag( "DSW0" ) & 0x1000)) |
| 84 | | #define MOUSE2 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x800 ) |
| 85 | | #define JOYSTICK2_2BUTTON (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x600 ) |
| 86 | | #define PADDLES34 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x400 ) |
| 87 | | #define JOYSTICK2 (( readinputportbytag( "DSW0" ) & 0xe000 ) == 0x200 ) |
| 88 | | #define JOYSTICK_SWAP ( readinputportbytag( "DSW0" ) & 0x100 ) |
| 78 | #define LIGHTPEN (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0xa000 ) |
| 79 | #define MOUSE1 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x8000 ) |
| 80 | #define JOYSTICK1_2BUTTON (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x6000 ) |
| 81 | #define PADDLES12 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x4000 ) |
| 82 | #define JOYSTICK1 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x2000 ) |
| 83 | #define LIGHTPEN_POINTER ( LIGHTPEN && ( input_port_read(Machine, "DSW0" ) & 0x1000)) |
| 84 | #define MOUSE2 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x800 ) |
| 85 | #define JOYSTICK2_2BUTTON (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x600 ) |
| 86 | #define PADDLES34 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x400 ) |
| 87 | #define JOYSTICK2 (( input_port_read(Machine, "DSW0" ) & 0xe000 ) == 0x200 ) |
| 88 | #define JOYSTICK_SWAP ( input_port_read(Machine, "DSW0" ) & 0x100 ) |
| 89 | 89 | |
| 90 | | #define PADDLE1_BUTTON (( readinputportbytag( "PAD1" ) & 0x100 )) |
| 91 | | #define PADDLE1_VALUE ( readinputportbytag( "PAD1" ) & 0xff ) |
| 92 | | #define PADDLE2_BUTTON (( readinputportbytag( "PAD2" ) & 0x100 )) |
| 93 | | #define PADDLE2_VALUE ( readinputportbytag( "PAD2" ) & 0xff ) |
| 94 | | #define PADDLE3_BUTTON (( readinputportbytag( "PAD3" ) & 0x100 )) |
| 95 | | #define PADDLE3_VALUE ( readinputportbytag( "PAD3" ) & 0xff ) |
| 96 | | #define PADDLE4_BUTTON (( readinputportbytag( "PAD4" ) & 0x100 )) |
| 97 | | #define PADDLE4_VALUE ( readinputportbytag( "PAD4" ) & 0xff ) |
| 90 | #define PADDLE1_BUTTON (( input_port_read(Machine, "PAD1" ) & 0x100 )) |
| 91 | #define PADDLE1_VALUE ( input_port_read(Machine, "PAD1" ) & 0xff ) |
| 92 | #define PADDLE2_BUTTON (( input_port_read(Machine, "PAD2" ) & 0x100 )) |
| 93 | #define PADDLE2_VALUE ( input_port_read(Machine, "PAD2" ) & 0xff ) |
| 94 | #define PADDLE3_BUTTON (( input_port_read(Machine, "PAD3" ) & 0x100 )) |
| 95 | #define PADDLE3_VALUE ( input_port_read(Machine, "PAD3" ) & 0xff ) |
| 96 | #define PADDLE4_BUTTON (( input_port_read(Machine, "PAD4" ) & 0x100 )) |
| 97 | #define PADDLE4_VALUE ( input_port_read(Machine, "PAD4" ) & 0xff ) |
| 98 | 98 | |
| 99 | | #define MOUSE1_BUTTON1 ( MOUSE1 && ( readinputportbytag( "TRX" ) & 0x8000 )) |
| 100 | | #define MOUSE1_BUTTON2 ( MOUSE1 && ( readinputportbytag( "TRX" ) & 0x4000 )) |
| 101 | | #define MOUSE1_X (( readinputportbytag( "TRX" ) & 0x3ff )) |
| 102 | | #define MOUSE1_Y ( readinputportbytag( "TRY" )) |
| 99 | #define MOUSE1_BUTTON1 ( MOUSE1 && ( input_port_read(Machine, "TRX" ) & 0x8000 )) |
| 100 | #define MOUSE1_BUTTON2 ( MOUSE1 && ( input_port_read(Machine, "TRX" ) & 0x4000 )) |
| 101 | #define MOUSE1_X (( input_port_read(Machine, "TRX" ) & 0x3ff )) |
| 102 | #define MOUSE1_Y ( input_port_read(Machine, "TRY" )) |
| 103 | 103 | |
| 104 | | #define MOUSE2_BUTTON1 ( MOUSE1 && ( readinputportbytag( "TRX" ) & 0x8000 )) |
| 105 | | #define MOUSE2_BUTTON2 ( MOUSE1 && ( readinputportbytag( "TRX" ) & 0x4000 )) |
| 106 | | #define MOUSE2_X (( readinputportbytag( "TRX" ) & 0x3ff )) |
| 107 | | #define MOUSE2_Y ( readinputportbytag( "TRY" )) |
| 104 | #define MOUSE2_BUTTON1 ( MOUSE1 && ( input_port_read(Machine, "TRX" ) & 0x8000 )) |
| 105 | #define MOUSE2_BUTTON2 ( MOUSE1 && ( input_port_read(Machine, "TRX" ) & 0x4000 )) |
| 106 | #define MOUSE2_X (( input_port_read(Machine, "TRX" ) & 0x3ff )) |
| 107 | #define MOUSE2_Y ( input_port_read(Machine, "TRY" )) |
| 108 | 108 | |
| 109 | | #define LIGHTPEN_BUTTON ( LIGHTPEN && ( readinputportbytag( "TRX" ) & 0x8000 )) |
| 110 | | #define LIGHTPEN_X_VALUE (( readinputportbytag( "TRX" ) & 0x3ff ) & ~1) /* effective resolution */ |
| 111 | | #define LIGHTPEN_Y_VALUE ( readinputportbytag( "TRY" ) & ~1) /* effective resolution */ |
| 109 | #define LIGHTPEN_BUTTON ( LIGHTPEN && ( input_port_read(Machine, "TRX" ) & 0x8000 )) |
| 110 | #define LIGHTPEN_X_VALUE (( input_port_read(Machine, "TRX" ) & 0x3ff ) & ~1) /* effective resolution */ |
| 111 | #define LIGHTPEN_Y_VALUE ( input_port_read(Machine, "TRY" ) & ~1) /* effective resolution */ |
| 112 | 112 | |
| 113 | | #define JOYSTICK_1_LEFT (( readinputportbytag( "JOY" ) & 0x8000 )) |
| 114 | | #define JOYSTICK_1_RIGHT (( readinputportbytag( "JOY" ) & 0x4000 )) |
| 115 | | #define JOYSTICK_1_UP (( readinputportbytag( "JOY" ) & 0x2000 )) |
| 116 | | #define JOYSTICK_1_DOWN (( readinputportbytag( "JOY" ) & 0x1000 )) |
| 117 | | #define JOYSTICK_1_BUTTON (( readinputportbytag( "JOY" ) & 0x800 )) |
| 118 | | #define JOYSTICK_1_BUTTON2 (( readinputportbytag( "JOY" ) & 0x400 )) |
| 119 | | #define JOYSTICK_2_LEFT (( readinputportbytag( "JOY" ) & 0x80 )) |
| 120 | | #define JOYSTICK_2_RIGHT (( readinputportbytag( "JOY" ) & 0x40 )) |
| 121 | | #define JOYSTICK_2_UP (( readinputportbytag( "JOY" ) & 0x20 )) |
| 122 | | #define JOYSTICK_2_DOWN (( readinputportbytag( "JOY" ) & 0x10 )) |
| 123 | | #define JOYSTICK_2_BUTTON (( readinputportbytag( "JOY" ) & 8 )) |
| 124 | | #define JOYSTICK_2_BUTTON2 (( readinputportbytag( "JOY" ) & 4 )) |
| 113 | #define JOYSTICK_1_LEFT (( input_port_read(Machine, "JOY" ) & 0x8000 )) |
| 114 | #define JOYSTICK_1_RIGHT (( input_port_read(Machine, "JOY" ) & 0x4000 )) |
| 115 | #define JOYSTICK_1_UP (( input_port_read(Machine, "JOY" ) & 0x2000 )) |
| 116 | #define JOYSTICK_1_DOWN (( input_port_read(Machine, "JOY" ) & 0x1000 )) |
| 117 | #define JOYSTICK_1_BUTTON (( input_port_read(Machine, "JOY" ) & 0x800 )) |
| 118 | #define JOYSTICK_1_BUTTON2 (( input_port_read(Machine, "JOY" ) & 0x400 )) |
| 119 | #define JOYSTICK_2_LEFT (( input_port_read(Machine, "JOY" ) & 0x80 )) |
| 120 | #define JOYSTICK_2_RIGHT (( input_port_read(Machine, "JOY" ) & 0x40 )) |
| 121 | #define JOYSTICK_2_UP (( input_port_read(Machine, "JOY" ) & 0x20 )) |
| 122 | #define JOYSTICK_2_DOWN (( input_port_read(Machine, "JOY" ) & 0x10 )) |
| 123 | #define JOYSTICK_2_BUTTON (( input_port_read(Machine, "JOY" ) & 8 )) |
| 124 | #define JOYSTICK_2_BUTTON2 (( input_port_read(Machine, "JOY" ) & 4 )) |
| 125 | 125 | |
| 126 | | #define QUICKLOAD ( readinputportbytag( "Config" ) & 0x8000 ) |
| 126 | #define QUICKLOAD ( input_port_read(Machine, "Config" ) & 0x8000 ) |
| 127 | 127 | |
| 128 | 128 | /* to be cleaned up, when tape emulation uses standard MESS cassette code */ |
| 129 | | #define DATASSETTE ( readinputportbytag( "Config" ) & 0x4000 ) |
| 130 | | #define DATASSETTE_TONE ( readinputportbytag( "Config" ) & 0x2000 ) |
| 131 | | #define DATASSETTE_PLAY ( readinputportbytag( "Config" ) & 0x1000 ) |
| 132 | | #define DATASSETTE_RECORD ( readinputportbytag( "Config" ) & 0x800 ) |
| 133 | | #define DATASSETTE_STOP ( readinputportbytag( "Config" ) & 0x400 ) |
| 129 | #define DATASSETTE ( input_port_read(Machine, "Config" ) & 0x4000 ) |
| 130 | #define DATASSETTE_TONE ( input_port_read(Machine, "Config" ) & 0x2000 ) |
| 131 | #define DATASSETTE_PLAY ( input_port_read(Machine, "Config" ) & 0x1000 ) |
| 132 | #define DATASSETTE_RECORD ( input_port_read(Machine, "Config" ) & 0x800 ) |
| 133 | #define DATASSETTE_STOP ( input_port_read(Machine, "Config" ) & 0x400 ) |
| 134 | 134 | |
| 135 | | #define SID8580 (( readinputportbytag( "Config" ) & 0x80) ? MOS8580 : MOS6581) |
| 135 | #define SID8580 (( input_port_read(Machine, "Config" ) & 0x80) ? MOS8580 : MOS6581) |
| 136 | 136 | |
| 137 | | #define AUTO_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 0 ) |
| 138 | | #define ULTIMAX_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 4 ) |
| 139 | | #define C64_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 8 ) |
| 140 | | #define SUPERGAMES_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 0x10 ) |
| 141 | | #define ROBOCOP2_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 0x14 ) |
| 142 | | #define C128_MODULE (( readinputportbytag( "Config" ) & 0x1c ) == 0x18 ) |
| 137 | #define AUTO_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 0 ) |
| 138 | #define ULTIMAX_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 4 ) |
| 139 | #define C64_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 8 ) |
| 140 | #define SUPERGAMES_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 0x10 ) |
| 141 | #define ROBOCOP2_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 0x14 ) |
| 142 | #define C128_MODULE (( input_port_read(Machine, "Config" ) & 0x1c ) == 0x18 ) |
| 143 | 143 | |
| 144 | | #define KEY_RESTORE ( readinputportbytag( "Special" ) & 0x80 ) |
| 144 | #define KEY_RESTORE ( input_port_read(Machine, "Special" ) & 0x80 ) |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | /*----------- defined in machine/c64.c -----------*/ |
src/mess/includes/pc1251.h
| r2340 | r2341 | |
| 10 | 10 | #define PC1251_H_ |
| 11 | 11 | |
| 12 | 12 | |
| 13 | | #define PC1251_SWITCH_MODE (readinputport(0)&7) |
| 13 | #define PC1251_SWITCH_MODE (input_port_read_indexed(machine, 0)&7) |
| 14 | 14 | |
| 15 | | #define PC1251_KEY_DEF readinputport(0)&0x100 |
| 16 | | #define PC1251_KEY_SHIFT readinputport(0)&0x80 |
| 17 | | #define PC1251_KEY_DOWN readinputport(0)&0x40 |
| 18 | | #define PC1251_KEY_UP readinputport(0)&0x20 |
| 19 | | #define PC1251_KEY_LEFT readinputport(0)&0x10 |
| 20 | | #define PC1251_KEY_RIGHT readinputport(0)&8 |
| 15 | #define PC1251_KEY_DEF input_port_read_indexed(machine, 0)&0x100 |
| 16 | #define PC1251_KEY_SHIFT input_port_read_indexed(machine, 0)&0x80 |
| 17 | #define PC1251_KEY_DOWN input_port_read_indexed(machine, 0)&0x40 |
| 18 | #define PC1251_KEY_UP input_port_read_indexed(machine, 0)&0x20 |
| 19 | #define PC1251_KEY_LEFT input_port_read_indexed(machine, 0)&0x10 |
| 20 | #define PC1251_KEY_RIGHT input_port_read_indexed(machine, 0)&8 |
| 21 | 21 | |
| 22 | | #define PC1251_KEY_BRK readinputport(1)&0x80 |
| 23 | | #define PC1251_KEY_Q readinputport(1)&0x40 |
| 24 | | #define PC1251_KEY_W readinputport(1)&0x20 |
| 25 | | #define PC1251_KEY_E readinputport(1)&0x10 |
| 26 | | #define PC1251_KEY_R readinputport(1)&8 |
| 27 | | #define PC1251_KEY_T readinputport(1)&4 |
| 28 | | #define PC1251_KEY_Y readinputport(1)&2 |
| 29 | | #define PC1251_KEY_U readinputport(1)&1 |
| 22 | #define PC1251_KEY_BRK input_port_read_indexed(machine, 1)&0x80 |
| 23 | #define PC1251_KEY_Q input_port_read_indexed(machine, 1)&0x40 |
| 24 | #define PC1251_KEY_W input_port_read_indexed(machine, 1)&0x20 |
| 25 | #define PC1251_KEY_E input_port_read_indexed(machine, 1)&0x10 |
| 26 | #define PC1251_KEY_R input_port_read_indexed(machine, 1)&8 |
| 27 | #define PC1251_KEY_T input_port_read_indexed(machine, 1)&4 |
| 28 | #define PC1251_KEY_Y input_port_read_indexed(machine, 1)&2 |
| 29 | #define PC1251_KEY_U input_port_read_indexed(machine, 1)&1 |
| 30 | 30 | |
| 31 | | #define PC1251_KEY_I readinputport(2)&0x80 |
| 32 | | #define PC1251_KEY_O readinputport(2)&0x40 |
| 33 | | #define PC1251_KEY_P readinputport(2)&0x20 |
| 34 | | #define PC1251_KEY_A readinputport(2)&0x10 |
| 35 | | #define PC1251_KEY_S readinputport(2)&8 |
| 36 | | #define PC1251_KEY_D readinputport(2)&4 |
| 37 | | #define PC1251_KEY_F readinputport(2)&2 |
| 38 | | #define PC1251_KEY_G readinputport(2)&1 |
| 31 | #define PC1251_KEY_I input_port_read_indexed(machine, 2)&0x80 |
| 32 | #define PC1251_KEY_O input_port_read_indexed(machine, 2)&0x40 |
| 33 | #define PC1251_KEY_P input_port_read_indexed(machine, 2)&0x20 |
| 34 | #define PC1251_KEY_A input_port_read_indexed(machine, 2)&0x10 |
| 35 | #define PC1251_KEY_S input_port_read_indexed(machine, 2)&8 |
| 36 | #define PC1251_KEY_D input_port_read_indexed(machine, 2)&4 |
| 37 | #define PC1251_KEY_F input_port_read_indexed(machine, 2)&2 |
| 38 | #define PC1251_KEY_G input_port_read_indexed(machine, 2)&1 |
| 39 | 39 | |
| 40 | | #define PC1251_KEY_H readinputport(3)&0x80 |
| 41 | | #define PC1251_KEY_J readinputport(3)&0x40 |
| 42 | | #define PC1251_KEY_K readinputport(3)&0x20 |
| 43 | | #define PC1251_KEY_L readinputport(3)&0x10 |
| 44 | | #define PC1251_KEY_EQUALS readinputport(3)&8 |
| 45 | | #define PC1251_KEY_Z readinputport(3)&4 |
| 46 | | #define PC1251_KEY_X readinputport(3)&2 |
| 47 | | #define PC1251_KEY_C readinputport(3)&1 |
| 40 | #define PC1251_KEY_H input_port_read_indexed(machine, 3)&0x80 |
| 41 | #define PC1251_KEY_J input_port_read_indexed(machine, 3)&0x40 |
| 42 | #define PC1251_KEY_K input_port_read_indexed(machine, 3)&0x20 |
| 43 | #define PC1251_KEY_L input_port_read_indexed(machine, 3)&0x10 |
| 44 | #define PC1251_KEY_EQUALS input_port_read_indexed(machine, 3)&8 |
| 45 | #define PC1251_KEY_Z input_port_read_indexed(machine, 3)&4 |
| 46 | #define PC1251_KEY_X input_port_read_indexed(machine, 3)&2 |
| 47 | #define PC1251_KEY_C input_port_read_indexed(machine, 3)&1 |
| 48 | 48 | |
| 49 | | #define PC1251_KEY_V readinputport(4)&0x80 |
| 50 | | #define PC1251_KEY_B readinputport(4)&0x40 |
| 51 | | #define PC1251_KEY_N readinputport(4)&0x20 |
| 52 | | #define PC1251_KEY_M readinputport(4)&0x10 |
| 53 | | #define PC1251_KEY_SPACE readinputport(4)&8 |
| 54 | | #define PC1251_KEY_ENTER readinputport(4)&4 |
| 55 | | #define PC1251_KEY_7 readinputport(4)&2 |
| 56 | | #define PC1251_KEY_8 readinputport(4)&1 |
| 49 | #define PC1251_KEY_V input_port_read_indexed(machine, 4)&0x80 |
| 50 | #define PC1251_KEY_B input_port_read_indexed(machine, 4)&0x40 |
| 51 | #define PC1251_KEY_N input_port_read_indexed(machine, 4)&0x20 |
| 52 | #define PC1251_KEY_M input_port_read_indexed(machine, 4)&0x10 |
| 53 | #define PC1251_KEY_SPACE input_port_read_indexed(machine, 4)&8 |
| 54 | #define PC1251_KEY_ENTER input_port_read_indexed(machine, 4)&4 |
| 55 | #define PC1251_KEY_7 input_port_read_indexed(machine, 4)&2 |
| 56 | #define PC1251_KEY_8 input_port_read_indexed(machine, 4)&1 |
| 57 | 57 | |
| 58 | | #define PC1251_KEY_9 readinputport(5)&0x80 |
| 59 | | #define PC1251_KEY_CL readinputport(5)&0x40 |
| 60 | | #define PC1251_KEY_4 readinputport(5)&0x20 |
| 61 | | #define PC1251_KEY_5 readinputport(5)&0x10 |
| 62 | | #define PC1251_KEY_6 readinputport(5)&8 |
| 63 | | #define PC1251_KEY_SLASH readinputport(5)&4 |
| 64 | | #define PC1251_KEY_1 readinputport(5)&2 |
| 65 | | #define PC1251_KEY_2 readinputport(5)&1 |
| 58 | #define PC1251_KEY_9 input_port_read_indexed(machine, 5)&0x80 |
| 59 | #define PC1251_KEY_CL input_port_read_indexed(machine, 5)&0x40 |
| 60 | #define PC1251_KEY_4 input_port_read_indexed(machine, 5)&0x20 |
| 61 | #define PC1251_KEY_5 input_port_read_indexed(machine, 5)&0x10 |
| 62 | #define PC1251_KEY_6 input_port_read_indexed(machine, 5)&8 |
| 63 | #define PC1251_KEY_SLASH input_port_read_indexed(machine, 5)&4 |
| 64 | #define PC1251_KEY_1 input_port_read_indexed(machine, 5)&2 |
| 65 | #define PC1251_KEY_2 input_port_read_indexed(machine, 5)&1 |
| 66 | 66 | |
| 67 | | #define PC1251_KEY_3 readinputport(6)&0x80 |
| 68 | | #define PC1251_KEY_ASTERIX readinputport(6)&0x40 |
| 69 | | #define PC1251_KEY_0 readinputport(6)&0x20 |
| 70 | | #define PC1251_KEY_POINT readinputport(6)&0x10 |
| 71 | | #define PC1251_KEY_PLUS readinputport(6)&8 |
| 72 | | #define PC1251_KEY_MINUS readinputport(6)&4 |
| 73 | | #define PC1251_KEY_RESET readinputport(6)&1 |
| 67 | #define PC1251_KEY_3 input_port_read_indexed(machine, 6)&0x80 |
| 68 | #define PC1251_KEY_ASTERIX input_port_read_indexed(machine, 6)&0x40 |
| 69 | #define PC1251_KEY_0 input_port_read_indexed(machine, 6)&0x20 |
| 70 | #define PC1251_KEY_POINT input_port_read_indexed(machine, 6)&0x10 |
| 71 | #define PC1251_KEY_PLUS input_port_read_indexed(machine, 6)&8 |
| 72 | #define PC1251_KEY_MINUS input_port_read_indexed(machine, 6)&4 |
| 73 | #define PC1251_KEY_RESET input_port_read_indexed(machine, 6)&1 |
| 74 | 74 | |
| 75 | | #define PC1251_RAM4K (readinputport(7)&0xc0)==0x40 |
| 76 | | #define PC1251_RAM6K (readinputport(7)&0xc0)==0x80 |
| 77 | | #define PC1251_RAM11K (readinputport(7)&0xc0)==0xc0 |
| 75 | #define PC1251_RAM4K (input_port_read_indexed(machine, 7)&0xc0)==0x40 |
| 76 | #define PC1251_RAM6K (input_port_read_indexed(machine, 7)&0xc0)==0x80 |
| 77 | #define PC1251_RAM11K (input_port_read_indexed(machine, 7)&0xc0)==0xc0 |
| 78 | 78 | |
| 79 | | #define PC1251_CONTRAST (readinputport(7)&7) |
| 79 | #define PC1251_CONTRAST (input_port_read_indexed(machine, 7)&7) |
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | /*----------- defined in machine/pc1251.c -----------*/ |
src/mess/video/arcadia.c
| r2340 | r2341 | |
| 547 | 547 | UINT8 data=0; |
| 548 | 548 | switch (offset) { |
| 549 | 549 | case 0xff: data=arcadia_video.charline|0xf0;break; |
| 550 | | case 0x100: data=readinputportbytag("controller1_col1");break; |
| 551 | | case 0x101: data=readinputportbytag("controller1_col2");break; |
| 552 | | case 0x102: data=readinputportbytag("controller1_col3");break; |
| 553 | | case 0x103: data=readinputportbytag("controller1_extra");break; |
| 554 | | case 0x104: data=readinputportbytag("controller2_col1");break; |
| 555 | | case 0x105: data=readinputportbytag("controller2_col2");break; |
| 556 | | case 0x106: data=readinputportbytag("controller2_col3");break; |
| 557 | | case 0x107: data=readinputportbytag("controller2_extra");break; |
| 558 | | case 0x108: data=readinputportbytag("panel");break; |
| 550 | case 0x100: data=input_port_read(machine, "controller1_col1");break; |
| 551 | case 0x101: data=input_port_read(machine, "controller1_col2");break; |
| 552 | case 0x102: data=input_port_read(machine, "controller1_col3");break; |
| 553 | case 0x103: data=input_port_read(machine, "controller1_extra");break; |
| 554 | case 0x104: data=input_port_read(machine, "controller2_col1");break; |
| 555 | case 0x105: data=input_port_read(machine, "controller2_col2");break; |
| 556 | case 0x106: data=input_port_read(machine, "controller2_col3");break; |
| 557 | case 0x107: data=input_port_read(machine, "controller2_extra");break; |
| 558 | case 0x108: data=input_port_read(machine, "panel");break; |
| 559 | 559 | #if 0 |
| 560 | 560 | case 0x1fe: |
| 561 | | if (arcadia_video.ad_select) data=readinputportbytag("controller1_joy_y")<<3; |
| 562 | | else data=readinputportbytag("controller1_joy_x")<<3; |
| 561 | if (arcadia_video.ad_select) data=input_port_read(machine, "controller1_joy_y")<<3; |
| 562 | else data=input_port_read(machine, "controller1_joy_x")<<3; |
| 563 | 563 | break; |
| 564 | 564 | case 0x1ff: |
| 565 | | if (arcadia_video.ad_select) data=readinputportbytag("controller2_joy_y")<<3; |
| 566 | | else data=readinputportbytag("controller2_joy_x")<<3; |
| 565 | if (arcadia_video.ad_select) data=input_port_read(machine, "controller2_joy_y")<<3; |
| 566 | else data=input_port_read(machine, "controller2_joy_x")<<3; |
| 567 | 567 | break; |
| 568 | 568 | #else |
| 569 | 569 | case 0x1fe: |
| 570 | 570 | data = 0x80; |
| 571 | 571 | if (arcadia_video.ad_select) { |
| 572 | | if (readinputportbytag("joysticks")&0x10) data=0; |
| 573 | | if (readinputportbytag("joysticks")&0x20) data=0xff; |
| 572 | if (input_port_read(machine, "joysticks")&0x10) data=0; |
| 573 | if (input_port_read(machine, "joysticks")&0x20) data=0xff; |
| 574 | 574 | } else { |
| 575 | | if (readinputportbytag("joysticks")&0x40) data=0xff; |
| 576 | | if (readinputportbytag("joysticks")&0x80) data=0; |
| 575 | if (input_port_read(machine, "joysticks")&0x40) data=0xff; |
| 576 | if (input_port_read(machine, "joysticks")&0x80) data=0; |
| 577 | 577 | } |
| 578 | 578 | break; |
| 579 | 579 | case 0x1ff: |
| 580 | 580 | data = 0x6f; // 0x7f too big for alien invaders (movs right) |
| 581 | 581 | if (arcadia_video.ad_select) { |
| 582 | | if (readinputportbytag("joysticks")&0x1) data=0; |
| 583 | | if (readinputportbytag("joysticks")&0x2) data=0xff; |
| 582 | if (input_port_read(machine, "joysticks")&0x1) data=0; |
| 583 | if (input_port_read(machine, "joysticks")&0x2) data=0xff; |
| 584 | 584 | } else { |
| 585 | | if (readinputportbytag("joysticks")&0x4) data=0xff; |
| 586 | | if (readinputportbytag("joysticks")&0x8) data=0; |
| 585 | if (input_port_read(machine, "joysticks")&0x4) data=0xff; |
| 586 | if (input_port_read(machine, "joysticks")&0x8) data=0; |
| 587 | 587 | } |
| 588 | 588 | break; |
| 589 | 589 | #endif |
src/mess/video/pc_cga.c
| r2340 | r2341 | |
| 48 | 48 | ***************************************************************************/ |
| 49 | 49 | |
| 50 | 50 | #include "driver.h" |
| 51 | #include "deprecat.h" |
| 51 | 52 | #include "video/pc_cga.h" |
| 52 | 53 | #include "video/mc6845.h" |
| 53 | 54 | #include "video/pc_video.h" |
| r2340 | r2341 | |
| 125 | 126 | INPUT_PORTS_END |
| 126 | 127 | |
| 127 | 128 | /* Dipswitch for font selection */ |
| 128 | | #define CGA_FONT (readinputport(cga.config_input_port)&3) |
| 129 | #define CGA_FONT (input_port_read_indexed(machine, cga.config_input_port)&3) |
| 129 | 130 | |
| 130 | 131 | /* Dipswitch for monitor selection */ |
| 131 | | #define CGA_MONITOR (readinputport(cga.config_input_port)&0x1C) |
| 132 | #define CGA_MONITOR (input_port_read_indexed(machine, cga.config_input_port)&0x1C) |
| 132 | 133 | #define CGA_MONITOR_RGB 0x00 /* Colour RGB */ |
| 133 | 134 | #define CGA_MONITOR_MONO 0x04 /* Greyscale RGB */ |
| 134 | 135 | #define CGA_MONITOR_COMPOSITE 0x08 /* Colour composite */ |
| r2340 | r2341 | |
| 137 | 138 | |
| 138 | 139 | |
| 139 | 140 | /* Dipswitch for chipset selection */ |
| 140 | | #define CGA_CHIPSET (readinputport(cga.config_input_port)&0xE0) |
| 141 | #define CGA_CHIPSET (input_port_read_indexed(machine, cga.config_input_port)&0xE0) |
| 141 | 142 | #define CGA_CHIPSET_IBM 0x00 /* Original IBM CGA */ |
| 142 | 143 | #define CGA_CHIPSET_PC1512 0x20 /* PC1512 CGA subset */ |
| 143 | 144 | #define CGA_CHIPSET_PC200 0x40 /* PC200 in CGA mode */ |
| r2340 | r2341 | |
| 469 | 470 | |
| 470 | 471 | |
| 471 | 472 | |
| 472 | | static VIDEO_UPDATE( mc6845_cga ) { |
| 473 | static VIDEO_UPDATE( mc6845_cga ) |
| 474 | { |
| 475 | running_machine *machine = screen->machine; |
| 473 | 476 | device_config *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME); |
| 474 | 477 | mc6845_update( devconf, bitmap, cliprect); |
| 475 | 478 | |
| r2340 | r2341 | |
| 1045 | 1048 | */ |
| 1046 | 1049 | static void pc_cga_plantronics_w(int data) |
| 1047 | 1050 | { |
| 1051 | running_machine *machine = Machine; |
| 1052 | |
| 1048 | 1053 | CGA_LOG(1,"CGA_plantronics_w",("$%02x\n", data)); |
| 1049 | 1054 | |
| 1050 | 1055 | if (CGA_CHIPSET != CGA_CHIPSET_ATI) return; |
| r2340 | r2341 | |
| 1498 | 1503 | } |
| 1499 | 1504 | |
| 1500 | 1505 | |
| 1501 | | static VIDEO_UPDATE( mc6845_pc1512 ) { |
| 1506 | static VIDEO_UPDATE( mc6845_pc1512 ) |
| 1507 | { |
| 1508 | running_machine *machine = screen->machine; |
| 1502 | 1509 | device_config *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME); |
| 1503 | 1510 | mc6845_update( devconf, bitmap, cliprect); |
| 1504 | 1511 | |
src/mess/machine/zx.c
| r2340 | r2341 | |
| 110 | 110 | |
| 111 | 111 | if ((offset & 1) == 0) |
| 112 | 112 | { |
| 113 | | int extra1 = readinputport(9); |
| 114 | | int extra2 = readinputport(10); |
| 113 | int extra1 = input_port_read_indexed(machine, 9); |
| 114 | int extra2 = input_port_read_indexed(machine, 10); |
| 115 | 115 | |
| 116 | 116 | ula_scancode_count = 0; |
| 117 | 117 | if ((offset & 0x0100) == 0) |
| 118 | 118 | { |
| 119 | | data &= readinputport(1); |
| 119 | data &= input_port_read_indexed(machine, 1); |
| 120 | 120 | /* SHIFT for extra keys */ |
| 121 | 121 | if (extra1 != 0xff || extra2 != 0xff) |
| 122 | 122 | data &= ~0x01; |
| 123 | 123 | } |
| 124 | 124 | if ((offset & 0x0200) == 0) |
| 125 | | data &= readinputport(2); |
| 125 | data &= input_port_read_indexed(machine, 2); |
| 126 | 126 | if ((offset & 0x0400) == 0) |
| 127 | | data &= readinputport(3); |
| 127 | data &= input_port_read_indexed(machine, 3); |
| 128 | 128 | if ((offset & 0x0800) == 0) |
| 129 | | data &= readinputport(4) & extra1; |
| 129 | data &= input_port_read_indexed(machine, 4) & extra1; |
| 130 | 130 | if ((offset & 0x1000) == 0) |
| 131 | | data &= readinputport(5) & extra2; |
| 131 | data &= input_port_read_indexed(machine, 5) & extra2; |
| 132 | 132 | if ((offset & 0x2000) == 0) |
| 133 | | data &= readinputport(6); |
| 133 | data &= input_port_read_indexed(machine, 6); |
| 134 | 134 | if ((offset & 0x4000) == 0) |
| 135 | | data &= readinputport(7); |
| 135 | data &= input_port_read_indexed(machine, 7); |
| 136 | 136 | if ((offset & 0x8000) == 0) |
| 137 | | data &= readinputport(8); |
| 137 | data &= input_port_read_indexed(machine, 8); |
| 138 | 138 | if (video_screen_get_refresh(screen) > 55) |
| 139 | 139 | data &= ~0x40; |
| 140 | 140 | |
| r2340 | r2341 | |
| 176 | 176 | |
| 177 | 177 | if ((offset & 1) == 0) |
| 178 | 178 | { |
| 179 | | int extra1 = readinputport(9); |
| 180 | | int extra2 = readinputport(10); |
| 179 | int extra1 = input_port_read_indexed(machine, 9); |
| 180 | int extra2 = input_port_read_indexed(machine, 10); |
| 181 | 181 | |
| 182 | 182 | ula_scancode_count = 0; |
| 183 | 183 | if ((offset & 0x0100) == 0) |
| 184 | 184 | { |
| 185 | | data &= readinputport(1) & extra1; |
| 185 | data &= input_port_read_indexed(machine, 1) & extra1; |
| 186 | 186 | /* SHIFT for extra keys */ |
| 187 | 187 | if (extra1 != 0xff || extra2 != 0xff) |
| 188 | 188 | data &= ~0x01; |
| 189 | 189 | } |
| 190 | 190 | if ((offset & 0x0200) == 0) |
| 191 | | data &= readinputport(2) & extra2; |
| 191 | data &= input_port_read_indexed(machine, 2) & extra2; |
| 192 | 192 | if ((offset & 0x0400) == 0) |
| 193 | | data &= readinputport(3); |
| 193 | data &= input_port_read_indexed(machine, 3); |
| 194 | 194 | if ((offset & 0x0800) == 0) |
| 195 | | data &= readinputport(4); |
| 195 | data &= input_port_read_indexed(machine, 4); |
| 196 | 196 | if ((offset & 0x1000) == 0) |
| 197 | | data &= readinputport(5); |
| 197 | data &= input_port_read_indexed(machine, 5); |
| 198 | 198 | if ((offset & 0x2000) == 0) |
| 199 | | data &= readinputport(6); |
| 199 | data &= input_port_read_indexed(machine, 6); |
| 200 | 200 | if ((offset & 0x4000) == 0) |
| 201 | | data &= readinputport(7); |
| 201 | data &= input_port_read_indexed(machine, 7); |
| 202 | 202 | if ((offset & 0x8000) == 0) |
| 203 | | data &= readinputport(8); |
| 203 | data &= input_port_read_indexed(machine, 8); |
| 204 | 204 | if (video_screen_get_refresh(screen) > 55) |
| 205 | 205 | data &= ~0x40; |
| 206 | 206 | |
src/mess/machine/dgn_beta.c
| r2340 | r2341 | |
| 562 | 562 | { |
| 563 | 563 | switch (Idx) |
| 564 | 564 | { |
| 565 | | case 0 : Keyboard[Idx]=readinputport(0); break; |
| 566 | | case 1 : Keyboard[Idx]=readinputport(1); break; |
| 567 | | case 2 : Keyboard[Idx]=readinputport(2); break; |
| 568 | | case 3 : Keyboard[Idx]=readinputport(3); break; |
| 569 | | case 4 : Keyboard[Idx]=readinputport(4); break; |
| 570 | | case 5 : Keyboard[Idx]=readinputport(5); break; |
| 571 | | case 6 : Keyboard[Idx]=readinputport(6); break; |
| 572 | | case 7 : Keyboard[Idx]=readinputport(7); break; |
| 573 | | case 8 : Keyboard[Idx]=readinputport(8); break; |
| 574 | | case 9 : Keyboard[Idx]=readinputport(9); break; |
| 565 | case 0 : Keyboard[Idx]=input_port_read_indexed(machine, 0); break; |
| 566 | case 1 : Keyboard[Idx]=input_port_read_indexed(machine, 1); break; |
| 567 | case 2 : Keyboard[Idx]=input_port_read_indexed(machine, 2); break; |
| 568 | case 3 : Keyboard[Idx]=input_port_read_indexed(machine, 3); break; |
| 569 | case 4 : Keyboard[Idx]=input_port_read_indexed(machine, 4); break; |
| 570 | case 5 : Keyboard[Idx]=input_port_read_indexed(machine, 5); break; |
| 571 | case 6 : Keyboard[Idx]=input_port_read_indexed(machine, 6); break; |
| 572 | case 7 : Keyboard[Idx]=input_port_read_indexed(machine, 7); break; |
| 573 | case 8 : Keyboard[Idx]=input_port_read_indexed(machine, 8); break; |
| 574 | case 9 : Keyboard[Idx]=input_port_read_indexed(machine, 9); break; |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | if(Keyboard[Idx]!=0x7F) |
| r2340 | r2341 | |
| 991 | 991 | { |
| 992 | 992 | switch (Idx) |
| 993 | 993 | { |
| 994 | | case 0 : Row=readinputport(0) /*| 0x33*/; break; |
| 995 | | case 1 : Row=readinputport(1); break; |
| 996 | | case 2 : Row=readinputport(2); break; |
| 997 | | case 3 : Row=readinputport(3); break; |
| 998 | | case 4 : Row=readinputport(4); break; |
| 999 | | case 5 : Row=readinputport(5); break; |
| 1000 | | case 6 : Row=readinputport(6); break; |
| 1001 | | case 7 : Row=readinputport(7); break; |
| 1002 | | case 8 : Row=readinputport(8); break; |
| 1003 | | case 9 : Row=readinputport(9); break; |
| 994 | case 0 : Row=input_port_read_indexed(machine, 0) /*| 0x33*/; break; |
| 995 | case 1 : Row=input_port_read_indexed(machine, 1); break; |
| 996 | case 2 : Row=input_port_read_indexed(machine, 2); break; |
| 997 | case 3 : Row=input_port_read_indexed(machine, 3); break; |
| 998 | case 4 : Row=input_port_read_indexed(machine, 4); break; |
| 999 | case 5 : Row=input_port_read_indexed(machine, 5); break; |
| 1000 | case 6 : Row=input_port_read_indexed(machine, 6); break; |
| 1001 | case 7 : Row=input_port_read_indexed(machine, 7); break; |
| 1002 | case 8 : Row=input_port_read_indexed(machine, 8); break; |
| 1003 | case 9 : Row=input_port_read_indexed(machine, 9); break; |
| 1004 | 1004 | default : Row=0x7F; break; |
| 1005 | 1005 | } |
| 1006 | 1006 | Keyboard[Idx]=Row; |
src/mess/machine/mac.c
| r2340 | r2341 | |
| 66 | 66 | |
| 67 | 67 | static TIMER_CALLBACK(mac_scanline_tick); |
| 68 | 68 | static emu_timer *mac_scanline_timer; |
| 69 | | static int scan_keyboard(void); |
| 69 | static int scan_keyboard(running_machine *machine); |
| 70 | 70 | static TIMER_CALLBACK(inquiry_timeout_func); |
| 71 | | static void keyboard_receive(int val); |
| 71 | static void keyboard_receive(running_machine *machine, int val); |
| 72 | 72 | static READ8_HANDLER(mac_via_in_a); |
| 73 | 73 | static READ8_HANDLER(mac_via_in_b); |
| 74 | 74 | static WRITE8_HANDLER(mac_via_out_a); |
| r2340 | r2341 | |
| 285 | 285 | static int keycode_buf[2]; |
| 286 | 286 | static int keycode_buf_index; |
| 287 | 287 | |
| 288 | | static int scan_keyboard() |
| 288 | static int scan_keyboard(running_machine *machine) |
| 289 | 289 | { |
| 290 | 290 | int i, j; |
| 291 | 291 | int keybuf; |
| r2340 | r2341 | |
| 298 | 298 | |
| 299 | 299 | for (i=0; i<7; i++) |
| 300 | 300 | { |
| 301 | | keybuf = readinputport(i+3); |
| 301 | keybuf = input_port_read_indexed(machine, i+3); |
| 302 | 302 | |
| 303 | 303 | if (keybuf != key_matrix[i]) |
| 304 | 304 | { |
| r2340 | r2341 | |
| 430 | 430 | { |
| 431 | 431 | kbd_receive = FALSE; |
| 432 | 432 | /* Process the command received from mac */ |
| 433 | | keyboard_receive(kbd_shift_reg & 0xff); |
| 433 | keyboard_receive(machine, kbd_shift_reg & 0xff); |
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | 436 | { |
| r2340 | r2341 | |
| 478 | 478 | /* |
| 479 | 479 | called when a command is received from the mac |
| 480 | 480 | */ |
| 481 | | static void keyboard_receive(int val) |
| 481 | static void keyboard_receive(running_machine *machine, int val) |
| 482 | 482 | { |
| 483 | 483 | switch (val) |
| 484 | 484 | { |
| r2340 | r2341 | |
| 487 | 487 | if (LOG_KEYBOARD) |
| 488 | 488 | logerror("keyboard command : inquiry\n"); |
| 489 | 489 | |
| 490 | | keyboard_reply = scan_keyboard(); |
| 490 | keyboard_reply = scan_keyboard(machine); |
| 491 | 491 | if (keyboard_reply == 0x7B) |
| 492 | 492 | { |
| 493 | 493 | /* if NULL, wait until key pressed or timeout */ |
| r2340 | r2341 | |
| 501 | 501 | if (LOG_KEYBOARD) |
| 502 | 502 | logerror("keyboard command : instant\n"); |
| 503 | 503 | |
| 504 | | kbd_shift_out(scan_keyboard()); |
| 504 | kbd_shift_out(scan_keyboard(machine)); |
| 505 | 505 | break; |
| 506 | 506 | |
| 507 | 507 | case 0x16: |
| r2340 | r2341 | |
| 565 | 565 | int new_mx, new_my; |
| 566 | 566 | int x_needs_update = 0, y_needs_update = 0; |
| 567 | 567 | |
| 568 | | new_mx = readinputport(1); |
| 569 | | new_my = readinputport(2); |
| 568 | new_mx = input_port_read_indexed(machine, 1); |
| 569 | new_my = input_port_read_indexed(machine, 2); |
| 570 | 570 | |
| 571 | 571 | /* see if it moved in the x coord */ |
| 572 | 572 | if (new_mx != last_mx) |
| r2340 | r2341 | |
| 1206 | 1206 | val |= 0x20; |
| 1207 | 1207 | if (mouse_bit_x) /* Mouse X2 */ |
| 1208 | 1208 | val |= 0x10; |
| 1209 | | if ((readinputport(0) & 0x01) == 0) |
| 1209 | if ((input_port_read_indexed(machine, 0) & 0x01) == 0) |
| 1210 | 1210 | val |= 0x08; |
| 1211 | 1211 | } |
| 1212 | 1212 | if (rtc_data_out) |
| r2340 | r2341 | |
| 1419 | 1419 | ncr5380_init(&macplus_5380intf); |
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | | static void mac_vblank_irq(void) |
| 1422 | static void mac_vblank_irq(running_machine *machine) |
| 1423 | 1423 | { |
| 1424 | 1424 | static int irq_count = 0, ca1_data = 0, ca2_data = 0; |
| 1425 | 1425 | |
| 1426 | 1426 | /* handle keyboard */ |
| 1427 | 1427 | if (kbd_comm == TRUE) |
| 1428 | 1428 | { |
| 1429 | | int keycode = scan_keyboard(); |
| 1429 | int keycode = scan_keyboard(machine); |
| 1430 | 1430 | |
| 1431 | 1431 | if (keycode != 0x7B) |
| 1432 | 1432 | { |
| r2340 | r2341 | |
| 1467 | 1467 | |
| 1468 | 1468 | scanline = video_screen_get_vpos(machine->primary_screen); |
| 1469 | 1469 | if (scanline == MAC_V_VIS) |
| 1470 | | mac_vblank_irq(); |
| 1470 | mac_vblank_irq(machine); |
| 1471 | 1471 | |
| 1472 | 1472 | /* check for mouse changes at 10 irqs per frame */ |
| 1473 | 1473 | if (!(scanline % 10)) |
src/mess/machine/adam.c
| r2340 | r2341 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" |
| 10 | 11 | #include "video/tms9928a.h" |
| 11 | 12 | #include "includes/adam.h" |
| 12 | 13 | #include "devices/cartslot.h" |
| r2340 | r2341 | |
| 115 | 116 | //logerror("Exploring Keyboard.............\n"); |
| 116 | 117 | for(i=0;i<=255;i++) {if (KbRepeatTable[i]>0) KbRepeatTable[i]++;} /* Update repeat table */ |
| 117 | 118 | |
| 118 | | keyboard[0] = readinputportbytag("keyboard_1"); |
| 119 | | keyboard[1] = readinputportbytag("keyboard_2"); |
| 120 | | keyboard[2] = readinputportbytag("keyboard_3"); |
| 121 | | keyboard[3] = readinputportbytag("keyboard_4"); |
| 122 | | keyboard[4] = readinputportbytag("keyboard_5"); |
| 123 | | keyboard[5] = readinputportbytag("keyboard_6"); |
| 124 | | keyboard[6] = readinputportbytag("keyboard_7"); |
| 125 | | keyboard[7] = readinputportbytag("keyboard_8"); |
| 126 | | keyboard[8] = readinputportbytag("keyboard_9"); |
| 127 | | keyboard[9] = readinputportbytag("keyboard_10"); |
| 119 | keyboard[0] = input_port_read(Machine, "keyboard_1"); |
| 120 | keyboard[1] = input_port_read(Machine, "keyboard_2"); |
| 121 | keyboard[2] = input_port_read(Machine, "keyboard_3"); |
| 122 | keyboard[3] = input_port_read(Machine, "keyboard_4"); |
| 123 | keyboard[4] = input_port_read(Machine, "keyboard_5"); |
| 124 | keyboard[5] = input_port_read(Machine, "keyboard_6"); |
| 125 | keyboard[6] = input_port_read(Machine, "keyboard_7"); |
| 126 | keyboard[7] = input_port_read(Machine, "keyboard_8"); |
| 127 | keyboard[8] = input_port_read(Machine, "keyboard_9"); |
| 128 | keyboard[9] = input_port_read(Machine, "keyboard_10"); |
| 128 | 129 | |
| 129 | 130 | /* Reference: Appendix of COLECO ADAM TECHNICAL MANUAL at http://drushel.cwru.edu/atm/atm.html */ |
| 130 | 131 | |
| r2340 | r2341 | |
| 800 | 801 | READ8_HANDLER ( adam_paddle_r ) |
| 801 | 802 | { |
| 802 | 803 | |
| 803 | | if (!(readinputportbytag("controllers") & 0x0F)) return (0xFF); /* If no controllers enabled */ |
| 804 | if (!(input_port_read(machine, "controllers") & 0x0F)) return (0xFF); /* If no controllers enabled */ |
| 804 | 805 | /* Player 1 */ |
| 805 | 806 | if ((offset & 0x02)==0) |
| 806 | 807 | { |
| r2340 | r2341 | |
| 809 | 810 | { |
| 810 | 811 | int inport0,inport1,inport6,data; |
| 811 | 812 | |
| 812 | | inport0 = readinputportbytag("controller1_keypad1"); |
| 813 | | inport1 = readinputportbytag("controller1_keypad2"); |
| 814 | | inport6 = readinputportbytag("controllers"); |
| 813 | inport0 = input_port_read(machine, "controller1_keypad1"); |
| 814 | inport1 = input_port_read(machine, "controller1_keypad2"); |
| 815 | inport6 = input_port_read(machine, "controllers"); |
| 815 | 816 | |
| 816 | 817 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 817 | 818 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| r2340 | r2341 | |
| 838 | 839 | /* Joystick and fire 2 (SAC Red Button) */ |
| 839 | 840 | else |
| 840 | 841 | { |
| 841 | | int data = readinputportbytag("controller1_joystick") & 0xCF; |
| 842 | | int inport6 = readinputportbytag("controllers"); |
| 842 | int data = input_port_read(machine, "controller1_joystick") & 0xCF; |
| 843 | int inport6 = input_port_read(machine, "controllers"); |
| 843 | 844 | |
| 844 | 845 | if (inport6&0x07) /* If Extra Contollers enabled */ |
| 845 | 846 | { |
| r2340 | r2341 | |
| 859 | 860 | { |
| 860 | 861 | int inport3,inport4,data; |
| 861 | 862 | |
| 862 | | inport3 = readinputportbytag("controller2_keypad1"); |
| 863 | | inport4 = readinputportbytag("controller2_keypad2"); |
| 863 | inport3 = input_port_read(machine, "controller2_keypad1"); |
| 864 | inport4 = input_port_read(machine, "controller2_keypad2"); |
| 864 | 865 | |
| 865 | 866 | /* Numeric pad buttons are not independent on a real ColecoVision, if you push more |
| 866 | 867 | than one, a real ColecoVision think that it is a third button, so we are going to emulate |
| r2340 | r2341 | |
| 885 | 886 | /* Joystick and fire 2*/ |
| 886 | 887 | else |
| 887 | 888 | { |
| 888 | | int data = readinputportbytag("controller2_joystick") & 0xCF; |
| 889 | | int inport6 = readinputportbytag("controllers"); |
| 889 | int data = input_port_read(machine, "controller2_joystick") & 0xCF; |
| 890 | int inport6 = input_port_read(machine, "controllers"); |
| 890 | 891 | |
| 891 | 892 | if (inport6&0x02) /* If Roller Controller enabled */ |
| 892 | 893 | { |
src/mess/machine/cbmb.c
| r2340 | r2341 | |
| 110 | 110 | static int cbmb_keyboard_line_a(void) |
| 111 | 111 | { |
| 112 | 112 | int data=0; |
| 113 | | if (!(cbmb_keyline_c&1)) data|=readinputport(0); |
| 114 | | if (!(cbmb_keyline_c&2)) data|=readinputport(2); |
| 115 | | if (!(cbmb_keyline_c&4)) data|=readinputport(4); |
| 116 | | if (!(cbmb_keyline_c&8)) data|=readinputport(6); |
| 117 | | if (!(cbmb_keyline_c&0x10)) data|=readinputport(8); |
| 118 | | if (!(cbmb_keyline_c&0x20)) data|=readinputport(10); |
| 113 | if (!(cbmb_keyline_c&1)) data|=input_port_read_indexed(Machine, 0); |
| 114 | if (!(cbmb_keyline_c&2)) data|=input_port_read_indexed(Machine, 2); |
| 115 | if (!(cbmb_keyline_c&4)) data|=input_port_read_indexed(Machine, 4); |
| 116 | if (!(cbmb_keyline_c&8)) data|=input_port_read_indexed(Machine, 6); |
| 117 | if (!(cbmb_keyline_c&0x10)) data|=input_port_read_indexed(Machine, 8); |
| 118 | if (!(cbmb_keyline_c&0x20)) data|=input_port_read_indexed(Machine, 10); |
| 119 | 119 | |
| 120 | 120 | return data^0xff; |
| 121 | 121 | } |
| r2340 | r2341 | |
| 123 | 123 | static int cbmb_keyboard_line_b(void) |
| 124 | 124 | { |
| 125 | 125 | int data=0; |
| 126 | | if (!(cbmb_keyline_c&1)) data|=readinputport(1); |
| 127 | | if (!(cbmb_keyline_c&2)) data|=readinputport(3); |
| 128 | | if (!(cbmb_keyline_c&4)) data|=readinputport(5); |
| 129 | | if (!(cbmb_keyline_c&8)) data|=readinputport(7); |
| 130 | | if (!(cbmb_keyline_c&0x10)) data|=readinputport(9) | ((readinputport(12)&0x04) ? 1 : 0 ); |
| 131 | | if (!(cbmb_keyline_c&0x20)) data|=readinputport(11); |
| 126 | if (!(cbmb_keyline_c&1)) data|=input_port_read_indexed(Machine, 1); |
| 127 | if (!(cbmb_keyline_c&2)) data|=input_port_read_indexed(Machine, 3); |
| 128 | if (!(cbmb_keyline_c&4)) data|=input_port_read_indexed(Machine, 5); |
| 129 | if (!(cbmb_keyline_c&8)) data|=input_port_read_indexed(Machine, 7); |
| 130 | if (!(cbmb_keyline_c&0x10)) data|=input_port_read_indexed(Machine, 9) | ((input_port_read_indexed(Machine, 12)&0x04) ? 1 : 0 ); |
| 131 | if (!(cbmb_keyline_c&0x20)) data|=input_port_read_indexed(Machine, 11); |
| 132 | 132 | |
| 133 | 133 | return data^0xff; |
| 134 | 134 | } |
| r2340 | r2341 | |
| 137 | 137 | { |
| 138 | 138 | int data=0; |
| 139 | 139 | |
| 140 | | if ( (readinputport(0)&~cbmb_keyline_a)|| |
| 141 | | (readinputport(1)&~cbmb_keyline_b)) data|=1; |
| 142 | | if ( (readinputport(2)&~cbmb_keyline_a)|| |
| 143 | | (readinputport(3)&~cbmb_keyline_b)) data|=2; |
| 144 | | if ( (readinputport(4)&~cbmb_keyline_a)|| |
| 145 | | (readinputport(5)&~cbmb_keyline_b)) data|=4; |
| 146 | | if ( (readinputport(6)&~cbmb_keyline_a)|| |
| 147 | | (readinputport(7)&~cbmb_keyline_b)) data|=8; |
| 148 | | if ( (readinputport(8)&~cbmb_keyline_a)|| |
| 149 | | ((readinputport(9)|((readinputport(12)&0x04)?1:0))&~cbmb_keyline_b)) data|=0x10; |
| 150 | | if ( (readinputport(10)&~cbmb_keyline_a)|| |
| 151 | | (readinputport(11)&~cbmb_keyline_b)) data|=0x20; |
| 140 | if ( (input_port_read_indexed(Machine, 0)&~cbmb_keyline_a)|| |
| 141 | (input_port_read_indexed(Machine, 1)&~cbmb_keyline_b)) data|=1; |
| 142 | if ( (input_port_read_indexed(Machine, 2)&~cbmb_keyline_a)|| |
| 143 | (input_port_read_indexed(Machine, 3)&~cbmb_keyline_b)) data|=2; |
| 144 | if ( (input_port_read_indexed(Machine, 4)&~cbmb_keyline_a)|| |
| 145 | (input_port_read_indexed(Machine, 5)&~cbmb_keyline_b)) data|=4; |
| 146 | if ( (input_port_read_indexed(Machine, 6)&~cbmb_keyline_a)|| |
| 147 | (input_port_read_indexed(Machine, 7)&~cbmb_keyline_b)) data|=8; |
| 148 | if ( (input_port_read_indexed(Machine, 8)&~cbmb_keyline_a)|| |
| 149 | ((input_port_read_indexed(Machine, 9)|((input_port_read_indexed(Machine, 12)&0x04)?1:0))&~cbmb_keyline_b)) data|=0x10; |
| 150 | if ( (input_port_read_indexed(Machine, 10)&~cbmb_keyline_a)|| |
| 151 | (input_port_read_indexed(Machine, 11)&~cbmb_keyline_b)) data|=0x20; |
| 152 | 152 | |
| 153 | 153 | if (!cbm500) { |
| 154 | 154 | if (!cbm_ntsc) data|=0x40; |
| r2340 | r2341 | |
| 371 | 371 | |
| 372 | 372 | vic2_frame_interrupt (machine, 0); |
| 373 | 373 | |
| 374 | | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , (readinputport(12)&0x04) ? 1 : 0); |
| 374 | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , (input_port_read_indexed(machine, 12)&0x04) ? 1 : 0); |
| 375 | 375 | #if 0 |
| 376 | 376 | set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0); |
| 377 | 377 | #endif |
src/mess/machine/nes.c
| r2340 | r2341 | |
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" |
| 2 | 3 | #include "cpu/m6502/m6502.h" |
| 3 | 4 | #include "video/ppu2c0x.h" |
| 4 | 5 | #include "includes/nes.h" |
| r2340 | r2341 | |
| 229 | 230 | retVal |= ((in_0.i0 >> in_0.shift) & 0x01); |
| 230 | 231 | |
| 231 | 232 | /* Check the configuration to see what's connected */ |
| 232 | | cfg = readinputport(PORT_CONFIG1); |
| 233 | cfg = input_port_read_indexed(machine, PORT_CONFIG1); |
| 233 | 234 | |
| 234 | 235 | if (((cfg & 0x000f) == 0x0002) || ((cfg & 0x000f) == 0x0003)) |
| 235 | 236 | { |
| r2340 | r2341 | |
| 263 | 264 | retVal |= ((in_1.i0 >> in_1.shift) & 0x01); |
| 264 | 265 | |
| 265 | 266 | /* Check the fake dip to see what's connected */ |
| 266 | | cfg = readinputport(PORT_CONFIG1); |
| 267 | cfg = input_port_read_indexed(machine, PORT_CONFIG1); |
| 267 | 268 | |
| 268 | 269 | if (((cfg & 0x00f0) == 0x0020) || ((cfg & 0x00f0) == 0x0030)) |
| 269 | 270 | { |
| r2340 | r2341 | |
| 309 | 310 | { |
| 310 | 311 | case 0x01: /* gamepad */ |
| 311 | 312 | if (pad_port >= 0) |
| 312 | | vals->i0 = readinputport(pad_port); |
| 313 | vals->i0 = input_port_read_indexed(Machine, pad_port); |
| 313 | 314 | break; |
| 314 | 315 | |
| 315 | 316 | case 0x02: /* zapper 1 */ |
| 316 | 317 | if (supports_zapper) |
| 317 | 318 | { |
| 318 | | vals->i0 = readinputport(PORT_ZAPPER0_T); |
| 319 | | vals->i1 = readinputport(PORT_ZAPPER0_X); |
| 320 | | vals->i2 = readinputport(PORT_ZAPPER0_Y); |
| 319 | vals->i0 = input_port_read_indexed(Machine, PORT_ZAPPER0_T); |
| 320 | vals->i1 = input_port_read_indexed(Machine, PORT_ZAPPER0_X); |
| 321 | vals->i2 = input_port_read_indexed(Machine, PORT_ZAPPER0_Y); |
| 321 | 322 | } |
| 322 | 323 | break; |
| 323 | 324 | |
| 324 | 325 | case 0x03: /* zapper 2 */ |
| 325 | 326 | if (supports_zapper) |
| 326 | 327 | { |
| 327 | | vals->i0 = readinputport(PORT_ZAPPER1_T); |
| 328 | | vals->i1 = readinputport(PORT_ZAPPER1_X); |
| 329 | | vals->i2 = readinputport(PORT_ZAPPER1_Y); |
| 328 | vals->i0 = input_port_read_indexed(Machine, PORT_ZAPPER1_T); |
| 329 | vals->i1 = input_port_read_indexed(Machine, PORT_ZAPPER1_X); |
| 330 | vals->i2 = input_port_read_indexed(Machine, PORT_ZAPPER1_Y); |
| 330 | 331 | } |
| 331 | 332 | break; |
| 332 | 333 | |
| 333 | 334 | case 0x04: /* arkanoid paddle */ |
| 334 | 335 | if (paddle_port >= 0) |
| 335 | | vals->i0 = (UINT8) ((UINT8) readinputport (paddle_port) + (UINT8)0x52) ^ 0xff; |
| 336 | vals->i0 = (UINT8) ((UINT8) input_port_read_indexed(Machine, paddle_port) + (UINT8)0x52) ^ 0xff; |
| 336 | 337 | break; |
| 337 | 338 | } |
| 338 | 339 | } |
| r2340 | r2341 | |
| 355 | 356 | in_1.shift = 0; |
| 356 | 357 | |
| 357 | 358 | /* Check the configuration to see what's connected */ |
| 358 | | cfg = readinputport(PORT_CONFIG1); |
| 359 | cfg = input_port_read_indexed(machine, PORT_CONFIG1); |
| 359 | 360 | |
| 360 | 361 | /* Read the input devices */ |
| 361 | 362 | nes_read_input_device(cfg >> 0, &in_0, PORT_PAD0, TRUE, -1); |
src/mess/machine/thomson.c
| r2340 | r2341 | |
| 370 | 370 | |
| 371 | 371 | static READ8_HANDLER ( to7_timer_port_in ) |
| 372 | 372 | { |
| 373 | | int lightpen = (readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 373 | int lightpen = (input_port_read_indexed(machine, THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 374 | 374 | int cass = to7_get_cassette() ? 0x80 : 0; |
| 375 | 375 | return lightpen | cass; |
| 376 | 376 | } |
| r2340 | r2341 | |
| 469 | 469 | for ( i = 0; i < 8; i++ ) |
| 470 | 470 | { |
| 471 | 471 | if ( ! (keyline & (1 << i)) ) |
| 472 | | val &= readinputport( THOM_INPUT_KEYBOARD + i ); |
| 472 | val &= input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + i ); |
| 473 | 473 | } |
| 474 | 474 | return val; |
| 475 | 475 | } |
| r2340 | r2341 | |
| 758 | 758 | |
| 759 | 759 | READ8_HANDLER ( to7_modem_mea8000_r ) |
| 760 | 760 | { |
| 761 | | if ( readinputport( THOM_INPUT_MCONFIG ) & 1 ) |
| 761 | if ( input_port_read_indexed(machine, THOM_INPUT_MCONFIG ) & 1 ) |
| 762 | 762 | return mea8000_r( machine, offset ); |
| 763 | 763 | else |
| 764 | 764 | { |
| r2340 | r2341 | |
| 774 | 774 | |
| 775 | 775 | WRITE8_HANDLER ( to7_modem_mea8000_w ) |
| 776 | 776 | { |
| 777 | | if ( readinputport( THOM_INPUT_MCONFIG ) & 1 ) |
| 777 | if ( input_port_read_indexed(machine, THOM_INPUT_MCONFIG ) & 1 ) |
| 778 | 778 | mea8000_w( machine, offset, data ); |
| 779 | 779 | else |
| 780 | 780 | { |
| r2340 | r2341 | |
| 822 | 822 | static UINT8 to7_get_mouse_signal( void ) |
| 823 | 823 | { |
| 824 | 824 | UINT8 xa, xb, ya, yb; |
| 825 | | UINT16 dx = readinputport( THOM_INPUT_GAME + 2 ); /* x axis */ |
| 826 | | UINT16 dy = readinputport( THOM_INPUT_GAME + 3 ); /* y axis */ |
| 825 | UINT16 dx = input_port_read_indexed(Machine, THOM_INPUT_GAME + 2 ); /* x axis */ |
| 826 | UINT16 dy = input_port_read_indexed(Machine, THOM_INPUT_GAME + 3 ); /* y axis */ |
| 827 | 827 | xa = ((dx + 1) & 3) <= 1; |
| 828 | 828 | xb = (dx & 3) <= 1; |
| 829 | 829 | ya = ((dy + 1) & 3) <= 1; |
| r2340 | r2341 | |
| 843 | 843 | static READ8_HANDLER ( to7_game_porta_in ) |
| 844 | 844 | { |
| 845 | 845 | UINT8 data; |
| 846 | | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) |
| 846 | if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 ) |
| 847 | 847 | { |
| 848 | 848 | /* mouse */ |
| 849 | 849 | data = to7_get_mouse_signal() & 0x0c; /* XB, YB */ |
| 850 | | data |= readinputport( THOM_INPUT_GAME + 4 ) & 3; /* buttons */ |
| 850 | data |= input_port_read_indexed(machine, THOM_INPUT_GAME + 4 ) & 3; /* buttons */ |
| 851 | 851 | } |
| 852 | 852 | else |
| 853 | 853 | { |
| 854 | 854 | /* joystick */ |
| 855 | | data = readinputport( THOM_INPUT_GAME ); |
| 855 | data = input_port_read_indexed(machine, THOM_INPUT_GAME ); |
| 856 | 856 | /* bit 0=0 => P1 up bit 4=0 => P2 up |
| 857 | 857 | bit 1=0 => P1 down bit 5=0 => P2 down |
| 858 | 858 | bit 2=0 => P1 left bit 6=0 => P2 left |
| r2340 | r2341 | |
| 884 | 884 | static READ8_HANDLER ( to7_game_portb_in ) |
| 885 | 885 | { |
| 886 | 886 | UINT8 data; |
| 887 | | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) |
| 887 | if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 ) |
| 888 | 888 | { |
| 889 | 889 | /* mouse */ |
| 890 | 890 | UINT8 mouse = to7_get_mouse_signal(); |
| r2340 | r2341 | |
| 901 | 901 | /* bits 2-3: action buttons B (0=pressed) */ |
| 902 | 902 | /* bits 4-5: unused (ouput) */ |
| 903 | 903 | /* bits 0-1: unknown! */ |
| 904 | | data = readinputport( THOM_INPUT_GAME + 1 ); |
| 904 | data = input_port_read_indexed(machine, THOM_INPUT_GAME + 1 ); |
| 905 | 905 | } |
| 906 | 906 | return data; |
| 907 | 907 | } |
| r2340 | r2341 | |
| 938 | 938 | /* this should be called periodically */ |
| 939 | 939 | static TIMER_CALLBACK(to7_game_update_cb) |
| 940 | 940 | { |
| 941 | | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) |
| 941 | if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 ) |
| 942 | 942 | { |
| 943 | 943 | /* mouse */ |
| 944 | 944 | UINT8 mouse = to7_get_mouse_signal(); |
| r2340 | r2341 | |
| 948 | 948 | else |
| 949 | 949 | { |
| 950 | 950 | /* joystick */ |
| 951 | | UINT8 in = readinputport( THOM_INPUT_GAME ); |
| 951 | UINT8 in = input_port_read_indexed(machine, THOM_INPUT_GAME ); |
| 952 | 952 | pia_set_input_cb2( THOM_PIA_GAME, (in & 0x80) ? 1 : 0 ); /* P2 action A */ |
| 953 | 953 | pia_set_input_ca2( THOM_PIA_GAME, (in & 0x40) ? 1 : 0 ); /* P1 action A */ |
| 954 | 954 | pia_set_input_cb1( THOM_PIA_GAME, (in & 0x08) ? 1 : 0 ); /* P2 action B */ |
| r2340 | r2341 | |
| 1352 | 1352 | { |
| 1353 | 1353 | /* keyboard */ |
| 1354 | 1354 | int keyline = pia_get_output_b( THOM_PIA_SYS ) & 7; |
| 1355 | | return readinputport( THOM_INPUT_KEYBOARD + 7 - keyline ); |
| 1355 | return input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + 7 - keyline ); |
| 1356 | 1356 | } |
| 1357 | 1357 | |
| 1358 | 1358 | |
| r2340 | r2341 | |
| 1617 | 1617 | { |
| 1618 | 1618 | return |
| 1619 | 1619 | (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ |
| 1620 | | ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0) |
| 1620 | ((input_port_read_indexed(machine, THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 0x20 : 0) |
| 1621 | 1621 | /* bit 5: lightpen button */; |
| 1622 | 1622 | } |
| 1623 | 1623 | |
| r2340 | r2341 | |
| 1635 | 1635 | UINT8 portb = pia_get_output_b( THOM_PIA_SYS ); |
| 1636 | 1636 | int col = (portb >> 1) & 7; /* key column */ |
| 1637 | 1637 | int lin = 7 - ((portb >> 4) & 7); /* key line */ |
| 1638 | | return ( readinputport( THOM_INPUT_KEYBOARD+lin ) & (1 << col) ) ? 0x80 : 0; |
| 1638 | return ( input_port_read_indexed(machine, THOM_INPUT_KEYBOARD+lin ) & (1 << col) ) ? 0x80 : 0; |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | |
| r2340 | r2341 | |
| 2269 | 2269 | |
| 2270 | 2270 | for ( line = 0; line < 10; line++ ) |
| 2271 | 2271 | { |
| 2272 | | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2272 | UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line ); |
| 2273 | 2273 | |
| 2274 | 2274 | if ( line == 7 || line == 9 ) |
| 2275 | 2275 | port |= 1; /* shift & control */ |
| r2340 | r2341 | |
| 2494 | 2494 | /* returns the ASCII code for the key, or 0 for no key */ |
| 2495 | 2495 | static int to9_kbd_get_key( void ) |
| 2496 | 2496 | { |
| 2497 | | int control = ! (readinputport( THOM_INPUT_KEYBOARD + 7 ) & 1); |
| 2498 | | int shift = ! (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1); |
| 2497 | int control = ! (input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + 7 ) & 1); |
| 2498 | int shift = ! (input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + 9 ) & 1); |
| 2499 | 2499 | int key = -1, line, bit; |
| 2500 | 2500 | |
| 2501 | 2501 | for ( line = 0; line < 10; line++ ) |
| 2502 | 2502 | { |
| 2503 | | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2503 | UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line ); |
| 2504 | 2504 | |
| 2505 | 2505 | if ( line == 7 || line == 9 ) |
| 2506 | 2506 | port |= 1; /* shift & control */ |
| r2340 | r2341 | |
| 2591 | 2591 | |
| 2592 | 2592 | case 1: /* x axis */ |
| 2593 | 2593 | { |
| 2594 | | int newx = readinputport( THOM_INPUT_GAME + 2 ); |
| 2594 | int newx = input_port_read_indexed(machine, THOM_INPUT_GAME + 2 ); |
| 2595 | 2595 | UINT8 data = ( (newx - to9_mouse_x) & 0xf ) - 8; |
| 2596 | 2596 | to9_kbd_send( data, 1 ); |
| 2597 | 2597 | to9_mouse_x = newx; |
| r2340 | r2341 | |
| 2600 | 2600 | |
| 2601 | 2601 | case 2: /* y axis */ |
| 2602 | 2602 | { |
| 2603 | | int newy = readinputport( THOM_INPUT_GAME + 3 ); |
| 2603 | int newy = input_port_read_indexed(machine, THOM_INPUT_GAME + 3 ); |
| 2604 | 2604 | UINT8 data = ( (newy - to9_mouse_y) & 0xf ) - 8; |
| 2605 | 2605 | to9_kbd_send( data, 1 ); |
| 2606 | 2606 | to9_mouse_y = newy; |
| r2340 | r2341 | |
| 2609 | 2609 | |
| 2610 | 2610 | case 3: /* axis overflow & buttons */ |
| 2611 | 2611 | { |
| 2612 | | int b = readinputport( THOM_INPUT_GAME + 4 ); |
| 2612 | int b = input_port_read_indexed(machine, THOM_INPUT_GAME + 4 ); |
| 2613 | 2613 | UINT8 data = 0; |
| 2614 | 2614 | if ( b & 1 ) data |= 1; |
| 2615 | 2615 | if ( b & 2 ) data |= 4; |
| r2340 | r2341 | |
| 2901 | 2901 | { |
| 2902 | 2902 | int line, bit; |
| 2903 | 2903 | |
| 2904 | | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) |
| 2904 | if ( input_port_read_indexed(Machine, THOM_INPUT_CONFIG ) & 2 ) |
| 2905 | 2905 | return 0; /* disabled */ |
| 2906 | 2906 | |
| 2907 | 2907 | for ( line = 0; line < 10; line++ ) |
| 2908 | 2908 | { |
| 2909 | | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2909 | UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line ); |
| 2910 | 2910 | |
| 2911 | 2911 | if ( line == 7 || line == 9 ) |
| 2912 | 2912 | port |= 1; /* shift & control */ |
| r2340 | r2341 | |
| 2926 | 2926 | /* keyboard scan & return keycode (or -1) */ |
| 2927 | 2927 | static int to8_kbd_get_key( void ) |
| 2928 | 2928 | { |
| 2929 | | int control = (readinputport( THOM_INPUT_KEYBOARD + 7 ) & 1) ? 0 : 0x100; |
| 2930 | | int shift = (readinputport( THOM_INPUT_KEYBOARD + 9 ) & 1) ? 0 : 0x080; |
| 2929 | int control = (input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + 7 ) & 1) ? 0 : 0x100; |
| 2930 | int shift = (input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + 9 ) & 1) ? 0 : 0x080; |
| 2931 | 2931 | int key = -1, line, bit; |
| 2932 | 2932 | |
| 2933 | | if ( readinputport( THOM_INPUT_CONFIG ) & 2 ) |
| 2933 | if ( input_port_read_indexed(Machine, THOM_INPUT_CONFIG ) & 2 ) |
| 2934 | 2934 | return -1; /* disabled */ |
| 2935 | 2935 | |
| 2936 | 2936 | for ( line = 0; line < 10; line++ ) |
| 2937 | 2937 | { |
| 2938 | | UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line ); |
| 2938 | UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line ); |
| 2939 | 2939 | |
| 2940 | 2940 | if ( line == 7 || line == 9 ) |
| 2941 | 2941 | port |= 1; /* shift & control */ |
| r2340 | r2341 | |
| 3625 | 3625 | |
| 3626 | 3626 | static READ8_HANDLER ( to8_timer_port_in ) |
| 3627 | 3627 | { |
| 3628 | | int lightpen = (readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 3628 | int lightpen = (input_port_read_indexed(machine, THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 3629 | 3629 | int cass = to7_get_cassette() ? 0x80 : 0; |
| 3630 | 3630 | int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 3631 | 3631 | int lock = to8_kbd_caps ? 0 : 8; /* undocumented! */ |
| r2340 | r2341 | |
| 3816 | 3816 | |
| 3817 | 3817 | static READ8_HANDLER ( to9p_timer_port_in ) |
| 3818 | 3818 | { |
| 3819 | | int lightpen = (readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 3819 | int lightpen = (input_port_read_indexed(machine, THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0; |
| 3820 | 3820 | int cass = to7_get_cassette() ? 0x80 : 0; |
| 3821 | 3821 | int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40; |
| 3822 | 3822 | return lightpen | cass | dtr; |
| r2340 | r2341 | |
| 4137 | 4137 | static TIMER_CALLBACK(mo6_game_update_cb) |
| 4138 | 4138 | { |
| 4139 | 4139 | /* unlike the TO8, CB1 & CB2 are not connected to buttons */ |
| 4140 | | if ( readinputport( THOM_INPUT_CONFIG ) & 1 ) |
| 4140 | if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 ) |
| 4141 | 4141 | { |
| 4142 | 4142 | UINT8 mouse = to7_get_mouse_signal(); |
| 4143 | 4143 | pia_set_input_ca1( THOM_PIA_GAME, mouse & 1 ); /* XA */ |
| r2340 | r2341 | |
| 4146 | 4146 | else |
| 4147 | 4147 | { |
| 4148 | 4148 | /* joystick */ |
| 4149 | | UINT8 in = readinputport( THOM_INPUT_GAME ); |
| 4149 | UINT8 in = input_port_read_indexed(machine, THOM_INPUT_GAME ); |
| 4150 | 4150 | pia_set_input_ca1( THOM_PIA_GAME, in & 0x04 ); /* P1 action B */ |
| 4151 | 4151 | pia_set_input_ca2( THOM_PIA_GAME, in & 0x40 ); /* P1 action A */ |
| 4152 | 4152 | } |
| r2340 | r2341 | |
| 4186 | 4186 | return |
| 4187 | 4187 | (mo5_get_cassette() ? 0x80 : 0) | /* bit 7: cassette input */ |
| 4188 | 4188 | 8 | /* bit 3: kbd-line float up to 1 */ |
| 4189 | | ((readinputport( THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0); |
| 4189 | ((input_port_read_indexed(machine, THOM_INPUT_LIGHTPEN + 2 ) & 1) ? 2 : 0); |
| 4190 | 4190 | /* bit 1: lightpen button */; |
| 4191 | 4191 | } |
| 4192 | 4192 | |
| r2340 | r2341 | |
| 4204 | 4204 | lin = 8; /* A bit 3: 9-th kbd line select */ |
| 4205 | 4205 | |
| 4206 | 4206 | return |
| 4207 | | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) |
| 4207 | ( input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) |
| 4208 | 4208 | ? 0x80 : 0; /* bit 7: key up */ |
| 4209 | 4209 | } |
| 4210 | 4210 | |
| r2340 | r2341 | |
| 4617 | 4617 | int col = (portb >> 4) & 7; /* B bits 4-6: kbd column */ |
| 4618 | 4618 | int lin = (portb >> 1) & 7; /* B bits 1-3: kbd line */ |
| 4619 | 4619 | return |
| 4620 | | ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) |
| 4620 | ( input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + lin ) & (1 << col) ) |
| 4621 | 4621 | ? 0x80 : 0; /* bit 7: key up */ |
| 4622 | 4622 | } |
| 4623 | 4623 | |
src/mess/machine/sym1.c
| r2340 | r2341 | |
| 88 | 88 | int data = 0x7f; |
| 89 | 89 | |
| 90 | 90 | /* scan keypad rows */ |
| 91 | | if (!(riot_port_a & 0x80)) data &= readinputportbytag("ROW-0"); |
| 92 | | if (!(riot_port_b & 0x01)) data &= readinputportbytag("ROW-1"); |
| 93 | | if (!(riot_port_b & 0x02)) data &= readinputportbytag("ROW-2"); |
| 94 | | if (!(riot_port_b & 0x04)) data &= readinputportbytag("ROW-3"); |
| 91 | if (!(riot_port_a & 0x80)) data &= input_port_read(machine, "ROW-0"); |
| 92 | if (!(riot_port_b & 0x01)) data &= input_port_read(machine, "ROW-1"); |
| 93 | if (!(riot_port_b & 0x02)) data &= input_port_read(machine, "ROW-2"); |
| 94 | if (!(riot_port_b & 0x04)) data &= input_port_read(machine, "ROW-3"); |
| 95 | 95 | |
| 96 | 96 | /* determine column */ |
| 97 | | if ( ((riot_port_a ^ 0xff) & (readinputportbytag("ROW-0") ^ 0xff)) & 0x7f ) |
| 97 | if ( ((riot_port_a ^ 0xff) & (input_port_read(machine, "ROW-0") ^ 0xff)) & 0x7f ) |
| 98 | 98 | data &= ~0x80; |
| 99 | 99 | |
| 100 | 100 | return data; |
| r2340 | r2341 | |
| 106 | 106 | int data = 0xff; |
| 107 | 107 | |
| 108 | 108 | /* determine column */ |
| 109 | | if ( ((riot_port_a ^ 0xff) & (readinputportbytag("ROW-1") ^ 0xff)) & 0x7f ) |
| 109 | if ( ((riot_port_a ^ 0xff) & (input_port_read(machine, "ROW-1") ^ 0xff)) & 0x7f ) |
| 110 | 110 | data &= ~1; |
| 111 | 111 | |
| 112 | | if ( ((riot_port_a ^ 0xff) & (readinputportbytag("ROW-2") ^ 0xff)) & 0x3f ) |
| 112 | if ( ((riot_port_a ^ 0xff) & (input_port_read(machine, "ROW-2") ^ 0xff)) & 0x3f ) |
| 113 | 113 | data &= ~2; |
| 114 | 114 | |
| 115 | | if ( ((riot_port_a ^ 0xff) & (readinputportbytag("ROW-3") ^ 0xff)) & 0x1f ) |
| 115 | if ( ((riot_port_a ^ 0xff) & (input_port_read(machine, "ROW-3") ^ 0xff)) & 0x1f ) |
| 116 | 116 | data &= ~4; |
| 117 | 117 | |
| 118 | 118 | data &= ~0x80; // else hangs 8b02 |
| r2340 | r2341 | |
| 199 | 199 | logerror("SYM1 VIA2 W 0x%02x\n", data); |
| 200 | 200 | |
| 201 | 201 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa600, 0xa67f, 0, 0, |
| 202 | | ((readinputportbytag("WP") & 0x01) && !(data & 0x01)) ? SMH_NOP : SMH_BANK5); |
| 202 | ((input_port_read(machine, "WP") & 0x01) && !(data & 0x01)) ? SMH_NOP : SMH_BANK5); |
| 203 | 203 | |
| 204 | 204 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0x07ff, 0, 0, |
| 205 | | ((readinputportbytag("WP") & 0x02) && !(data & 0x02)) ? SMH_NOP : SMH_BANK2); |
| 205 | ((input_port_read(machine, "WP") & 0x02) && !(data & 0x02)) ? SMH_NOP : SMH_BANK2); |
| 206 | 206 | |
| 207 | 207 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0800, 0x0bff, 0, 0, |
| 208 | | ((readinputportbytag("WP") & 0x04) && !(data & 0x04)) ? SMH_NOP : SMH_BANK3); |
| 208 | ((input_port_read(machine, "WP") & 0x04) && !(data & 0x04)) ? SMH_NOP : SMH_BANK3); |
| 209 | 209 | |
| 210 | 210 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0c00, 0x0fff, 0, 0, |
| 211 | | ((readinputportbytag("WP") & 0x08) && !(data & 0x08)) ? SMH_NOP : SMH_BANK4); |
| 211 | ((input_port_read(machine, "WP") & 0x08) && !(data & 0x08)) ? SMH_NOP : SMH_BANK4); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
src/mess/machine/cgenie.c
| r2340 | r2341 | |
| 235 | 235 | /* wipe out font RAM */ |
| 236 | 236 | memset(&ROM[0x0f400], 0xff, 0x0400); |
| 237 | 237 | |
| 238 | | if( readinputport(0) & 0x80 ) |
| 238 | if( input_port_read_indexed(machine, 0) & 0x80 ) |
| 239 | 239 | { |
| 240 | 240 | logerror("cgenie floppy discs enabled\n"); |
| 241 | 241 | } |
| r2340 | r2341 | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /* copy DOS ROM, if enabled or wipe out that memory area */ |
| 248 | | if( readinputport(0) & 0x40 ) |
| 248 | if( input_port_read_indexed(machine, 0) & 0x40 ) |
| 249 | 249 | { |
| 250 | | if ( readinputport(0) & 0x080 ) |
| 250 | if ( input_port_read_indexed(machine, 0) & 0x080 ) |
| 251 | 251 | { |
| 252 | 252 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK10); |
| 253 | 253 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP); |
| r2340 | r2341 | |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /* copy EXT ROM, if enabled or wipe out that memory area */ |
| 274 | | if( readinputport(0) & 0x20 ) |
| 274 | if( input_port_read_indexed(machine, 0) & 0x20 ) |
| 275 | 275 | { |
| 276 | 276 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM); |
| 277 | 277 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM); |
| r2340 | r2341 | |
| 745 | 745 | if( port_ff_changed & FF_CAS ) /* casette port changed ? */ |
| 746 | 746 | { |
| 747 | 747 | /* virtual tape ? */ |
| 748 | | if( readinputport(0) & 0x08 ) |
| 748 | if( input_port_read_indexed(machine, 0) & 0x08 ) |
| 749 | 749 | tape_put_bit(machine); |
| 750 | 750 | else |
| 751 | 751 | DAC_data_w(0,(data & FF_CAS) ? 127:0 ); |
| r2340 | r2341 | |
| 820 | 820 | { |
| 821 | 821 | /* virtual tape ? */ |
| 822 | 822 | |
| 823 | | if( readinputport(0) & 0x08 ) |
| 823 | if( input_port_read_indexed(machine, 0) & 0x08 ) |
| 824 | 824 | tape_get_bit(); |
| 825 | 825 | |
| 826 | 826 | return port_ff; |
| r2340 | r2341 | |
| 853 | 853 | { |
| 854 | 854 | /* comparator value */ |
| 855 | 855 | psg_b_inp = 0x00; |
| 856 | | if( readinputport(9) > psg_a_out ) |
| 856 | if( input_port_read_indexed(machine, 9) > psg_a_out ) |
| 857 | 857 | psg_b_inp |= 0x80; |
| 858 | | if( readinputport(10) > psg_a_out ) |
| 858 | if( input_port_read_indexed(machine, 10) > psg_a_out ) |
| 859 | 859 | psg_b_inp |= 0x40; |
| 860 | | if( readinputport(11) > psg_a_out ) |
| 860 | if( input_port_read_indexed(machine, 11) > psg_a_out ) |
| 861 | 861 | psg_b_inp |= 0x20; |
| 862 | | if( readinputport(12) > psg_a_out ) |
| 862 | if( input_port_read_indexed(machine, 12) > psg_a_out ) |
| 863 | 863 | psg_b_inp |= 0x10; |
| 864 | 864 | } |
| 865 | 865 | else |
| r2340 | r2341 | |
| 867 | 867 | /* read keypad matrix */ |
| 868 | 868 | psg_b_inp = 0xFF; |
| 869 | 869 | if( !(psg_a_out & 0x01) ) |
| 870 | | psg_b_inp &= ~(readinputport(13) & 15); |
| 870 | psg_b_inp &= ~(input_port_read_indexed(machine, 13) & 15); |
| 871 | 871 | if( !(psg_a_out & 0x02) ) |
| 872 | | psg_b_inp &= ~(readinputport(13) / 16); |
| 872 | psg_b_inp &= ~(input_port_read_indexed(machine, 13) / 16); |
| 873 | 873 | if( !(psg_a_out & 0x04) ) |
| 874 | | psg_b_inp &= ~(readinputport(14) & 15); |
| 874 | psg_b_inp &= ~(input_port_read_indexed(machine, 14) & 15); |
| 875 | 875 | if( !(psg_a_out & 0x08) ) |
| 876 | | psg_b_inp &= ~(readinputport(14) / 16); |
| 876 | psg_b_inp &= ~(input_port_read_indexed(machine, 14) / 16); |
| 877 | 877 | if( !(psg_a_out & 0x10) ) |
| 878 | | psg_b_inp &= ~(readinputport(15) & 15); |
| 878 | psg_b_inp &= ~(input_port_read_indexed(machine, 15) & 15); |
| 879 | 879 | if( !(psg_a_out & 0x20) ) |
| 880 | | psg_b_inp &= ~(readinputport(15) / 16); |
| 880 | psg_b_inp &= ~(input_port_read_indexed(machine, 15) / 16); |
| 881 | 881 | } |
| 882 | 882 | return psg_b_inp; |
| 883 | 883 | } |
| r2340 | r2341 | |
| 895 | 895 | READ8_HANDLER( cgenie_status_r ) |
| 896 | 896 | { |
| 897 | 897 | /* If the floppy isn't emulated, return 0 */ |
| 898 | | if( (readinputport(0) & 0x80) == 0 ) |
| 898 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 899 | 899 | return 0; |
| 900 | 900 | return wd17xx_status_r(machine, offset); |
| 901 | 901 | } |
| r2340 | r2341 | |
| 903 | 903 | READ8_HANDLER( cgenie_track_r ) |
| 904 | 904 | { |
| 905 | 905 | /* If the floppy isn't emulated, return 0xff */ |
| 906 | | if( (readinputport(0) & 0x80) == 0 ) |
| 906 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 907 | 907 | return 0xff; |
| 908 | 908 | return wd17xx_track_r(machine, offset); |
| 909 | 909 | } |
| r2340 | r2341 | |
| 911 | 911 | READ8_HANDLER( cgenie_sector_r ) |
| 912 | 912 | { |
| 913 | 913 | /* If the floppy isn't emulated, return 0xff */ |
| 914 | | if( (readinputport(0) & 0x80) == 0 ) |
| 914 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 915 | 915 | return 0xff; |
| 916 | 916 | return wd17xx_sector_r(machine, offset); |
| 917 | 917 | } |
| r2340 | r2341 | |
| 919 | 919 | READ8_HANDLER(cgenie_data_r ) |
| 920 | 920 | { |
| 921 | 921 | /* If the floppy isn't emulated, return 0xff */ |
| 922 | | if( (readinputport(0) & 0x80) == 0 ) |
| 922 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 923 | 923 | return 0xff; |
| 924 | 924 | return wd17xx_data_r(machine, offset); |
| 925 | 925 | } |
| r2340 | r2341 | |
| 927 | 927 | WRITE8_HANDLER( cgenie_command_w ) |
| 928 | 928 | { |
| 929 | 929 | /* If the floppy isn't emulated, return immediately */ |
| 930 | | if( (readinputport(0) & 0x80) == 0 ) |
| 930 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 931 | 931 | return; |
| 932 | 932 | wd17xx_command_w(machine, offset, data); |
| 933 | 933 | } |
| r2340 | r2341 | |
| 935 | 935 | WRITE8_HANDLER( cgenie_track_w ) |
| 936 | 936 | { |
| 937 | 937 | /* If the floppy isn't emulated, ignore the write */ |
| 938 | | if( (readinputport(0) & 0x80) == 0 ) |
| 938 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 939 | 939 | return; |
| 940 | 940 | wd17xx_track_w(machine, offset, data); |
| 941 | 941 | } |
| r2340 | r2341 | |
| 943 | 943 | WRITE8_HANDLER( cgenie_sector_w ) |
| 944 | 944 | { |
| 945 | 945 | /* If the floppy isn't emulated, ignore the write */ |
| 946 | | if( (readinputport(0) & 0x80) == 0 ) |
| 946 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 947 | 947 | return; |
| 948 | 948 | wd17xx_sector_w(machine, offset, data); |
| 949 | 949 | } |
| r2340 | r2341 | |
| 951 | 951 | WRITE8_HANDLER( cgenie_data_w ) |
| 952 | 952 | { |
| 953 | 953 | /* If the floppy isn't emulated, ignore the write */ |
| 954 | | if( (readinputport(0) & 0x80) == 0 ) |
| 954 | if( (input_port_read_indexed(machine, 0) & 0x80) == 0 ) |
| 955 | 955 | return; |
| 956 | 956 | wd17xx_data_w(machine, offset, data); |
| 957 | 957 | } |
| r2340 | r2341 | |
| 985 | 985 | void cgenie_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param) |
| 986 | 986 | { |
| 987 | 987 | /* if disc hardware is not enabled, do not cause an int */ |
| 988 | | if (!( readinputport(0) & 0x80 )) |
| 988 | if (!( input_port_read_indexed(machine, 0) & 0x80 )) |
| 989 | 989 | return; |
| 990 | 990 | |
| 991 | 991 | switch( event ) |
| r2340 | r2341 | |
| 1039 | 1039 | int result = 0; |
| 1040 | 1040 | |
| 1041 | 1041 | if( offset & 0x01 ) |
| 1042 | | result |= readinputport(1); |
| 1042 | result |= input_port_read_indexed(machine, 1); |
| 1043 | 1043 | if( offset & 0x02 ) |
| 1044 | | result |= readinputport(2); |
| 1044 | result |= input_port_read_indexed(machine, 2); |
| 1045 | 1045 | if( offset & 0x04 ) |
| 1046 | | result |= readinputport(3); |
| 1046 | result |= input_port_read_indexed(machine, 3); |
| 1047 | 1047 | if( offset & 0x08 ) |
| 1048 | | result |= readinputport(4); |
| 1048 | result |= input_port_read_indexed(machine, 4); |
| 1049 | 1049 | if( offset & 0x10 ) |
| 1050 | | result |= readinputport(5); |
| 1050 | result |= input_port_read_indexed(machine, 5); |
| 1051 | 1051 | if( offset & 0x20 ) |
| 1052 | | result |= readinputport(6); |
| 1052 | result |= input_port_read_indexed(machine, 6); |
| 1053 | 1053 | if( offset & 0x40 ) |
| 1054 | | result |= readinputport(7); |
| 1054 | result |= input_port_read_indexed(machine, 7); |
| 1055 | 1055 | if( offset & 0x80 ) |
| 1056 | | result |= readinputport(8); |
| 1056 | result |= input_port_read_indexed(machine, 8); |
| 1057 | 1057 | |
| 1058 | 1058 | return result; |
| 1059 | 1059 | } |
| r2340 | r2341 | |
| 1129 | 1129 | |
| 1130 | 1130 | INTERRUPT_GEN( cgenie_frame_interrupt ) |
| 1131 | 1131 | { |
| 1132 | | if( cgenie_tv_mode != (readinputport(0) & 0x10) ) |
| 1132 | if( cgenie_tv_mode != (input_port_read_indexed(machine, 0) & 0x10) ) |
| 1133 | 1133 | { |
| 1134 | | cgenie_tv_mode = readinputport(0) & 0x10; |
| 1134 | cgenie_tv_mode = input_port_read_indexed(machine, 0) & 0x10; |
| 1135 | 1135 | /* force setting of background color */ |
| 1136 | 1136 | port_ff ^= FF_BGD0; |
| 1137 | 1137 | cgenie_port_ff_w(machine, 0, port_ff ^ FF_BGD0); |
src/mess/machine/geneve.c
| r2340 | r2341 | |
| 254 | 254 | KeyReset = 1; |
| 255 | 255 | |
| 256 | 256 | /* read config */ |
| 257 | | has_speech = (readinputport(input_port_config) >> config_speech_bit) & config_speech_mask; |
| 258 | | fdc_kind = (readinputport(input_port_config) >> config_fdc_bit) & config_fdc_mask; |
| 259 | | has_ide = (readinputport(input_port_config) >> config_ide_bit) & config_ide_mask; |
| 260 | | has_rs232 = (readinputport(input_port_config) >> config_rs232_bit) & config_rs232_mask; |
| 261 | | has_usb_sm = (readinputport(input_port_config) >> config_usbsm_bit) & config_usbsm_mask; |
| 257 | has_speech = (input_port_read_indexed(machine, input_port_config) >> config_speech_bit) & config_speech_mask; |
| 258 | fdc_kind = (input_port_read_indexed(machine, input_port_config) >> config_fdc_bit) & config_fdc_mask; |
| 259 | has_ide = (input_port_read_indexed(machine, input_port_config) >> config_ide_bit) & config_ide_mask; |
| 260 | has_rs232 = (input_port_read_indexed(machine, input_port_config) >> config_rs232_bit) & config_rs232_mask; |
| 261 | has_usb_sm = (input_port_read_indexed(machine, input_port_config) >> config_usbsm_bit) & config_usbsm_mask; |
| 262 | 262 | |
| 263 | 263 | /* set up optional expansion hardware */ |
| 264 | 264 | ti99_peb_reset(0, inta_callback, intb_callback); |
| r2340 | r2341 | |
| 1035 | 1035 | |
| 1036 | 1036 | static void poll_keyboard(void) |
| 1037 | 1037 | { |
| 1038 | running_machine *machine = Machine; |
| 1038 | 1039 | UINT32 keystate; |
| 1039 | 1040 | UINT32 key_transitions; |
| 1040 | 1041 | int i, j; |
| r2340 | r2341 | |
| 1076 | 1077 | /* Poll keyboard */ |
| 1077 | 1078 | for (i=0; (i<4) && (KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); i++) |
| 1078 | 1079 | { |
| 1079 | | keystate = readinputport(input_port_keyboard_geneve + i*2) |
| 1080 | | | (readinputport(input_port_keyboard_geneve + i*2 + 1) << 16); |
| 1080 | keystate = input_port_read_indexed(machine, input_port_keyboard_geneve + i*2) |
| 1081 | | (input_port_read_indexed(machine, input_port_keyboard_geneve + i*2 + 1) << 16); |
| 1081 | 1082 | key_transitions = keystate ^ KeyStateSave[i]; |
| 1082 | 1083 | if (key_transitions) |
| 1083 | 1084 | { |
| r2340 | r2341 | |
| 1275 | 1276 | int new_mx, new_my; |
| 1276 | 1277 | int delta_x, delta_y, buttons; |
| 1277 | 1278 | |
| 1278 | | buttons = readinputport(input_port_mouse_buttons_geneve); |
| 1279 | | new_mx = readinputport(input_port_mouse_deltax_geneve); |
| 1280 | | new_my = readinputport(input_port_mouse_deltay_geneve); |
| 1279 | buttons = input_port_read_indexed(Machine, input_port_mouse_buttons_geneve); |
| 1280 | new_mx = input_port_read_indexed(Machine, input_port_mouse_deltax_geneve); |
| 1281 | new_my = input_port_read_indexed(Machine, input_port_mouse_deltay_geneve); |
| 1281 | 1282 | |
| 1282 | 1283 | /* compute x delta */ |
| 1283 | 1284 | delta_x = new_mx - last_mx; |
| r2340 | r2341 | |
| 1358 | 1359 | { |
| 1359 | 1360 | int answer; |
| 1360 | 1361 | |
| 1361 | | answer = readinputport(input_port_joysticks_geneve) >> (JoySel * 8); |
| 1362 | answer = input_port_read_indexed(Machine, input_port_joysticks_geneve) >> (JoySel * 8); |
| 1362 | 1363 | |
| 1363 | 1364 | return (answer); |
| 1364 | 1365 | } |
| r2340 | r2341 | |
| 1379 | 1380 | { |
| 1380 | 1381 | int answer; |
| 1381 | 1382 | |
| 1382 | | answer = (readinputport(input_port_mouse_buttons_geneve) & 4) ^ 4; |
| 1383 | answer = (input_port_read_indexed(Machine, input_port_mouse_buttons_geneve) & 4) ^ 4; |
| 1383 | 1384 | |
| 1384 | 1385 | return answer; |
| 1385 | 1386 | } |
| r2340 | r2341 | |
| 1400 | 1401 | { |
| 1401 | 1402 | int answer = 0; |
| 1402 | 1403 | |
| 1403 | | if (! (readinputport(input_port_mouse_buttons_geneve) & 4)) |
| 1404 | if (! (input_port_read_indexed(Machine, input_port_mouse_buttons_geneve) & 4)) |
| 1404 | 1405 | answer |= 0x10; |
| 1405 | 1406 | |
| 1406 | 1407 | return answer; |
src/mess/machine/lviv.c
| r2340 | r2341 | |
| 43 | 43 | |
| 44 | 44 | static OPBASE_HANDLER(lviv_opbaseoverride) |
| 45 | 45 | { |
| 46 | | if (readinputport(12)&0x01) |
| 46 | if (input_port_read_indexed(machine, 12)&0x01) |
| 47 | 47 | mame_schedule_soft_reset(machine); |
| 48 | 48 | return address; |
| 49 | 49 | } |
| r2340 | r2341 | |
| 63 | 63 | UINT8 data = lviv_ppi_port_outputs[0][2] & 0x0f; |
| 64 | 64 | if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.038) |
| 65 | 65 | data |= 0x10; |
| 66 | | if (lviv_ppi_port_outputs[0][0] & readinputport(13)) |
| 66 | if (lviv_ppi_port_outputs[0][0] & input_port_read_indexed(machine, 13)) |
| 67 | 67 | data |= 0x80; |
| 68 | 68 | return data; |
| 69 | 69 | } |
| r2340 | r2341 | |
| 95 | 95 | |
| 96 | 96 | static READ8_HANDLER ( lviv_ppi_1_portb_r ) /* keyboard reading */ |
| 97 | 97 | { |
| 98 | | return ((lviv_ppi_port_outputs[1][0]&0x01) ? 0xff : readinputport(0)) & |
| 99 | | ((lviv_ppi_port_outputs[1][0]&0x02) ? 0xff : readinputport(1)) & |
| 100 | | ((lviv_ppi_port_outputs[1][0]&0x04) ? 0xff : readinputport(2)) & |
| 101 | | ((lviv_ppi_port_outputs[1][0]&0x08) ? 0xff : readinputport(3)) & |
| 102 | | ((lviv_ppi_port_outputs[1][0]&0x10) ? 0xff : readinputport(4)) & |
| 103 | | ((lviv_ppi_port_outputs[1][0]&0x20) ? 0xff : readinputport(5)) & |
| 104 | | ((lviv_ppi_port_outputs[1][0]&0x40) ? 0xff : readinputport(6)) & |
| 105 | | ((lviv_ppi_port_outputs[1][0]&0x80) ? 0xff : readinputport(7)); |
| 98 | return ((lviv_ppi_port_outputs[1][0]&0x01) ? 0xff : input_port_read_indexed(machine, 0)) & |
| 99 | ((lviv_ppi_port_outputs[1][0]&0x02) ? 0xff : input_port_read_indexed(machine, 1)) & |
| 100 | ((lviv_ppi_port_outputs[1][0]&0x04) ? 0xff : input_port_read_indexed(machine, 2)) & |
| 101 | ((lviv_ppi_port_outputs[1][0]&0x08) ? 0xff : input_port_read_indexed(machine, 3)) & |
| 102 | ((lviv_ppi_port_outputs[1][0]&0x10) ? 0xff : input_port_read_indexed(machine, 4)) & |
| 103 | ((lviv_ppi_port_outputs[1][0]&0x20) ? 0xff : input_port_read_indexed(machine, 5)) & |
| 104 | ((lviv_ppi_port_outputs[1][0]&0x40) ? 0xff : input_port_read_indexed(machine, 6)) & |
| 105 | ((lviv_ppi_port_outputs[1][0]&0x80) ? 0xff : input_port_read_indexed(machine, 7)); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | static READ8_HANDLER ( lviv_ppi_1_portc_r ) /* keyboard reading */ |
| 109 | 109 | { |
| 110 | | return ((lviv_ppi_port_outputs[1][2]&0x01) ? 0xff : readinputport(8)) & |
| 111 | | ((lviv_ppi_port_outputs[1][2]&0x02) ? 0xff : readinputport(9)) & |
| 112 | | ((lviv_ppi_port_outputs[1][2]&0x04) ? 0xff : readinputport(10)) & |
| 113 | | ((lviv_ppi_port_outputs[1][2]&0x08) ? 0xff : readinputport(11)); |
| 110 | return ((lviv_ppi_port_outputs[1][2]&0x01) ? 0xff : input_port_read_indexed(machine, 8)) & |
| 111 | ((lviv_ppi_port_outputs[1][2]&0x02) ? 0xff : input_port_read_indexed(machine, 9)) & |
| 112 | ((lviv_ppi_port_outputs[1][2]&0x04) ? 0xff : input_port_read_indexed(machine, 10)) & |
| 113 | ((lviv_ppi_port_outputs[1][2]&0x08) ? 0xff : input_port_read_indexed(machine, 11)); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | static WRITE8_HANDLER ( lviv_ppi_1_porta_w ) /* kayboard scaning */ |
src/mess/machine/oric.c
| r2340 | r2341 | |
| 75 | 75 | /* oric 1 or oric atmos */ |
| 76 | 76 | |
| 77 | 77 | /* if floppy disc hardware is disabled, do not allow interrupts from it */ |
| 78 | | if ((readinputport(9) & 0x07)==ORIC_FLOPPY_INTERFACE_NONE) |
| 78 | if ((input_port_read_indexed(machine, 9) & 0x07)==ORIC_FLOPPY_INTERFACE_NONE) |
| 79 | 79 | { |
| 80 | 80 | oric_irqs &=~(1<<1); |
| 81 | 81 | } |
| r2340 | r2341 | |
| 121 | 121 | /* what if data is 0, can it sense if any of the keys on a line are pressed? */ |
| 122 | 122 | int input_port_data; |
| 123 | 123 | |
| 124 | | input_port_data = readinputport(1+oric_keyboard_line); |
| 124 | input_port_data = input_port_read_indexed(Machine, 1+oric_keyboard_line); |
| 125 | 125 | |
| 126 | 126 | /* go through all bits in line */ |
| 127 | 127 | for (i=0; i<8; i++) |
| r2340 | r2341 | |
| 291 | 291 | to the via cb1 input. Interrupts can be generated from the vertical |
| 292 | 292 | sync, and flicker free games can be produced */ |
| 293 | 293 | |
| 294 | | input_port_9 = readinputport(9); |
| 294 | input_port_9 = input_port_read_indexed(machine, 9); |
| 295 | 295 | /* cable is enabled? */ |
| 296 | 296 | if ((input_port_9 & 0x08)!=0) |
| 297 | 297 | { |
| r2340 | r2341 | |
| 1060 | 1060 | |
| 1061 | 1061 | static void oric_wd179x_callback(running_machine *machine, wd17xx_state_t State, void *param) |
| 1062 | 1062 | { |
| 1063 | | switch (readinputport(9) & 0x07) |
| 1063 | switch (input_port_read_indexed(machine, 9) & 0x07) |
| 1064 | 1064 | { |
| 1065 | 1065 | default: |
| 1066 | 1066 | case ORIC_FLOPPY_INTERFACE_NONE: |
| r2340 | r2341 | |
| 1135 | 1135 | |
| 1136 | 1136 | MACHINE_RESET( oric ) |
| 1137 | 1137 | { |
| 1138 | | int disc_interface_id = readinputportbytag("oric_floppy_interface") & 0x07; |
| 1138 | int disc_interface_id = input_port_read(machine, "oric_floppy_interface") & 0x07; |
| 1139 | 1139 | |
| 1140 | 1140 | switch (disc_interface_id) |
| 1141 | 1141 | { |
| r2340 | r2341 | |
| 1195 | 1195 | READ8_HANDLER ( oric_IO_r ) |
| 1196 | 1196 | { |
| 1197 | 1197 | #if 0 |
| 1198 | | switch (readinputport(9) & 0x07) |
| 1198 | switch (input_port_read_indexed(machine, 9) & 0x07) |
| 1199 | 1199 | { |
| 1200 | 1200 | default: |
| 1201 | 1201 | case ORIC_FLOPPY_INTERFACE_NONE: |
| r2340 | r2341 | |
| 1234 | 1234 | WRITE8_HANDLER ( oric_IO_w ) |
| 1235 | 1235 | { |
| 1236 | 1236 | #if 0 |
| 1237 | | switch (readinputport(9) & 0x07) |
| 1237 | switch (input_port_read_indexed(machine, 9) & 0x07) |
| 1238 | 1238 | { |
| 1239 | 1239 | default: |
| 1240 | 1240 | case ORIC_FLOPPY_INTERFACE_NONE: |
| r2340 | r2341 | |
| 1408 | 1408 | /* left joystick selected? */ |
| 1409 | 1409 | if (telestrat_via2_port_b_data & (1<<6)) |
| 1410 | 1410 | { |
| 1411 | | data &= readinputport(10); |
| 1411 | data &= input_port_read_indexed(machine, 10); |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | 1414 | /* right joystick selected? */ |
| 1415 | 1415 | if (telestrat_via2_port_b_data & (1<<7)) |
| 1416 | 1416 | { |
| 1417 | | data &= readinputport(11); |
| 1417 | data &= input_port_read_indexed(machine, 11); |
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | data |= telestrat_via2_port_b_data & ((1<<7) | (1<<6) | (1<<5)); |
src/mess/machine/orao.c
| r2340 | r2341 | |
| 34 | 34 | |
| 35 | 35 | switch(offset) { |
| 36 | 36 | /* Keyboard*/ |
| 37 | | case 0x07FC : return readinputport(0); break; |
| 38 | | case 0x07FD : return readinputport(1); break; |
| 39 | | case 0x07FA : return readinputport(2); break; |
| 40 | | case 0x07FB : return readinputport(3); break; |
| 41 | | case 0x07F6 : return readinputport(4); break; |
| 42 | | case 0x07F7 : return readinputport(5); break; |
| 43 | | case 0x07EE : return readinputport(6); break; |
| 44 | | case 0x07EF : return readinputport(7); break; |
| 45 | | case 0x07DE : return readinputport(8); break; |
| 46 | | case 0x07DF : return readinputport(9); break; |
| 47 | | case 0x07BE : return readinputport(10); break; |
| 48 | | case 0x07BF : return readinputport(11); break; |
| 49 | | case 0x077E : return readinputport(12); break; |
| 50 | | case 0x077F : return readinputport(13); break; |
| 51 | | case 0x06FE : return readinputport(14); break; |
| 52 | | case 0x06FF : return readinputport(15); break; |
| 53 | | case 0x05FE : return readinputport(16); break; |
| 54 | | case 0x05FF : return readinputport(17); break; |
| 55 | | case 0x03FE : return readinputport(18); break; |
| 56 | | case 0x03FF : return readinputport(19); break; |
| 37 | case 0x07FC : return input_port_read_indexed(machine, 0); break; |
| 38 | case 0x07FD : return input_port_read_indexed(machine, 1); break; |
| 39 | case 0x07FA : return input_port_read_indexed(machine, 2); break; |
| 40 | case 0x07FB : return input_port_read_indexed(machine, 3); break; |
| 41 | case 0x07F6 : return input_port_read_indexed(machine, 4); break; |
| 42 | case 0x07F7 : return input_port_read_indexed(machine, 5); break; |
| 43 | case 0x07EE : return input_port_read_indexed(machine, 6); break; |
| 44 | case 0x07EF : return input_port_read_indexed(machine, 7); break; |
| 45 | case 0x07DE : return input_port_read_indexed(machine, 8); break; |
| 46 | case 0x07DF : return input_port_read_indexed(machine, 9); break; |
| 47 | case 0x07BE : return input_port_read_indexed(machine, 10); break; |
| 48 | case 0x07BF : return input_port_read_indexed(machine, 11); break; |
| 49 | case 0x077E : return input_port_read_indexed(machine, 12); break; |
| 50 | case 0x077F : return input_port_read_indexed(machine, 13); break; |
| 51 | case 0x06FE : return input_port_read_indexed(machine, 14); break; |
| 52 | case 0x06FF : return input_port_read_indexed(machine, 15); break; |
| 53 | case 0x05FE : return input_port_read_indexed(machine, 16); break; |
| 54 | case 0x05FF : return input_port_read_indexed(machine, 17); break; |
| 55 | case 0x03FE : return input_port_read_indexed(machine, 18); break; |
| 56 | case 0x03FF : return input_port_read_indexed(machine, 19); break; |
| 57 | 57 | /* Tape */ |
| 58 | 58 | case 0x07FF : level = cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)); |
| 59 | 59 | if (level < 0) { |
src/mess/machine/mtx.c
| r2340 | r2341 | |
| 174 | 174 | { |
| 175 | 175 | UINT8 data = 0xff; |
| 176 | 176 | |
| 177 | | if (!(key_sense & 0x01)) data &= readinputportbytag("keyboard_low_0"); |
| 178 | | if (!(key_sense & 0x02)) data &= readinputportbytag("keyboard_low_1"); |
| 179 | | if (!(key_sense & 0x04)) data &= readinputportbytag("keyboard_low_2"); |
| 180 | | if (!(key_sense & 0x08)) data &= readinputportbytag("keyboard_low_3"); |
| 181 | | if (!(key_sense & 0x10)) data &= readinputportbytag("keyboard_low_4"); |
| 182 | | if (!(key_sense & 0x20)) data &= readinputportbytag("keyboard_low_5"); |
| 183 | | if (!(key_sense & 0x40)) data &= readinputportbytag("keyboard_low_6"); |
| 184 | | if (!(key_sense & 0x80)) data &= readinputportbytag("keyboard_low_7"); |
| 177 | if (!(key_sense & 0x01)) data &= input_port_read(machine, "keyboard_low_0"); |
| 178 | if (!(key_sense & 0x02)) data &= input_port_read(machine, "keyboard_low_1"); |
| 179 | if (!(key_sense & 0x04)) data &= input_port_read(machine, "keyboard_low_2"); |
| 180 | if (!(key_sense & 0x08)) data &= input_port_read(machine, "keyboard_low_3"); |
| 181 | if (!(key_sense & 0x10)) data &= input_port_read(machine, "keyboard_low_4"); |
| 182 | if (!(key_sense & 0x20)) data &= input_port_read(machine, "keyboard_low_5"); |
| 183 | if (!(key_sense & 0x40)) data &= input_port_read(machine, "keyboard_low_6"); |
| 184 | if (!(key_sense & 0x80)) data &= input_port_read(machine, "keyboard_low_7"); |
| 185 | 185 | |
| 186 | 186 | return data; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | READ8_HANDLER( mtx_key_hi_r ) |
| 190 | 190 | { |
| 191 | | UINT8 data = readinputportbytag("country_code"); |
| 191 | UINT8 data = input_port_read(machine, "country_code"); |
| 192 | 192 | |
| 193 | | if (!(key_sense & 0x01)) data &= readinputportbytag("keyboard_high_0"); |
| 194 | | if (!(key_sense & 0x02)) data &= readinputportbytag("keyboard_high_1"); |
| 195 | | if (!(key_sense & 0x04)) data &= readinputportbytag("keyboard_high_2"); |
| 196 | | if (!(key_sense & 0x08)) data &= readinputportbytag("keyboard_high_3"); |
| 197 | | if (!(key_sense & 0x10)) data &= readinputportbytag("keyboard_high_4"); |
| 198 | | if (!(key_sense & 0x20)) data &= readinputportbytag("keyboard_high_5"); |
| 199 | | if (!(key_sense & 0x40)) data &= readinputportbytag("keyboard_high_6"); |
| 200 | | if (!(key_sense & 0x80)) data &= readinputportbytag("keyboard_high_7"); |
| 193 | if (!(key_sense & 0x01)) data &= input_port_read(machine, "keyboard_high_0"); |
| 194 | if (!(key_sense & 0x02)) data &= input_port_read(machine, "keyboard_high_1"); |
| 195 | if (!(key_sense & 0x04)) data &= input_port_read(machine, "keyboard_high_2"); |
| 196 | if (!(key_sense & 0x08)) data &= input_port_read(machine, "keyboard_high_3"); |
| 197 | if (!(key_sense & 0x10)) data &= input_port_read(machine, "keyboard_high_4"); |
| 198 | if (!(key_sense & 0x20)) data &= input_port_read(machine, "keyboard_high_5"); |
| 199 | if (!(key_sense & 0x40)) data &= input_port_read(machine, "keyboard_high_6"); |
| 200 | if (!(key_sense & 0x80)) data &= input_port_read(machine, "keyboard_high_7"); |
| 201 | 201 | |
| 202 | 202 | return data; |
| 203 | 203 | } |
src/mess/machine/microtan.c
| r2340 | r2341 | |
| 153 | 153 | **************************************************************/ |
| 154 | 154 | static READ8_HANDLER (via_0_in_a ) |
| 155 | 155 | { |
| 156 | | int data = readinputport(10); |
| 156 | int data = input_port_read_indexed(machine, 10); |
| 157 | 157 | LOG(("microtan_via_0_in_a %02X\n", data)); |
| 158 | 158 | return data; |
| 159 | 159 | } |
| r2340 | r2341 | |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | row = 9; |
| 607 | | new = readinputport(row); |
| 607 | new = input_port_read_indexed(machine, row); |
| 608 | 608 | chg = keyrows[--row] ^ new; |
| 609 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 610 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 611 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 612 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 613 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 614 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 615 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 616 | | if (!chg) { new = readinputport(row); chg = keyrows[--row] ^ new; } |
| 609 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 610 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 611 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 612 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 613 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 614 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 615 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 616 | if (!chg) { new = input_port_read_indexed(machine, row); chg = keyrows[--row] ^ new; } |
| 617 | 617 | if (!chg) --row; |
| 618 | 618 | |
| 619 | 619 | if (row >= 0) |
| r2340 | r2341 | |
| 881 | 881 | dst += 4; |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | | switch (readinputport(0) & 3) |
| 884 | switch (input_port_read_indexed(machine, 0) & 3) |
| 885 | 885 | { |
| 886 | 886 | case 0: // 1K only :) |
| 887 | 887 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0xbbff, 0, 0, SMH_NOP); |
| r2340 | r2341 | |
| 906 | 906 | int i; |
| 907 | 907 | |
| 908 | 908 | for (i = 1; i < 10; i++) |
| 909 | | keyrows[i] = readinputport(1+i); |
| 909 | keyrows[i] = input_port_read_indexed(machine, 1+i); |
| 910 | 910 | set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1); |
| 911 | 911 | |
| 912 | 912 | via_config(0, &via6522[0]); |
src/mess/machine/intv.c
| r2340 | r2341 | |
| 53 | 53 | switch (offset) |
| 54 | 54 | { |
| 55 | 55 | case 0x000: |
| 56 | | rv = readinputport(10) & 0x80; |
| 56 | rv = input_port_read_indexed(machine, 10) & 0x80; |
| 57 | 57 | logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset); |
| 58 | 58 | break; |
| 59 | 59 | case 0x001: |
| 60 | | rv = (readinputport(10) & 0x40) << 1; |
| 60 | rv = (input_port_read_indexed(machine, 10) & 0x40) << 1; |
| 61 | 61 | logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset); |
| 62 | 62 | break; |
| 63 | 63 | case 0x002: |
| 64 | | rv = (readinputport(10) & 0x20) << 2; |
| 64 | rv = (input_port_read_indexed(machine, 10) & 0x20) << 2; |
| 65 | 65 | logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset); |
| 66 | 66 | break; |
| 67 | 67 | case 0x003: |
| 68 | | rv = (readinputport(10) & 0x10) << 3; |
| 68 | rv = (input_port_read_indexed(machine, 10) & 0x10) << 3; |
| 69 | 69 | logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset); |
| 70 | 70 | break; |
| 71 | 71 | case 0x004: |
| 72 | | rv = (readinputport(10) & 0x08) << 4; |
| 72 | rv = (input_port_read_indexed(machine, 10) & 0x08) << 4; |
| 73 | 73 | logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset); |
| 74 | 74 | break; |
| 75 | 75 | case 0x005: |
| 76 | | rv = (readinputport(10) & 0x04) << 5; |
| 76 | rv = (input_port_read_indexed(machine, 10) & 0x04) << 5; |
| 77 | 77 | logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset); |
| 78 | 78 | break; |
| 79 | 79 | case 0x006: |
| r2340 | r2341 | |
| 93 | 93 | case 0x060: /* Keyboard Read */ |
| 94 | 94 | rv = 0xff; |
| 95 | 95 | if (intvkbd_keyboard_col == 0) |
| 96 | | rv = readinputport(0); |
| 96 | rv = input_port_read_indexed(machine, 0); |
| 97 | 97 | if (intvkbd_keyboard_col == 1) |
| 98 | | rv = readinputport(1); |
| 98 | rv = input_port_read_indexed(machine, 1); |
| 99 | 99 | if (intvkbd_keyboard_col == 2) |
| 100 | | rv = readinputport(2); |
| 100 | rv = input_port_read_indexed(machine, 2); |
| 101 | 101 | if (intvkbd_keyboard_col == 3) |
| 102 | | rv = readinputport(3); |
| 102 | rv = input_port_read_indexed(machine, 3); |
| 103 | 103 | if (intvkbd_keyboard_col == 4) |
| 104 | | rv = readinputport(4); |
| 104 | rv = input_port_read_indexed(machine, 4); |
| 105 | 105 | if (intvkbd_keyboard_col == 5) |
| 106 | | rv = readinputport(5); |
| 106 | rv = input_port_read_indexed(machine, 5); |
| 107 | 107 | if (intvkbd_keyboard_col == 6) |
| 108 | | rv = readinputport(6); |
| 108 | rv = input_port_read_indexed(machine, 6); |
| 109 | 109 | if (intvkbd_keyboard_col == 7) |
| 110 | | rv = readinputport(7); |
| 110 | rv = input_port_read_indexed(machine, 7); |
| 111 | 111 | if (intvkbd_keyboard_col == 8) |
| 112 | | rv = readinputport(8); |
| 112 | rv = input_port_read_indexed(machine, 8); |
| 113 | 113 | if (intvkbd_keyboard_col == 9) |
| 114 | | rv = readinputport(9); |
| 114 | rv = input_port_read_indexed(machine, 9); |
| 115 | 115 | break; |
| 116 | 116 | case 0x80: |
| 117 | 117 | rv = 0x00; |
| r2340 | r2341 | |
| 458 | 458 | switch(byte) |
| 459 | 459 | { |
| 460 | 460 | case 0: |
| 461 | | value = readinputport(0); |
| 461 | value = input_port_read_indexed(machine, 0); |
| 462 | 462 | break; |
| 463 | 463 | case 1: |
| 464 | | value = readinputport(1); |
| 464 | value = input_port_read_indexed(machine, 1); |
| 465 | 465 | break; |
| 466 | 466 | case 2: |
| 467 | | value = readinputport(2); |
| 467 | value = input_port_read_indexed(machine, 2); |
| 468 | 468 | break; |
| 469 | 469 | } |
| 470 | 470 | for(bit=7; bit>=0; bit--) |
src/mess/machine/special.c
| r2340 | r2341 | |
| 36 | 36 | |
| 37 | 37 | READ8_HANDLER (specialist_8255_porta_r ) |
| 38 | 38 | { |
| 39 | | if (readinputport(0)!=0xff) return 0xfe; |
| 40 | | if (readinputport(1)!=0xff) return 0xfd; |
| 41 | | if (readinputport(2)!=0xff) return 0xfb; |
| 42 | | if (readinputport(3)!=0xff) return 0xf7; |
| 43 | | if (readinputport(4)!=0xff) return 0xef; |
| 44 | | if (readinputport(5)!=0xff) return 0xdf; |
| 45 | | if (readinputport(6)!=0xff) return 0xbf; |
| 46 | | if (readinputport(7)!=0xff) return 0x7f; |
| 39 | if (input_port_read_indexed(machine, 0)!=0xff) return 0xfe; |
| 40 | if (input_port_read_indexed(machine, 1)!=0xff) return 0xfd; |
| 41 | if (input_port_read_indexed(machine, 2)!=0xff) return 0xfb; |
| 42 | if (input_port_read_indexed(machine, 3)!=0xff) return 0xf7; |
| 43 | if (input_port_read_indexed(machine, 4)!=0xff) return 0xef; |
| 44 | if (input_port_read_indexed(machine, 5)!=0xff) return 0xdf; |
| 45 | if (input_port_read_indexed(machine, 6)!=0xff) return 0xbf; |
| 46 | if (input_port_read_indexed(machine, 7)!=0xff) return 0x7f; |
| 47 | 47 | return 0xff; |
| 48 | 48 | } |
| 49 | 49 | |
| r2340 | r2341 | |
| 53 | 53 | int dat = 0; |
| 54 | 54 | double level; |
| 55 | 55 | |
| 56 | | if ((specialist_8255_porta & 0x01)==0) dat ^= (readinputport(0) ^ 0xff); |
| 57 | | if ((specialist_8255_porta & 0x02)==0) dat ^= (readinputport(1) ^ 0xff); |
| 58 | | if ((specialist_8255_porta & 0x04)==0) dat ^= (readinputport(2) ^ 0xff); |
| 59 | | if ((specialist_8255_porta & 0x08)==0) dat ^= (readinputport(3) ^ 0xff); |
| 60 | | if ((specialist_8255_porta & 0x10)==0) dat ^= (readinputport(4) ^ 0xff); |
| 61 | | if ((specialist_8255_porta & 0x20)==0) dat ^= (readinputport(5) ^ 0xff); |
| 62 | | if ((specialist_8255_porta & 0x40)==0) dat ^= (readinputport(6) ^ 0xff); |
| 63 | | if ((specialist_8255_porta & 0x80)==0) dat ^= (readinputport(7) ^ 0xff); |
| 64 | | if ((specialist_8255_portc & 0x01)==0) dat ^= (readinputport(8) ^ 0xff); |
| 65 | | if ((specialist_8255_portc & 0x02)==0) dat ^= (readinputport(9) ^ 0xff); |
| 66 | | if ((specialist_8255_portc & 0x04)==0) dat ^= (readinputport(10) ^ 0xff); |
| 67 | | if ((specialist_8255_portc & 0x08)==0) dat ^= (readinputport(11) ^ 0xff); |
| 56 | if ((specialist_8255_porta & 0x01)==0) dat ^= (input_port_read_indexed(machine, 0) ^ 0xff); |
| 57 | if ((specialist_8255_porta & 0x02)==0) dat ^= (input_port_read_indexed(machine, 1) ^ 0xff); |
| 58 | if ((specialist_8255_porta & 0x04)==0) dat ^= (input_port_read_indexed(machine, 2) ^ 0xff); |
| 59 | if ((specialist_8255_porta & 0x08)==0) dat ^= (input_port_read_indexed(machine, 3) ^ 0xff); |
| 60 | if ((specialist_8255_porta & 0x10)==0) dat ^= (input_port_read_indexed(machine, 4) ^ 0xff); |
| 61 | if ((specialist_8255_porta & 0x20)==0) dat ^= (input_port_read_indexed(machine, 5) ^ 0xff); |
| 62 | if ((specialist_8255_porta & 0x40)==0) dat ^= (input_port_read_indexed(machine, 6) ^ 0xff); |
| 63 | if ((specialist_8255_porta & 0x80)==0) dat ^= (input_port_read_indexed(machine, 7) ^ 0xff); |
| 64 | if ((specialist_8255_portc & 0x01)==0) dat ^= (input_port_read_indexed(machine, 8) ^ 0xff); |
| 65 | if ((specialist_8255_portc & 0x02)==0) dat ^= (input_port_read_indexed(machine, 9) ^ 0xff); |
| 66 | if ((specialist_8255_portc & 0x04)==0) dat ^= (input_port_read_indexed(machine, 10) ^ 0xff); |
| 67 | if ((specialist_8255_portc & 0x08)==0) dat ^= (input_port_read_indexed(machine, 11) ^ 0xff); |
| 68 | 68 | |
| 69 | 69 | dat = (dat << 2) ^0xff; |
| 70 | | if (readinputport(12)!=0xff) dat ^= 0x02; |
| 70 | if (input_port_read_indexed(machine, 12)!=0xff) dat ^= 0x02; |
| 71 | 71 | |
| 72 | 72 | level = cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)); |
| 73 | 73 | if (level >= 0) { |
| r2340 | r2341 | |
| 78 | 78 | |
| 79 | 79 | READ8_HANDLER (specialist_8255_portc_r ) |
| 80 | 80 | { |
| 81 | | if (readinputport(8)!=0xff) return 0x0e; |
| 82 | | if (readinputport(9)!=0xff) return 0x0d; |
| 83 | | if (readinputport(10)!=0xff) return 0x0b; |
| 84 | | if (readinputport(11)!=0xff) return 0x07; |
| 81 | if (input_port_read_indexed(machine, 8)!=0xff) return 0x0e; |
| 82 | if (input_port_read_indexed(machine, 9)!=0xff) return 0x0d; |
| 83 | if (input_port_read_indexed(machine, 10)!=0xff) return 0x0b; |
| 84 | if (input_port_read_indexed(machine, 11)!=0xff) return 0x07; |
| 85 | 85 | return 0x0f; |
| 86 | 86 | } |
| 87 | 87 | |
src/mess/machine/sms.c
| r2340 | r2341 | |
| 1 | 1 | #include "driver.h" |
| 2 | #include "deprecat.h" |
| 2 | 3 | #include "image.h" |
| 3 | 4 | #include "includes/sms.h" |
| 4 | 5 | #include "video/smsvdp.h" |
| r2340 | r2341 | |
| 76 | 77 | static WRITE8_HANDLER( sms_input_write ) { |
| 77 | 78 | switch( offset ) { |
| 78 | 79 | case 0: |
| 79 | | switch( readinputport(11) & 0x0F ) { |
| 80 | switch( input_port_read_indexed(machine, 11) & 0x0F ) { |
| 80 | 81 | case 0x03: /* Sports Pad */ |
| 81 | 82 | if ( data != sports_pad_last_data_1 ) { |
| 82 | 83 | UINT32 cpu_cycles = activecpu_gettotalcycles(); |
| r2340 | r2341 | |
| 84 | 85 | sports_pad_last_data_1 = data; |
| 85 | 86 | if ( cpu_cycles - last_sports_pad_time_1 > 512 ) { |
| 86 | 87 | sports_pad_state_1 = 3; |
| 87 | | sports_pad_1_x = readinputport(12); |
| 88 | | sports_pad_1_y = readinputport(13); |
| 88 | sports_pad_1_x = input_port_read_indexed(machine, 12); |
| 89 | sports_pad_1_y = input_port_read_indexed(machine, 13); |
| 89 | 90 | } |
| 90 | 91 | last_sports_pad_time_1 = cpu_cycles; |
| 91 | 92 | sports_pad_state_1 = ( sports_pad_state_1 + 1 ) & 3; |
| r2340 | r2341 | |
| 94 | 95 | } |
| 95 | 96 | break; |
| 96 | 97 | case 1: |
| 97 | | switch( readinputport(11) >> 4 ) { |
| 98 | switch( input_port_read_indexed(machine, 11) >> 4 ) { |
| 98 | 99 | case 0x03: /* Sports Pad */ |
| 99 | 100 | if ( data != sports_pad_last_data_2 ) { |
| 100 | 101 | UINT32 cpu_cycles = activecpu_gettotalcycles(); |
| r2340 | r2341 | |
| 102 | 103 | sports_pad_last_data_2 = data; |
| 103 | 104 | if ( cpu_cycles - last_sports_pad_time_2 > 2048 ) { |
| 104 | 105 | sports_pad_state_2 = 3; |
| 105 | | sports_pad_2_x = readinputport(14); |
| 106 | | sports_pad_2_y = readinputport(15); |
| 106 | sports_pad_2_x = input_port_read_indexed(machine, 14); |
| 107 | sports_pad_2_y = input_port_read_indexed(machine, 15); |
| 107 | 108 | } |
| 108 | 109 | last_sports_pad_time_2 = cpu_cycles; |
| 109 | 110 | sports_pad_state_2 = ( sports_pad_state_2 + 1 ) & 3; |
| r2340 | r2341 | |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | 130 | /* Player 1 */ |
| 130 | | switch( readinputport(11) & 0x0F ) { |
| 131 | switch( input_port_read_indexed(Machine, 11) & 0x0F ) { |
| 131 | 132 | case 0x00: /* Joystick */ |
| 132 | | data = readinputport(0); |
| 133 | data = input_port_read_indexed(Machine, 0); |
| 133 | 134 | /* Rapid Fire setting for Button A */ |
| 134 | | if ( readinputport(7) & 0x01 ) { |
| 135 | if ( input_port_read_indexed(Machine, 7) & 0x01 ) { |
| 135 | 136 | data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 ); |
| 136 | 137 | } |
| 137 | 138 | /* Check Rapid Fire setting for Button B */ |
| 138 | | if ( readinputport(7) & 0x02 ) { |
| 139 | if ( input_port_read_indexed(Machine, 7) & 0x02 ) { |
| 139 | 140 | data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 ); |
| 140 | 141 | } |
| 141 | 142 | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | ( data & 0x3F ); |
| r2340 | r2341 | |
| 144 | 145 | break; |
| 145 | 146 | case 0x02: /* Paddle Control */ |
| 146 | 147 | /* Get button A state */ |
| 147 | | data = readinputport(8); |
| 148 | data = input_port_read_indexed(Machine, 8); |
| 148 | 149 | if ( paddle_read_state ) { |
| 149 | 150 | data = data >> 4; |
| 150 | 151 | } |
| 151 | 152 | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | ( data & 0x0F ) | ( paddle_read_state & 0x20 ) |
| 152 | | | ( ( readinputport(10) & 0x02 ) << 3 ); |
| 153 | | ( ( input_port_read_indexed(Machine, 10) & 0x02 ) << 3 ); |
| 153 | 154 | break; |
| 154 | 155 | case 0x03: /* Sega Sports Pad */ |
| 155 | 156 | switch( sports_pad_state_1 ) { |
| r2340 | r2341 | |
| 166 | 167 | data = sports_pad_1_y & 0x0F; |
| 167 | 168 | break; |
| 168 | 169 | } |
| 169 | | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( readinputport(10) & 0x0C ) << 2 ); |
| 170 | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( input_port_read_indexed(Machine, 10) & 0x0C ) << 2 ); |
| 170 | 171 | break; |
| 171 | 172 | } |
| 172 | 173 | |
| 173 | 174 | /* Player 2 */ |
| 174 | | switch( readinputport(11) >> 4 ) { |
| 175 | switch( input_port_read_indexed(Machine, 11) >> 4 ) { |
| 175 | 176 | case 0x00: /* Joystick */ |
| 176 | | data = readinputport(0); |
| 177 | data = input_port_read_indexed(Machine, 0); |
| 177 | 178 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( data & 0xC0 ); |
| 178 | | data = readinputport(1); |
| 179 | | if ( readinputport(7) & 0x04 ) { |
| 179 | data = input_port_read_indexed(Machine, 1); |
| 180 | if ( input_port_read_indexed(Machine, 7) & 0x04 ) { |
| 180 | 181 | data = ( data & 0xFB ) | ( rapid_fire_state_2 & 0x04 ); |
| 181 | 182 | } |
| 182 | | if ( readinputport(7) & 0x08 ) { |
| 183 | if ( input_port_read_indexed(Machine, 7) & 0x08 ) { |
| 183 | 184 | data = ( data & 0xF7 ) | ( rapid_fire_state_2 & 0x08 ); |
| 184 | 185 | } |
| 185 | 186 | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data & 0x0F ); |
| r2340 | r2341 | |
| 188 | 189 | break; |
| 189 | 190 | case 0x02: /* Paddle Control */ |
| 190 | 191 | /* Get button A state */ |
| 191 | | data = readinputport(9); |
| 192 | data = input_port_read_indexed(Machine, 9); |
| 192 | 193 | if ( paddle_read_state ) { |
| 193 | 194 | data = data >> 4; |
| 194 | 195 | } |
| 195 | 196 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 ); |
| 196 | 197 | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( ( data & 0x0C ) >> 2 ) | ( paddle_read_state & 0x08 ) |
| 197 | | | ( ( readinputport(10) & 0x20 ) >> 3 ); |
| 198 | | ( ( input_port_read_indexed(Machine, 10) & 0x20 ) >> 3 ); |
| 198 | 199 | break; |
| 199 | 200 | case 0x03: /* Sega Sports Pad */ |
| 200 | 201 | switch( sports_pad_state_2 ) { |
| r2340 | r2341 | |
| 211 | 212 | break; |
| 212 | 213 | } |
| 213 | 214 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 ); |
| 214 | | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( readinputport(10) & 0xC0 ) >> 4 ); |
| 215 | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( input_port_read_indexed(Machine, 10) & 0xC0 ) >> 4 ); |
| 215 | 216 | break; |
| 216 | 217 | } |
| 217 | 218 | } |
| r2340 | r2341 | |
| 280 | 281 | |
| 281 | 282 | void sms_check_pause_button( running_machine *machine ) { |
| 282 | 283 | if ( ! IS_GAMEGEAR ) { |
| 283 | | if ( ! (readinputport(2) & 0x80) ) { |
| 284 | if ( ! (input_port_read_indexed(machine, 2) & 0x80) ) { |
| 284 | 285 | if ( ! smsPaused ) { |
| 285 | 286 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE ); |
| 286 | 287 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE ); |
| r2340 | r2341 | |
| 315 | 316 | } |
| 316 | 317 | |
| 317 | 318 | READ8_HANDLER(gg_input_port_2_r) { |
| 318 | | //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (readinputport(2) & 0x80)), activecpu_get_pc()); |
| 319 | | return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (readinputport(2) & 0x80)); |
| 319 | //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (input_port_read_indexed(machine, 2) & 0x80)), activecpu_get_pc()); |
| 320 | return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (input_port_read_indexed(machine, 2) & 0x80)); |
| 320 | 321 | } |
| 321 | 322 | |
| 322 | 323 | READ8_HANDLER(sms_mapper_r) |
src/mess/machine/c64.c
| r2340 | r2341 | |
| 755 | 755 | |
| 756 | 756 | UINT8 c64_m6510_port_read(UINT8 direction) |
| 757 | 757 | { |
| 758 | running_machine *machine = Machine; |
| 758 | 759 | UINT8 data = c64_port_data; |
| 759 | 760 | |
| 760 | 761 | if (c64_tape_on && !vc20_tape_switch ()) |
| 761 | 762 | data &= ~0x10; |
| 762 | 763 | /* WP: motor is always marked as on??? */ |
| 763 | 764 | data &= ~0x20; |
| 764 | | if (is_c128(Machine) && !c128_capslock_r ()) |
| 765 | if (is_c128(machine) && !c128_capslock_r ()) |
| 765 | 766 | data &= ~0x40; |
| 766 | | if (is_c65(Machine) && C65_KEY_DIN) |
| 767 | if (is_c65(machine) && C65_KEY_DIN) |
| 767 | 768 | data &= ~0x40; /*? */ |
| 768 | 769 | return data; |
| 769 | 770 | } |
| r2340 | r2341 | |
| 1137 | 1138 | |
| 1138 | 1139 | c64_nmi(machine); |
| 1139 | 1140 | |
| 1140 | | c64_keyline[0] = readinputportbytag( "ROW0" ); |
| 1141 | | c64_keyline[1] = readinputportbytag( "ROW1" ); |
| 1142 | | c64_keyline[2] = readinputportbytag( "ROW2" ); |
| 1143 | | c64_keyline[3] = readinputportbytag( "ROW3" ); |
| 1144 | | c64_keyline[4] = readinputportbytag( "ROW4" ); |
| 1145 | | c64_keyline[5] = readinputportbytag( "ROW5" ); |
| 1146 | | c64_keyline[6] = readinputportbytag( "ROW6" ); |
| 1147 | | c64_keyline[7] = readinputportbytag( "ROW7" ); |
| 1141 | c64_keyline[0] = input_port_read(machine, "ROW0" ); |
| 1142 | c64_keyline[1] = input_port_read(machine, "ROW1" ); |
| 1143 | c64_keyline[2] = input_port_read(machine, "ROW2" ); |
| 1144 | c64_keyline[3] = input_port_read(machine, "ROW3" ); |
| 1145 | c64_keyline[4] = input_port_read(machine, "ROW4" ); |
| 1146 | c64_keyline[5] = input_port_read(machine, "ROW5" ); |
| 1147 | c64_keyline[6] = input_port_read(machine, "ROW6" ); |
| 1148 | c64_keyline[7] = input_port_read(machine, "ROW7" ); |
| 1148 | 1149 | |
| 1149 | 1150 | value = 0xff; |
| 1150 | 1151 | if (JOYSTICK1||JOYSTICK1_2BUTTON) { |
| r2340 | r2341 | |
| 1198 | 1199 | |
| 1199 | 1200 | if (is_c65(machine)) |
| 1200 | 1201 | { |
| 1201 | | c65_keyline = readinputportbytag("ROW8"); |
| 1202 | c65_keyline = input_port_read(machine, "ROW8"); |
| 1202 | 1203 | } |
| 1203 | 1204 | |
| 1204 | 1205 | vic2_frame_interrupt (machine, cpunum); |
| r2340 | r2341 | |
| 1207 | 1208 | vc20_tape_config (DATASSETTE, DATASSETTE_TONE); |
| 1208 | 1209 | vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP); |
| 1209 | 1210 | } |
| 1210 | | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , readinputportbytag( "Special" ) & 0x40 ? 1 : 0); |
| 1211 | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , input_port_read(machine, "Special" ) & 0x40 ? 1 : 0); |
| 1211 | 1212 | set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0); |
| 1212 | 1213 | } |
| 1213 | 1214 | |
| r2340 | r2341 | |
| 1237 | 1238 | |
| 1238 | 1239 | value = 0xff; |
| 1239 | 1240 | |
| 1240 | | value &= ~readinputportbytag( "ROW0" ); |
| 1241 | value &= ~input_port_read(machine, "ROW0" ); |
| 1241 | 1242 | c64_keyline[0] = value; |
| 1242 | 1243 | |
| 1243 | 1244 | value = 0xff; |
| 1244 | 1245 | |
| 1245 | | value &= ~readinputportbytag( "ROW1" ); |
| 1246 | value &= ~input_port_read(machine, "ROW1" ); |
| 1246 | 1247 | c64_keyline[1] = value; |
| 1247 | 1248 | |
| 1248 | 1249 | value = 0xff; |
| 1249 | 1250 | |
| 1250 | | value &= ~readinputportbytag( "ROW2" ); |
| 1251 | value &= ~input_port_read(machine, "ROW2" ); |
| 1251 | 1252 | c64_keyline[2] = value; |
| 1252 | 1253 | |
| 1253 | 1254 | value = 0xff; |
| 1254 | 1255 | |
| 1255 | | value &= ~readinputportbytag( "ROW3" ); |
| 1256 | value &= ~input_port_read(machine, "ROW3" ); |
| 1256 | 1257 | c64_keyline[3] = value; |
| 1257 | 1258 | |
| 1258 | 1259 | value = 0xff; |
| 1259 | 1260 | |
| 1260 | | value &= ~readinputportbytag( "ROW4" ); |
| 1261 | value &= ~input_port_read(machine, "ROW4" ); |
| 1261 | 1262 | c64_keyline[4] = value; |
| 1262 | 1263 | |
| 1263 | 1264 | value = 0xff; |
| 1264 | 1265 | |
| 1265 | | value &= ~readinputportbytag( "ROW5" ); |
| 1266 | value &= ~input_port_read(machine, "ROW5" ); |
| 1266 | 1267 | c64_keyline[5] = value; |
| 1267 | 1268 | |
| 1268 | 1269 | value = 0xff; |
| 1269 | 1270 | |
| 1270 | | value &= ~readinputportbytag( "ROW6" ); |
| 1271 | value &= ~input_port_read(machine, "ROW6" ); |
| 1271 | 1272 | c64_keyline[6] = value; |
| 1272 | 1273 | |
| 1273 | 1274 | value = 0xff; |
| 1274 | 1275 | |
| 1275 | | value &= ~readinputportbytag( "ROW7" ); |
| 1276 | value &= ~input_port_read(machine, "ROW7" ); |
| 1276 | 1277 | c64_keyline[7] = value; |
| 1277 | 1278 | |
| 1278 | 1279 | value = 0xff; |
| r2340 | r2341 | |
| 1327 | 1328 | |
| 1328 | 1329 | value = 0xff; |
| 1329 | 1330 | |
| 1330 | | value &= ~readinputportbytag( "ROW8" ); |
| 1331 | value &= ~input_port_read(machine, "ROW8" ); |
| 1331 | 1332 | c128_keyline[0] = value; |
| 1332 | 1333 | |
| 1333 | 1334 | value = 0xff; |
| 1334 | 1335 | |
| 1335 | | value &= ~readinputportbytag( "ROW9" ); |
| 1336 | value &= ~input_port_read(machine, "ROW9" ); |
| 1336 | 1337 | c128_keyline[1] = value; |
| 1337 | 1338 | |
| 1338 | 1339 | value = 0xff; |
| 1339 | 1340 | |
| 1340 | | value &= ~readinputportbytag( "ROW10" ); |
| 1341 | value &= ~input_port_read(machine, "ROW10" ); |
| 1341 | 1342 | c128_keyline[2] = value; |
| 1342 | 1343 | |
| 1343 | 1344 | /* 2008 FP: still unsure which frame_interrupt must be used for c65, since it's not_working */ |
| 1344 | 1345 | /* if (is_c65(machine)) { |
| 1345 | 1346 | value = 0xff; |
| 1346 | 1347 | |
| 1347 | | value &= ~readinputportbytag( "ROW8" ); |
| 1348 | value &= ~input_port_read(machine, "ROW8" ); |
| 1348 | 1349 | c65_keyline = value; |
| 1349 | 1350 | }*/ |
| 1350 | 1351 | |
| r2340 | r2341 | |
| 1355 | 1356 | vc20_tape_config (DATASSETTE, DATASSETTE_TONE); |
| 1356 | 1357 | vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP); |
| 1357 | 1358 | } |
| 1358 | | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , readinputportbytag( "Special" ) & 0x40 ? 1 : 0); |
| 1359 | set_led_status (1 /*KB_CAPSLOCK_FLAG */ , input_port_read(machine, "Special" ) & 0x40 ? 1 : 0); |
| 1359 | 1360 | set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0); |
| 1360 | 1361 | } |
src/mess/machine/ti99_4x.c
| r2340 | r2341 | |
| 792 | 792 | else if (ti99_model == model_99_4p) |
| 793 | 793 | xRAM_kind = xRAM_kind_99_4p_1Mb; /* hack */ |
| 794 | 794 | else |
| 795 | | xRAM_kind = (readinputport(input_port_config) >> config_xRAM_bit) & config_xRAM_mask; |
| 795 | xRAM_kind = (input_port_read_indexed(machine, input_port_config) >> config_xRAM_bit) & config_xRAM_mask; |
| 796 | 796 | if (ti99_model == model_99_8) |
| 797 | 797 | has_speech = TRUE; |
| 798 | 798 | else |
| 799 | | has_speech = (readinputport(input_port_config) >> config_speech_bit) & config_speech_mask; |
| 800 | | fdc_kind = (readinputport(input_port_config) >> config_fdc_bit) & config_fdc_mask; |
| 801 | | has_ide = (readinputport(input_port_config) >> config_ide_bit) & config_ide_mask; |
| 802 | | has_rs232 = (readinputport(input_port_config) >> config_rs232_bit) & config_rs232_mask; |
| 803 | | has_handset = (ti99_model == model_99_4) && ((readinputport(input_port_config) >> config_handsets_bit) & config_handsets_mask); |
| 804 | | has_hsgpl = (ti99_model == model_99_4p) || ((readinputport(input_port_config) >> config_hsgpl_bit) & config_hsgpl_mask); |
| 805 | | has_usb_sm = (readinputport(input_port_config) >> config_usbsm_bit) & config_usbsm_mask; |
| 799 | has_speech = (input_port_read_indexed(machine, input_port_config) >> config_speech_bit) & config_speech_mask; |
| 800 | fdc_kind = (input_port_read_indexed(machine, input_port_config) >> config_fdc_bit) & config_fdc_mask; |
| 801 | has_ide = (input_port_read_indexed(machine, input_port_config) >> config_ide_bit) & config_ide_mask; |
| 802 | has_rs232 = (input_port_read_indexed(machine, input_port_config) >> config_rs232_bit) & config_rs232_mask; |
| 803 | has_handset = (ti99_model == model_99_4) && ((input_port_read_indexed(machine, input_port_config) >> config_handsets_bit) & config_handsets_mask); |
| 804 | has_hsgpl = (ti99_model == model_99_4p) || ((input_port_read_indexed(machine, input_port_config) >> config_hsgpl_bit) & config_hsgpl_mask); |
| 805 | has_usb_sm = (input_port_read_indexed(machine, input_port_config) >> config_usbsm_bit) & config_usbsm_mask; |
| 806 | 806 | |
| 807 | 807 | /* set up optional expansion hardware */ |
| 808 | 808 | ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL); |
| r2340 | r2341 | |
| 947 | 947 | TMS9928A_interrupt(); |
| 948 | 948 | if (has_handset) |
| 949 | 949 | ti99_handset_task(); |
| 950 | | has_mecmouse = (readinputport(input_port_config) >> config_mecmouse_bit) & config_mecmouse_mask; |
| 950 | has_mecmouse = (input_port_read_indexed(machine, input_port_config) >> config_mecmouse_bit) & config_mecmouse_mask; |
| 951 | 951 | if (has_mecmouse) |
| 952 | 952 | mecmouse_poll(); |
| 953 | 953 | } |
| r2340 | r2341 | |
| 959 | 959 | if (++line_count == 262) |
| 960 | 960 | { |
| 961 | 961 | line_count = 0; |
| 962 | | has_mecmouse = (readinputport(input_port_config) >> config_mecmouse_bit) & config_mecmouse_mask; |
| 962 | has_mecmouse = (input_port_read_indexed(machine, input_port_config) >> config_mecmouse_bit) & config_mecmouse_mask; |
| 963 | 963 | if (has_mecmouse) |
| 964 | 964 | mecmouse_poll(); |
| 965 | 965 | } |
| r2340 | r2341 | |
| 1815 | 1815 | */ |
| 1816 | 1816 | static int ti99_handset_poll_keyboard(int num) |
| 1817 | 1817 | { |
| 1818 | running_machine *machine = Machine; |
| 1818 | 1819 | static UINT8 previous_key[max_handsets]; |
| 1819 | 1820 | |
| 1820 | 1821 | UINT32 key_buf; |
| r2340 | r2341 | |
| 1823 | 1824 | |
| 1824 | 1825 | |
| 1825 | 1826 | /* read current key state */ |
| 1826 | | key_buf = ( readinputport(input_port_IR_keypads+num) |
| 1827 | | | (readinputport(input_port_IR_keypads+num+1) << 16) ) >> (4*num); |
| 1827 | key_buf = ( input_port_read_indexed(machine, input_port_IR_keypads+num) |
| 1828 | | (input_port_read_indexed(machine, input_port_IR_keypads+num+1) << 16) ) >> (4*num); |
| 1828 | 1829 | |
| 1829 | 1830 | /* If a key was previously pressed, this key was not shift, and this key is |
| 1830 | 1831 | still down, then don't change the current key press. */ |
| r2340 | r2341 | |
| 1897 | 1898 | static int ti99_handset_poll_joystick(int num) |
| 1898 | 1899 | { |
| 1899 | 1900 | static UINT8 previous_joy[max_handsets]; |
| 1901 | running_machine *machine = Machine; |
| 1900 | 1902 | UINT8 current_joy; |
| 1901 | 1903 | int current_joy_x, current_joy_y; |
| 1902 | 1904 | int message; |
| 1903 | 1905 | |
| 1904 | 1906 | /* read joystick position */ |
| 1905 | | current_joy_x = readinputport(input_port_IR_joysticks+2*num); |
| 1906 | | current_joy_y = readinputport(input_port_IR_joysticks+2*num+1); |
| 1907 | current_joy_x = input_port_read_indexed(machine, input_port_IR_joysticks+2*num); |
| 1908 | current_joy_y = input_port_read_indexed(machine, input_port_IR_joysticks+2*num+1); |
| 1907 | 1909 | /* compare with last saved position */ |
| 1908 | 1910 | current_joy = current_joy_x | (current_joy_y << 4); |
| 1909 | 1911 | if (current_joy != previous_joy[num]) |
| r2340 | r2341 | |
| 2085 | 2087 | static void mecmouse_poll(void) |
| 2086 | 2088 | { |
| 2087 | 2089 | static int last_mx = 0, last_my = 0; |
| 2090 | running_machine *machine = Machine; |
| 2088 | 2091 | int new_mx, new_my; |
| 2089 | 2092 | int delta_x, delta_y; |
| 2090 | 2093 | |
| 2091 | | new_mx = readinputport(input_port_mousex); |
| 2092 | | new_my = readinputport(input_port_mousey); |
| 2094 | new_mx = input_port_read_indexed(machine, input_port_mousex); |
| 2095 | new_my = input_port_read_indexed(machine, input_port_mousey); |
| 2093 | 2096 | |
| 2094 | 2097 | /* compute x delta */ |
| 2095 | 2098 | delta_x = new_mx - last_mx; |
| r2340 | r2341 | |
| 2218 | 2221 | */ |
| 2219 | 2222 | static int ti99_R9901_0(int offset) |
| 2220 | 2223 | { |
| 2224 | running_machine *machine = Machine; |
| 2221 | 2225 | int answer; |
| 2222 | 2226 | |
| 2223 | | |
| 2224 | 2227 | if ((ti99_model == model_99_4) && (KeyCol == 7)) |
| 2225 | 2228 | answer = (ti99_handset_poll_bus() << 3) | 0x80; |
| 2226 | 2229 | else if (has_mecmouse && (KeyCol == ((ti99_model == model_99_4) ? 6 : 7))) |
| 2227 | 2230 | { |
| 2228 | | int buttons = readinputport(input_port_mouse_buttons) & 3; |
| 2231 | int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3; |
| 2229 | 2232 | |
| 2230 | 2233 | answer = (mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 4; |
| 2231 | 2234 | |
| r2340 | r2341 | |
| 2237 | 2240 | answer |= 0x80; |
| 2238 | 2241 | } |
| 2239 | 2242 | else |
| 2240 | | answer = ((readinputport(input_port_keyboard + (KeyCol >> 1)) >> ((KeyCol & 1) * 8)) << 3) & 0xF8; |
| 2243 | answer = ((input_port_read_indexed(machine, input_port_keyboard + (KeyCol >> 1)) >> ((KeyCol & 1) * 8)) << 3) & 0xF8; |
| 2241 | 2244 | |
| 2242 | 2245 | if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p)) |
| 2243 | 2246 | { |
| 2244 | 2247 | if (! AlphaLockLine) |
| 2245 | | answer &= ~ (readinputport(input_port_caps_lock) << 3); |
| 2248 | answer &= ~ (input_port_read_indexed(machine, input_port_caps_lock) << 3); |
| 2246 | 2249 | } |
| 2247 | 2250 | |
| 2248 | 2251 | return answer; |
| r2340 | r2341 | |
| 2259 | 2262 | */ |
| 2260 | 2263 | static int ti99_R9901_1(int offset) |
| 2261 | 2264 | { |
| 2265 | running_machine *machine = Machine; |
| 2262 | 2266 | int answer; |
| 2263 | 2267 | |
| 2264 | | |
| 2265 | 2268 | if (/*(ti99_model == model_99_4) &&*/ (KeyCol == 7)) |
| 2266 | 2269 | answer = 0x07; |
| 2267 | 2270 | else |
| 2268 | | answer = ((readinputport(input_port_keyboard + (KeyCol >> 1)) >> ((KeyCol & 1) * 8)) >> 5) & 0x07; |
| 2271 | answer = ((input_port_read_indexed(machine, input_port_keyboard + (KeyCol >> 1)) >> ((KeyCol & 1) * 8)) >> 5) & 0x07; |
| 2269 | 2272 | |
| 2270 | 2273 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 2271 | 2274 | /*if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0) |
| r2340 | r2341 | |
| 2343 | 2346 | */ |
| 2344 | 2347 | static int ti99_8_R9901_0(int offset) |
| 2345 | 2348 | { |
| 2349 | running_machine *machine = Machine; |
| 2346 | 2350 | int answer; |
| 2347 | 2351 | |
| 2348 | | |
| 2349 | 2352 | if (has_mecmouse && (KeyCol == 15)) |
| 2350 | 2353 | { |
| 2351 | | int buttons = readinputport(input_port_mouse_buttons) & 3; |
| 2354 | int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3; |
| 2352 | 2355 | |
| 2353 | 2356 | answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 7) & 0x80; |
| 2354 | 2357 | |
| r2340 | r2341 | |
| 2357 | 2360 | answer |= 0x40; |
| 2358 | 2361 | } |
| 2359 | 2362 | else |
| 2360 | | answer = (readinputport(input_port_keyboard + KeyCol) << 6) & 0xC0; |
| 2363 | answer = (input_port_read_indexed(machine, input_port_keyboard + KeyCol) << 6) & 0xC0; |
| 2361 | 2364 | |
| 2362 | 2365 | return answer; |
| 2363 | 2366 | } |
| r2340 | r2341 | |
| 2373 | 2376 | */ |
| 2374 | 2377 | static int ti99_8_R9901_1(int offset) |
| 2375 | 2378 | { |
| 2379 | running_machine *machine = Machine; |
| 2376 | 2380 | int answer; |
| 2377 | 2381 | |
| 2378 | | |
| 2379 | 2382 | if (has_mecmouse && (KeyCol == 15)) |
| 2380 | 2383 | { |
| 2381 | | int buttons = readinputport(input_port_mouse_buttons) & 3; |
| 2384 | int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3; |
| 2382 | 2385 | |
| 2383 | 2386 | answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 1) & 0x03; |
| 2384 | 2387 | |
| r2340 | r2341 | |
| 2387 | 2390 | answer |= 0x04; |
| 2388 | 2391 | } |
| 2389 | 2392 | else |
| 2390 | | answer = (readinputport(input_port_keyboard + KeyCol) >> 2) & 0x07; |
| 2393 | answer = (input_port_read_indexed(machine, input_port_keyboard + KeyCol) >> 2) & 0x07; |
| 2391 | 2394 | |
| 2392 | 2395 | /* we don't take CS2 into account, as CS2 is a write-only unit */ |
| 2393 | 2396 | /*if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0) |
src/mess/machine/bbc.c
| r2340 | r2341 | |
| 765 | 765 | /* set the value of via_system ca2, by checking for any keys |
| 766 | 766 | being pressed on the selected column */ |
| 767 | 767 | |
| 768 | | if ((readinputport(column)|0x01)!=0xff) |
| 768 | if ((input_port_read_indexed(machine, column)|0x01)!=0xff) |
| 769 | 769 | { |
| 770 | 770 | via_0_ca2_w(machine, 0,1); |
| 771 | 771 | } else { |
| r2340 | r2341 | |
| 797 | 797 | /* set the value of via_system ca2, by checking for any keys |
| 798 | 798 | being pressed on the selected column */ |
| 799 | 799 | |
| 800 | | if ((readinputport(column)|0x01)!=0xff) |
| 800 | if ((input_port_read_indexed(machine, column)|0x01)!=0xff) |
| 801 | 801 | { |
| 802 | 802 | via_0_ca2_w(machine, 0,1); |
| 803 | 803 | } else { |
| r2340 | r2341 | |
| 823 | 823 | bit=0; |
| 824 | 824 | |
| 825 | 825 | if (column<10) { |
| 826 | | res=readinputport(column); |
| 826 | res=input_port_read_indexed(machine, column); |
| 827 | 827 | } else { |
| 828 | 828 | res=0xff; |
| 829 | 829 | } |
| r2340 | r2341 | |
| 1101 | 1101 | //{ |
| 1102 | 1102 | // TMSint=(!status)&1; |
| 1103 | 1103 | // TMSrdy=(!tms5220_ready_r())&1; |
| 1104 | | // via_0_portb_w(0,(0xf | readinputport(16)|(TMSint<<6)|(TMSrdy<<7))); |
| 1104 | // via_0_portb_w(0,(0xf | input_port_read_indexed(machine, 16)|(TMSint<<6)|(TMSrdy<<7))); |
| 1105 | 1105 | //} |
| 1106 | 1106 | |
| 1107 | 1107 | |
| r2340 | r2341 | |
| 1111 | 1111 | // TMSint=(!tms5220_int_r())&1; |
| 1112 | 1112 | // TMSrdy=(!tms5220_ready_r())&1; |
| 1113 | 1113 | |
| 1114 | | //logerror("SYSTEM read portb %d\n",0xf | readinputport(16)|(TMSint<<6)|(TMSrdy<<7)); |
| 1114 | //logerror("SYSTEM read portb %d\n",0xf | input_port_read_indexed(machine, 16)|(TMSint<<6)|(TMSrdy<<7)); |
| 1115 | 1115 | |
| 1116 | | return (0xf | readinputport(16)|(TMSint<<6)|(TMSrdy<<7)); |
| 1116 | return (0xf | input_port_read_indexed(machine, 16)|(TMSint<<6)|(TMSrdy<<7)); |
| 1117 | 1117 | |
| 1118 | 1118 | |
| 1119 | 1119 | } |
| r2340 | r2341 | |
| 1287 | 1287 | switch(channel_number) |
| 1288 | 1288 | { |
| 1289 | 1289 | case 0: |
| 1290 | | return ((0xff-readinputport(17))<<8); |
| 1290 | return ((0xff-input_port_read_indexed(Machine, 17))<<8); |
| 1291 | 1291 | break; |
| 1292 | 1292 | case 1: |
| 1293 | | return ((0xff-readinputport(18))<<8); |
| 1293 | return ((0xff-input_port_read_indexed(Machine, 18))<<8); |
| 1294 | 1294 | break; |
| 1295 | 1295 | case 2: |
| 1296 | | return ((0xff-readinputport(19))<<8); |
| 1296 | return ((0xff-input_port_read_indexed(Machine, 19))<<8); |
| 1297 | 1297 | break; |
| 1298 | 1298 | case 3: |
| 1299 | | return ((0xff-readinputport(20))<<8); |
| 1299 | return ((0xff-input_port_read_indexed(Machine, 20))<<8); |
| 1300 | 1300 | break; |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| r2340 | r2341 | |
| 2124 | 2124 | { |
| 2125 | 2125 | //removed from here because MACHINE_START can no longer read DIP swiches. |
| 2126 | 2126 | //put in MACHINE_RESET instead. |
| 2127 | | //bbc_DFSType= (readinputportbytag("BBCCONFIG")>>0)&0x07; |
| 2128 | | //bbc_SWRAMtype=(readinputportbytag("BBCCONFIG")>>3)&0x03; |
| 2129 | | //bbc_RAMSize= (readinputportbytag("BBCCONFIG")>>5)&0x01; |
| 2127 | //bbc_DFSType= (input_port_read(machine, "BBCCONFIG")>>0)&0x07; |
| 2128 | //bbc_SWRAMtype=(input_port_read(machine, "BBCCONFIG")>>3)&0x03; |
| 2129 | //bbc_RAMSize= (input_port_read(machine, "BBCCONFIG")>>5)&0x01; |
| 2130 | 2130 | |
| 2131 | 2131 | via_config(0, &bbcb_system_via); |
| 2132 | 2132 | via_set_clock(0,1000000); |
| r2340 | r2341 | |
| 2149 | 2149 | |
| 2150 | 2150 | MACHINE_RESET( bbcb ) |
| 2151 | 2151 | { |
| 2152 | | bbc_DFSType= (readinputportbytag("BBCCONFIG")>>0)&0x07; |
| 2153 | | bbc_SWRAMtype=(readinputportbytag("BBCCONFIG")>>3)&0x03; |
| 2154 | | bbc_RAMSize= (readinputportbytag("BBCCONFIG")>>5)&0x01; |
| 2152 | bbc_DFSType= (input_port_read(machine, "BBCCONFIG")>>0)&0x07; |
| 2153 | bbc_SWRAMtype=(input_port_read(machine, "BBCCONFIG")>>3)&0x03; |
| 2154 | bbc_RAMSize= (input_port_read(machine, "BBCCONFIG")>>5)&0x01; |
| 2155 | 2155 | |
| 2156 | 2156 | memory_set_bankptr(1,memory_region(REGION_CPU1)); |
| 2157 | 2157 | if (bbc_RAMSize) |
src/mess/machine/vtech2.c
| r2340 | r2341 | |
| 14 | 14 | ****************************************************************************/ |
| 15 | 15 | |
| 16 | 16 | #include "driver.h" |
| 17 | #include "deprecat.h" |
| 17 | 18 | #include "includes/vtech2.h" |
| 18 | 19 | #include "devices/cassette.h" |
| 19 | 20 | #include "sound/speaker.h" |
| r2340 | r2341 | |
| 224 | 225 | static int row_a,row_b,row_c,row_d; |
| 225 | 226 | if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */ |
| 226 | 227 | { |
| 227 | | if( readinputport( 8) != row_a ) |
| 228 | if( input_port_read_indexed(Machine, 8) != row_a ) |
| 228 | 229 | { |
| 229 | | row_a = readinputport(8); |
| 230 | row_a = input_port_read_indexed(Machine, 8); |
| 230 | 231 | data &= row_a; |
| 231 | 232 | } |
| 232 | 233 | } |
| 233 | 234 | if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */ |
| 234 | 235 | { |
| 235 | | if( readinputport( 9) != row_b ) |
| 236 | if( input_port_read_indexed(Machine, 9) != row_b ) |
| 236 | 237 | { |
| 237 | | row_b = readinputport( 9); |
| 238 | row_b = input_port_read_indexed(Machine, 9); |
| 238 | 239 | data &= row_b; |
| 239 | 240 | } |
| 240 | 241 | } |
| 241 | 242 | if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */ |
| 242 | 243 | { |
| 243 | | if( readinputport(10) != row_c ) |
| 244 | if( input_port_read_indexed(Machine, 10) != row_c ) |
| 244 | 245 | { |
| 245 | | row_c = readinputport(10); |
| 246 | row_c = input_port_read_indexed(Machine, 10); |
| 246 | 247 | data &= row_c; |
| 247 | 248 | } |
| 248 | 249 | } |
| 249 | 250 | if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */ |
| 250 | 251 | { |
| 251 | | if( readinputport(11) != row_d ) |
| 252 | if( input_port_read_indexed(Machine, 11) != row_d ) |
| 252 | 253 | { |
| 253 | | row_d = readinputport(11); |
| 254 | row_d = input_port_read_indexed(Machine, 11); |
| 254 | 255 | data &= row_d; |
| 255 | 256 | } |
| 256 | 257 | } |
| r2340 | r2341 | |
| 259 | 260 | { |
| 260 | 261 | /* All Lasers keyboard rows 0 through 7 */ |
| 261 | 262 | if( !(offs & 0x01) ) |
| 262 | | data &= readinputport( 0); |
| 263 | data &= input_port_read_indexed(Machine, 0); |
| 263 | 264 | if( !(offs & 0x02) ) |
| 264 | | data &= readinputport( 1); |
| 265 | data &= input_port_read_indexed(Machine, 1); |
| 265 | 266 | if( !(offs & 0x04) ) |
| 266 | | data &= readinputport( 2); |
| 267 | data &= input_port_read_indexed(Machine, 2); |
| 267 | 268 | if( !(offs & 0x08) ) |
| 268 | | data &= readinputport( 3); |
| 269 | data &= input_port_read_indexed(Machine, 3); |
| 269 | 270 | if( !(offs & 0x10) ) |
| 270 | | data &= readinputport( 4); |
| 271 | data &= input_port_read_indexed(Machine, 4); |
| 271 | 272 | if( !(offs & 0x20) ) |
| 272 | | data &= readinputport( 5); |
| 273 | data &= input_port_read_indexed(Machine, 5); |
| 273 | 274 | if( !(offs & 0x40) ) |
| 274 | | data &= readinputport( 6); |
| 275 | data &= input_port_read_indexed(Machine, 6); |
| 275 | 276 | if( !(offs & 0x80) ) |
| 276 | | data &= readinputport( 7); |
| 277 | data &= input_port_read_indexed(Machine, 7); |
| 277 | 278 | } |
| 278 | 279 | |
| 279 | 280 | /* what's bit 7 good for? tape input maybe? */ |
src/mess/drivers/mk1.c
| r2340 | r2341 | |
| 55 | 55 | UINT8 data = mk1_f8[offset]; |
| 56 | 56 | |
| 57 | 57 | if ( offset == 0 ) { |
| 58 | | if ( data & 1 ) data |= readinputportbytag("LINE1"); |
| 59 | | if ( data & 2 ) data |= readinputportbytag("LINE2"); |
| 60 | | if ( data & 4 ) data |= readinputportbytag("LINE3"); |
| 61 | | if ( data & 8 ) data |= readinputportbytag("LINE4"); |
| 58 | if ( data & 1 ) data |= input_port_read(machine, "LINE1"); |
| 59 | if ( data & 2 ) data |= input_port_read(machine, "LINE2"); |
| 60 | if ( data & 4 ) data |= input_port_read(machine, "LINE3"); |
| 61 | if ( data & 8 ) data |= input_port_read(machine, "LINE4"); |
| 62 | 62 | if ( data & 0x10 ) { |
| 63 | | if ( readinputportbytag("LINE1") & 0x10 ) data |= 1; |
| 64 | | if ( readinputportbytag("LINE2") & 0x10 ) data |= 2; |
| 65 | | if ( readinputportbytag("LINE3") & 0x10 ) data |= 4; |
| 66 | | if ( readinputportbytag("LINE4") & 0x10 ) data |= 8; |
| 63 | if ( input_port_read(machine, "LINE1") & 0x10 ) data |= 1; |
| 64 | if ( input_port_read(machine, "LINE2") & 0x10 ) data |= 2; |
| 65 | if ( input_port_read(machine, "LINE3") & 0x10 ) data |= 4; |
| 66 | if ( input_port_read(machine, "LINE4") & 0x10 ) data |= 8; |
| 67 | 67 | } |
| 68 | 68 | if ( data & 0x20 ) { |
| 69 | | if ( readinputportbytag("LINE1") & 0x20 ) data |= 1; |
| 70 | | if ( readinputportbytag("LINE2") & 0x20 ) data |= 2; |
| 71 | | if ( readinputportbytag("LINE3") & 0x20 ) data |= 4; |
| 72 | | if ( readinputportbytag("LINE4") & 0x20 ) data |= 8; |
| 69 | if ( input_port_read(machine, "LINE1") & 0x20 ) data |= 1; |
| 70 | if ( input_port_read(machine, "LINE2") & 0x20 ) data |= 2; |
| 71 | if ( input_port_read(machine, "LINE3") & 0x20 ) data |= 4; |
| 72 | if ( input_port_read(machine, "LINE4") & 0x20 ) data |= 8; |
| 73 | 73 | } |
| 74 | 74 | if ( data & 0x40 ) { |
| 75 | | if ( readinputportbytag("LINE1") & 0x40 ) data |= 1; |
| 76 | | if ( readinputportbytag("LINE2") & 0x40 ) data |= 2; |
| 77 | | if ( readinputportbytag("LINE3") & 0x40 ) data |= 4; |
| 78 | | if ( readinputportbytag("LINE4") & 0x40 ) data |= 8; |
| 75 | if ( input_port_read(machine, "LINE1") & 0x40 ) data |= 1; |
| 76 | if ( input_port_read(machine, "LINE2") & 0x40 ) data |= 2; |
| 77 | if ( input_port_read(machine, "LINE3") & 0x40 ) data |= 4; |
| 78 | if ( input_port_read(machine, "LINE4") & 0x40 ) data |= 8; |
| 79 | 79 | } |
| 80 | 80 | if ( data & 0x80 ) { |
| 81 | | if ( readinputportbytag("LINE1") & 0x80 ) data |= 1; |
| 82 | | if ( readinputportbytag("LINE2") & 0x80 ) data |= 2; |
| 83 | | if ( readinputportbytag("LINE3") & 0x80 ) data |= 4; |
| 84 | | if ( readinputportbytag("LINE4") & 0x80 ) data |= 8; |
| 81 | if ( input_port_read(machine, "LINE1") & 0x80 ) data |= 1; |
| 82 | if ( input_port_read(machine, "LINE2") & 0x80 ) data |= 2; |
| 83 | if ( input_port_read(machine, "LINE3") & 0x80 ) data |= 4; |
| 84 | if ( input_port_read(machine, "LINE4") & 0x80 ) data |= 8; |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | return data; |
src/mess/drivers/x68k.c
| r2340 | r2341 | |
| 469 | 469 | { |
| 470 | 470 | sys.keyboard.keytime[x] -= 5; |
| 471 | 471 | } |
| 472 | | if(!(readinputportbytag(port) & (1 << (x % 32)))) |
| 472 | if(!(input_port_read(machine, port) & (1 << (x % 32)))) |
| 473 | 473 | { |
| 474 | 474 | if(sys.keyboard.keyon[x] != 0) |
| 475 | 475 | { |
| r2340 | r2341 | |
| 484 | 484 | if(sys.keyboard.keyon[x] != 0 && sys.keyboard.keytime[x] == 0 && sys.keyboard.last_pressed == x) |
| 485 | 485 | { |
| 486 | 486 | sprintf(port, "key%d", (sys.keyboard.last_pressed / 32) + 1); |
| 487 | | if(readinputportbytag(port) & (1 << (sys.keyboard.last_pressed % 32))) |
| 487 | if(input_port_read(machine, port) & (1 << (sys.keyboard.last_pressed % 32))) |
| 488 | 488 | { |
| 489 | 489 | x68k_keyboard_push_scancode(sys.keyboard.last_pressed); |
| 490 | 490 | sys.keyboard.keytime[sys.keyboard.last_pressed] = (sys.keyboard.repeat^2)*5+30; |
| r2340 | r2341 | |
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | sprintf(port, "key%d", (x / 32) + 1); |
| 495 | | if((readinputportbytag(port) & (1 << (x % 32)))) |
| 495 | if((input_port_read(machine, port) & (1 << (x % 32)))) |
| 496 | 496 | { |
| 497 | 497 | if(sys.keyboard.keyon[x] == 0) |
| 498 | 498 | { |
| r2340 | r2341 | |
| 522 | 522 | // mouse input |
| 523 | 523 | // port B of the Z8530 SCC |
| 524 | 524 | // typically read from the SCC data port on receive buffer full interrupt per byte |
| 525 | | static int x68k_read_mouse(void) |
| 525 | static int x68k_read_mouse(running_machine *machine) |
| 526 | 526 | { |
| 527 | 527 | char val = 0; |
| 528 | 528 | char ipt = 0; |
| r2340 | r2341 | |
| 530 | 530 | switch(sys.mouse.inputtype) |
| 531 | 531 | { |
| 532 | 532 | case 0: |
| 533 | | ipt = readinputportbytag("mouse1"); |
| 533 | ipt = input_port_read(machine, "mouse1"); |
| 534 | 534 | break; |
| 535 | 535 | case 1: |
| 536 | | val = readinputportbytag("mouse2"); |
| 536 | val = input_port_read(machine, "mouse2"); |
| 537 | 537 | ipt = val - sys.mouse.last_mouse_x; |
| 538 | 538 | sys.mouse.last_mouse_x = val; |
| 539 | 539 | break; |
| 540 | 540 | case 2: |
| 541 | | val = readinputportbytag("mouse3"); |
| 541 | val = input_port_read(machine, "mouse3"); |
| 542 | 542 | ipt = val - sys.mouse.last_mouse_y; |
| 543 | 543 | sys.mouse.last_mouse_y = val; |
| 544 | 544 | break; |
| r2340 | r2341 | |
| 571 | 571 | case 0: |
| 572 | 572 | return scc_r(machine, 0); |
| 573 | 573 | case 1: |
| 574 | | return x68k_read_mouse(); |
| 574 | return x68k_read_mouse(machine); |
| 575 | 575 | case 2: |
| 576 | 576 | return scc_r(machine, 1); |
| 577 | 577 | case 3: |
| r2340 | r2341 | |
| 643 | 643 | { |
| 644 | 644 | // Joystick 1 |
| 645 | 645 | if(sys.joy.joy1_enable == 0) |
| 646 | | return readinputportbytag("joy1"); |
| 646 | return input_port_read(machine, "joy1"); |
| 647 | 647 | else |
| 648 | 648 | return 0xff; |
| 649 | 649 | } |
| r2340 | r2341 | |
| 652 | 652 | { |
| 653 | 653 | // Joystick 2 |
| 654 | 654 | if(sys.joy.joy2_enable == 0) |
| 655 | | return readinputportbytag("joy2"); |
| 655 | return input_port_read(machine, "joy2"); |
| 656 | 656 | else |
| 657 | 657 | return 0xff; |
| 658 | 658 | } |
| r2340 | r2341 | |
| 1351 | 1351 | static READ16_HANDLER( x68k_exp_r ) |
| 1352 | 1352 | { |
| 1353 | 1353 | /* These are expansion devices, if not present, they cause a bus error */ |
| 1354 | | if(readinputportbytag("options") & 0x02) |
| 1354 | if(input_port_read(machine, "options") & 0x02) |
| 1355 | 1355 | { |
| 1356 | 1356 | current_vector[2] = 0x02; // bus error |
| 1357 | 1357 | current_irq_line = 2; |
| r2340 | r2341 | |
| 1367 | 1367 | static WRITE16_HANDLER( x68k_exp_w ) |
| 1368 | 1368 | { |
| 1369 | 1369 | /* These are expansion devices, if not present, they cause a bus error */ |
| 1370 | | if(readinputportbytag("options") & 0x02) |
| 1370 | if(input_port_read(machine, "options") & 0x02) |
| 1371 | 1371 | { |
| 1372 | 1372 | current_vector[2] = 0x02; // bus error |
| 1373 | 1373 | current_irq_line = 2; |
src/mess/drivers/spectrum.c
| r2340 | r2341 | |
| 229 | 229 | int lines = offset>>8; |
| 230 | 230 | int data = 0xff; |
| 231 | 231 | |
| 232 | | int cs_extra1 = readinputportbytag("PLUS0") & 0x1f; |
| 233 | | int cs_extra2 = readinputportbytag("PLUS1") & 0x1f; |
| 234 | | int cs_extra3 = readinputportbytag("PLUS2") & 0x1f; |
| 235 | | int ss_extra1 = readinputportbytag("PLUS3") & 0x1f; |
| 236 | | int ss_extra2 = readinputportbytag("PLUS4") & 0x1f; |
| 232 | int cs_extra1 = input_port_read(machine, "PLUS0") & 0x1f; |
| 233 | int cs_extra2 = input_port_read(machine, "PLUS1") & 0x1f; |
| 234 | int cs_extra3 = input_port_read(machine, "PLUS2") & 0x1f; |
| 235 | int ss_extra1 = input_port_read(machine, "PLUS3") & 0x1f; |
| 236 | int ss_extra2 = input_port_read(machine, "PLUS4") & 0x1f; |
| 237 | 237 | |
| 238 | | if ( readinputportbytag("MOTOR") & 0x01 ) { |
| 238 | if ( input_port_read(machine, "MOTOR") & 0x01 ) { |
| 239 | 239 | if ( motor_toggle_previous == 0 ) { |
| 240 | 240 | cassette_motor_mode = cassette_motor_mode ^ 0x01; |
| 241 | 241 | cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), cassette_motor_mode ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); |
| r2340 | r2341 | |
| 248 | 248 | /* Caps - V */ |
| 249 | 249 | if ((lines & 1)==0) |
| 250 | 250 | { |
| 251 | | data &= readinputportbytag("LINE0"); |
| 251 | data &= input_port_read(machine, "LINE0"); |
| 252 | 252 | /* CAPS for extra keys */ |
| 253 | 253 | if (cs_extra1 != 0x1f || cs_extra2 != 0x1f || cs_extra3 != 0x1f) |
| 254 | 254 | data &= ~0x01; |
| r2340 | r2341 | |
| 256 | 256 | |
| 257 | 257 | /* A - G */ |
| 258 | 258 | if ((lines & 2)==0) |
| 259 | | data &= readinputportbytag("LINE1"); |
| 259 | data &= input_port_read(machine, "LINE1"); |
| 260 | 260 | |
| 261 | 261 | /* Q - T */ |
| 262 | 262 | if ((lines & 4)==0) |
| 263 | | data &= readinputportbytag("LINE2"); |
| 263 | data &= input_port_read(machine, "LINE2"); |
| 264 | 264 | |
| 265 | 265 | /* 1 - 5 */ |
| 266 | 266 | if ((lines & 8)==0) |
| 267 | | data &= readinputportbytag("LINE3") & cs_extra1; |
| 267 | data &= input_port_read(machine, "LINE3") & cs_extra1; |
| 268 | 268 | |
| 269 | 269 | /* 6 - 0 */ |
| 270 | 270 | if ((lines & 16)==0) |
| 271 | | data &= readinputportbytag("LINE4") & cs_extra2; |
| 271 | data &= input_port_read(machine, "LINE4") & cs_extra2; |
| 272 | 272 | |
| 273 | 273 | /* Y - P */ |
| 274 | 274 | if ((lines & 32)==0) |
| 275 | | data &= readinputportbytag("LINE5") & ss_extra1; |
| 275 | data &= input_port_read(machine, "LINE5") & ss_extra1; |
| 276 | 276 | |
| 277 | 277 | /* H - Enter */ |
| 278 | 278 | if ((lines & 64)==0) |
| 279 | | data &= readinputportbytag("LINE6"); |
| 279 | data &= input_port_read(machine, "LINE6"); |
| 280 | 280 | |
| 281 | 281 | /* B - Space */ |
| 282 | 282 | if ((lines & 128)==0) |
| 283 | 283 | { |
| 284 | | data &= readinputportbytag("LINE7") & cs_extra3 & ss_extra2; |
| 284 | data &= input_port_read(machine, "LINE7") & cs_extra3 & ss_extra2; |
| 285 | 285 | /* SYMBOL SHIFT for extra keys */ |
| 286 | 286 | if (ss_extra1 != 0x1f || ss_extra2 != 0x1f) |
| 287 | 287 | data &= ~0x02; |
| r2340 | r2341 | |
| 297 | 297 | |
| 298 | 298 | /* Issue 2 Spectrums default to having bits 5, 6 & 7 set. |
| 299 | 299 | Issue 3 Spectrums default to having bits 5 & 7 set and bit 6 reset. */ |
| 300 | | if (readinputportbytag("CONFIG") & 0x80) |
| 300 | if (input_port_read(machine, "CONFIG") & 0x80) |
| 301 | 301 | data ^= (0x40); |
| 302 | 302 | return data; |
| 303 | 303 | } |
| r2340 | r2341 | |
| 305 | 305 | /* kempston joystick interface */ |
| 306 | 306 | static READ8_HANDLER(spectrum_port_1f_r) |
| 307 | 307 | { |
| 308 | | return readinputportbytag("KEMPSTON") & 0x1f; |
| 308 | return input_port_read(machine, "KEMPSTON") & 0x1f; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /* fuller joystick interface */ |
| 312 | 312 | static READ8_HANDLER(spectrum_port_7f_r) |
| 313 | 313 | { |
| 314 | | return readinputportbytag("FULLER") | (0xff^0x8f); |
| 314 | return input_port_read(machine, "FULLER") | (0xff^0x8f); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /* mikrogen joystick interface */ |
| 318 | 318 | static READ8_HANDLER(spectrum_port_df_r) |
| 319 | 319 | { |
| 320 | | return readinputportbytag("MIKROGEN") | (0xff^0x1f); |
| 320 | return input_port_read(machine, "MIKROGEN") | (0xff^0x1f); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | static READ8_HANDLER ( spectrum_port_r ) |
| r2340 | r2341 | |
| 568 | 568 | |
| 569 | 569 | static WRITE8_HANDLER(spectrum_plus3_port_3ffd_w) |
| 570 | 570 | { |
| 571 | | if (~readinputportbytag("CONFIG") & 0x20) |
| 571 | if (~input_port_read(machine, "CONFIG") & 0x20) |
| 572 | 572 | nec765_data_w(machine, 0,data); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | static READ8_HANDLER(spectrum_plus3_port_3ffd_r) |
| 576 | 576 | { |
| 577 | | if (readinputportbytag("CONFIG") & 0x20) |
| 577 | if (input_port_read(machine, "CONFIG") & 0x20) |
| 578 | 578 | return 0xff; |
| 579 | 579 | else |
| 580 | 580 | return nec765_data_r(machine, 0); |
| r2340 | r2341 | |
| 583 | 583 | |
| 584 | 584 | static READ8_HANDLER(spectrum_plus3_port_2ffd_r) |
| 585 | 585 | { |
| 586 | | if (readinputportbytag("CONFIG") & 0x20) |
| 586 | if (input_port_read(machine, "CONFIG") & 0x20) |
| 587 | 587 | return 0xff; |
| 588 | 588 | else |
| 589 | 589 | return nec765_status_r(machine, 0); |
src/mess/drivers/super80.c
| r2340 | r2341 | |
| 211 | 211 | static VIDEO_EOF( super80m ) |
| 212 | 212 | { |
| 213 | 213 | /* if we chose another palette or colour mode, enable it */ |
| 214 | | UINT8 chosen_palette = (readinputportbytag("CONFIG") & 0x60)>>5; // read colour dipswitches |
| 214 | UINT8 chosen_palette = (input_port_read(machine, "CONFIG") & 0x60)>>5; // read colour dipswitches |
| 215 | 215 | |
| 216 | 216 | if (chosen_palette != current_palette) // any changes? |
| 217 | 217 | { |
| r2340 | r2341 | |
| 228 | 228 | UINT8 x, y, code=32, screen_on=0; |
| 229 | 229 | UINT8 mask = screen->machine->gfx[0]->total_elements - 1; /* 0x3F for super80; 0xFF for super80d & super80e */ |
| 230 | 230 | |
| 231 | | if ((super80_mhz == 1) || (!(readinputportbytag("CONFIG") & 4))) /* bit 2 of port F0 is high, OR user turned on config switch */ |
| 231 | if ((super80_mhz == 1) || (!(input_port_read(screen->machine, "CONFIG") & 4))) /* bit 2 of port F0 is high, OR user turned on config switch */ |
| 232 | 232 | screen_on++; |
| 233 | 233 | |
| 234 | 234 | /* display the picture */ |
| r2340 | r2341 | |
| 249 | 249 | |
| 250 | 250 | static VIDEO_UPDATE( super80m ) |
| 251 | 251 | { |
| 252 | | UINT8 x, y, code=32, col=0, screen_on=0, options=readinputportbytag("CONFIG"); |
| 252 | UINT8 x, y, code=32, col=0, screen_on=0, options=input_port_read(screen->machine, "CONFIG"); |
| 253 | 253 | |
| 254 | 254 | /* get selected character generator */ |
| 255 | 255 | UINT8 cgen = current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */ |
| r2340 | r2341 | |
| 291 | 291 | UINT8 speed = mc6845_reg[10]&0x20, flash = mc6845_reg[10]&0x40; // cursor modes |
| 292 | 292 | UINT16 cursor = (mc6845_reg[14]<<8) | mc6845_reg[15]; // get cursor position |
| 293 | 293 | UINT16 screen_home = (mc6845_reg[12]<<8) | mc6845_reg[13]; // screen home offset (usually zero) |
| 294 | | UINT8 options=readinputportbytag("CONFIG"); |
| 294 | UINT8 options=input_port_read(screen->machine, "CONFIG"); |
| 295 | 295 | framecnt++; |
| 296 | 296 | |
| 297 | 297 | /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines, |
| r2340 | r2341 | |
| 380 | 380 | cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 381 | 381 | |
| 382 | 382 | /* does user want to hear the sound? */ |
| 383 | | if (readinputportbytag("CONFIG") & 8) |
| 383 | if (input_port_read(Machine, "CONFIG") & 8) |
| 384 | 384 | cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER); |
| 385 | 385 | else |
| 386 | 386 | cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER); |
| r2340 | r2341 | |
| 409 | 409 | for ( i=0; i < 8;i++) |
| 410 | 410 | { |
| 411 | 411 | sprintf(port, "LINE%d", i); |
| 412 | | if (!(out_f8 & mask)) in_fa &= readinputportbytag(port); |
| 412 | if (!(out_f8 & mask)) in_fa &= input_port_read(machine, port); |
| 413 | 413 | mask<<=1; |
| 414 | 414 | } |
| 415 | 415 | |
| r2340 | r2341 | |
| 440 | 440 | |
| 441 | 441 | static READ8_HANDLER( super80_f2_r ) |
| 442 | 442 | { |
| 443 | | UINT8 data = readinputportbytag("DSW") & 0xf0; // dip switches on pcb |
| 443 | UINT8 data = input_port_read(machine, "DSW") & 0xf0; // dip switches on pcb |
| 444 | 444 | data |= cass_out; // bit 0 = output of U1, bit 1 = current wave_state |
| 445 | 445 | data |= 0x0c; // bits 2,3 - not used |
| 446 | 446 | return data; |
| r2340 | r2341 | |
| 750 | 750 | static TIMER_CALLBACK( super80_halfspeed ) |
| 751 | 751 | { |
| 752 | 752 | UINT8 go_fast = 0; |
| 753 | | if ((super80_mhz == 2) || (!(readinputportbytag("CONFIG") & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */ |
| 753 | if ((super80_mhz == 2) || (!(input_port_read(machine, "CONFIG") & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */ |
| 754 | 754 | go_fast++; |
| 755 | 755 | |
| 756 | 756 | /* code to slow down computer to 1mhz by halting cpu on every second frame */ |
| r2340 | r2341 | |
| 952 | 952 | |
| 953 | 953 | static QUICKLOAD_LOAD( super80 ) |
| 954 | 954 | { |
| 955 | | UINT8 sw = readinputportbytag("CONFIG") & 1; /* reading the dipswitch: 1 = autorun */ |
| 955 | UINT8 sw = input_port_read(machine, "CONFIG") & 1; /* reading the dipswitch: 1 = autorun */ |
| 956 | 956 | UINT16 exec_addr, start_addr, end_addr; |
| 957 | 957 | |
| 958 | 958 | if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL) |
src/mess/drivers/atarist.c
| r2340 | r2341 | |
| 315 | 315 | |
| 316 | 316 | */ |
| 317 | 317 | |
| 318 | | return (ikbd.tx << 3) | (readinputportbytag_safe("IKBD_JOY1", 0xff) & 0x06); |
| 318 | return (ikbd.tx << 3) | (input_port_read_safe(machine, "IKBD_JOY1", 0xff) & 0x06); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | static WRITE8_HANDLER( ikbd_port2_w ) |
| r2340 | r2341 | |
| 354 | 354 | |
| 355 | 355 | set_led_status(1, data & 0x01); |
| 356 | 356 | |
| 357 | | if (~data & 0x02) ikbd.keylatch = readinputportbytag("P31"); |
| 358 | | if (~data & 0x04) ikbd.keylatch = readinputportbytag("P32"); |
| 359 | | if (~data & 0x08) ikbd.keylatch = readinputportbytag("P33"); |
| 360 | | if (~data & 0x10) ikbd.keylatch = readinputportbytag("P34"); |
| 361 | | if (~data & 0x20) ikbd.keylatch = readinputportbytag("P35"); |
| 362 | | if (~data & 0x40) ikbd.keylatch = readinputportbytag("P36"); |
| 363 | | if (~data & 0x80) ikbd.keylatch = readinputportbytag("P37"); |
| 357 | if (~data & 0x02) ikbd.keylatch = input_port_read(machine, "P31"); |
| 358 | if (~data & 0x04) ikbd.keylatch = input_port_read(machine, "P32"); |
| 359 | if (~data & 0x08) ikbd.keylatch = input_port_read(machine, "P33"); |
| 360 | if (~data & 0x10) ikbd.keylatch = input_port_read(machine, "P34"); |
| 361 | if (~data & 0x20) ikbd.keylatch = input_port_read(machine, "P35"); |
| 362 | if (~data & 0x40) ikbd.keylatch = input_port_read(machine, "P36"); |
| 363 | if (~data & 0x80) ikbd.keylatch = input_port_read(machine, "P37"); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | static READ8_HANDLER( ikbd_port4_r ) |
| r2340 | r2341 | |
| 380 | 380 | |
| 381 | 381 | */ |
| 382 | 382 | |
| 383 | | if (readinputportbytag("config") & 0x01) |
| 383 | if (input_port_read(machine, "config") & 0x01) |
| 384 | 384 | { |
| 385 | 385 | /* |
| 386 | 386 | |
| r2340 | r2341 | |
| 391 | 391 | |
| 392 | 392 | */ |
| 393 | 393 | |
| 394 | | UINT8 data = readinputportbytag_safe("IKBD_JOY0", 0xff) & 0xf0; |
| 395 | | UINT8 x = readinputportbytag_safe("IKBD_MOUSEX", 0x00); |
| 396 | | UINT8 y = readinputportbytag_safe("IKBD_MOUSEY", 0x00); |
| 394 | UINT8 data = input_port_read_safe(machine, "IKBD_JOY0", 0xff) & 0xf0; |
| 395 | UINT8 x = input_port_read_safe(machine, "IKBD_MOUSEX", 0x00); |
| 396 | UINT8 y = input_port_read_safe(machine, "IKBD_MOUSEY", 0x00); |
| 397 | 397 | |
| 398 | 398 | if (x == ikbd.mouse_x) |
| 399 | 399 | { |
| r2340 | r2341 | |
| 440 | 440 | } |
| 441 | 441 | else |
| 442 | 442 | { |
| 443 | | return readinputportbytag_safe("IKBD_JOY0", 0xff); |
| 443 | return input_port_read_safe(machine, "IKBD_JOY0", 0xff); |
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
| r2340 | r2341 | |
| 461 | 461 | |
| 462 | 462 | */ |
| 463 | 463 | |
| 464 | | if (~data & 0x01) ikbd.keylatch = readinputportbytag("P40"); |
| 465 | | if (~data & 0x02) ikbd.keylatch = readinputportbytag("P41"); |
| 466 | | if (~data & 0x04) ikbd.keylatch = readinputportbytag("P42"); |
| 467 | | if (~data & 0x08) ikbd.keylatch = readinputportbytag("P43"); |
| 468 | | if (~data & 0x10) ikbd.keylatch = readinputportbytag("P44"); |
| 469 | | if (~data & 0x20) ikbd.keylatch = readinputportbytag("P45"); |
| 470 | | if (~data & 0x40) ikbd.keylatch = readinputportbytag("P46"); |
| 471 | | if (~data & 0x80) ikbd.keylatch = readinputportbytag("P47"); |
| 464 | if (~data & 0x01) ikbd.keylatch = input_port_read(machine, "P40"); |
| 465 | if (~data & 0x02) ikbd.keylatch = input_port_read(machine, "P41"); |
| 466 | if (~data & 0x04) ikbd.keylatch = input_port_read(machine, "P42"); |
| 467 | if (~data & 0x08) ikbd.keylatch = input_port_read(machine, "P43"); |
| 468 | if (~data & 0x10) ikbd.keylatch = input_port_read(machine, "P44"); |
| 469 | if (~data & 0x20) ikbd.keylatch = input_port_read(machine, "P45"); |
| 470 | if (~data & 0x40) ikbd.keylatch = input_port_read(machine, "P46"); |
| 471 | if (~data & 0x80) ikbd.keylatch = input_port_read(machine, "P47"); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /* DMA Sound */ |
| r2340 | r2341 | |
| 812 | 812 | |
| 813 | 813 | */ |
| 814 | 814 | |
| 815 | | return (readinputportbytag("SW400") << 8) | 0xff; |
| 815 | return (input_port_read(machine, "SW400") << 8) | 0xff; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | static WRITE16_HANDLER( stbook_lcd_control_w ) |
| r2340 | r2341 | |
| 1405 | 1405 | |
| 1406 | 1406 | data |= (acia_irq << 4); |
| 1407 | 1407 | data |= (fdc.irq << 5); |
| 1408 | | data |= (readinputportbytag("config") & 0x80); |
| 1408 | data |= (input_port_read(machine, "config") & 0x80); |
| 1409 | 1409 | |
| 1410 | 1410 | return data; |
| 1411 | 1411 | } |
| r2340 | r2341 | |
| 1567 | 1567 | |
| 1568 | 1568 | data |= (acia_irq << 4); |
| 1569 | 1569 | data |= (fdc.irq << 5); |
| 1570 | | data |= (readinputportbytag("config") & 0x80) ^ (dmasound.active << 7); |
| 1570 | data |= (input_port_read(machine, "config") & 0x80) ^ (dmasound.active << 7); |
| 1571 | 1571 | |
| 1572 | 1572 | return data; |
| 1573 | 1573 | } |
src/mess/drivers/a2600.c
| r2340 | r2341 | |
| 1070 | 1070 | static WRITE8_HANDLER( switch_A_w ) |
| 1071 | 1071 | { |
| 1072 | 1072 | /* Left controller port */ |
| 1073 | | if ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT == 0x03 ) { |
| 1073 | if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 ) { |
| 1074 | 1074 | keypad_left_column = data / 16; |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | /* Right controller port */ |
| 1078 | | switch( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) { |
| 1078 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) { |
| 1079 | 1079 | case 0x03: /* Keypad */ |
| 1080 | 1080 | keypad_right_column = data & 0x0F; |
| 1081 | 1081 | break; |
| r2340 | r2341 | |
| 1091 | 1091 | UINT8 val = 0; |
| 1092 | 1092 | |
| 1093 | 1093 | /* Left controller port PINs 1-4 ( 4321 ) */ |
| 1094 | | switch( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) { |
| 1094 | switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) { |
| 1095 | 1095 | case 0x00: /* Joystick */ |
| 1096 | 1096 | case 0x05: /* Joystick w/Boostergrip */ |
| 1097 | | val |= readinputportbytag("SWA_JOY") & 0xF0; |
| 1097 | val |= input_port_read(machine, "SWA_JOY") & 0xF0; |
| 1098 | 1098 | break; |
| 1099 | 1099 | case 0x01: /* Paddle */ |
| 1100 | | val |= readinputportbytag("SWA_PAD") & 0xF0; |
| 1100 | val |= input_port_read(machine, "SWA_PAD") & 0xF0; |
| 1101 | 1101 | break; |
| 1102 | 1102 | case 0x02: /* Driving */ |
| 1103 | 1103 | val |= 0xC0; |
| 1104 | | val |= ( driving_lookup[ ( readinputportbytag("WHEEL_L") & 0x18 ) >> 3 ] << 4 ); |
| 1104 | val |= ( driving_lookup[ ( input_port_read(machine, "WHEEL_L") & 0x18 ) >> 3 ] << 4 ); |
| 1105 | 1105 | break; |
| 1106 | 1106 | case 0x06: /* Trakball CX-22 */ |
| 1107 | 1107 | case 0x07: /* Trakball CX-80 / ST mouse */ |
| r2340 | r2341 | |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | /* Right controller port PINs 1-4 ( 4321 ) */ |
| 1115 | | switch( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) { |
| 1115 | switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) { |
| 1116 | 1116 | case 0x00: /* Joystick */ |
| 1117 | 1117 | case 0x05: /* Joystick w/Boostergrip */ |
| 1118 | | val |= readinputportbytag("SWA_JOY") & 0x0F; |
| 1118 | val |= input_port_read(machine, "SWA_JOY") & 0x0F; |
| 1119 | 1119 | break; |
| 1120 | 1120 | case 0x01: /* Paddle */ |
| 1121 | | val |= readinputportbytag("SWA_PAD") & 0x0F; |
| 1121 | val |= input_port_read(machine, "SWA_PAD") & 0x0F; |
| 1122 | 1122 | break; |
| 1123 | 1123 | case 0x02: /* Driving */ |
| 1124 | 1124 | val |= 0x0C; |
| 1125 | | val |= ( driving_lookup[ ( readinputportbytag("WHEEL_R") & 0x18 ) >> 3 ] ); |
| 1125 | val |= ( driving_lookup[ ( input_port_read(machine, "WHEEL_R") & 0x18 ) >> 3 ] ); |
| 1126 | 1126 | break; |
| 1127 | 1127 | case 0x06: /* Trakball CX-22 */ |
| 1128 | 1128 | case 0x07: /* Trakball CX-80 / ST mouse */ |
| r2340 | r2341 | |
| 1179 | 1179 | |
| 1180 | 1180 | switch( offset ) { |
| 1181 | 1181 | case 0: /* Left controller port PIN 5 */ |
| 1182 | | switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) { |
| 1182 | switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) { |
| 1183 | 1183 | case 0x00: /* Joystick */ |
| 1184 | 1184 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1185 | 1185 | case 0x01: /* Paddle */ |
| 1186 | | return readinputportbytag("PADDLE1"); |
| 1186 | return input_port_read(machine, "PADDLE1"); |
| 1187 | 1187 | case 0x03: /* Keypad */ |
| 1188 | 1188 | for ( i = 0; i < 4; i++ ) { |
| 1189 | 1189 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) { |
| 1190 | | if ( ( readinputportbytag("KEYPAD_L") >> 3*i ) & 0x01 ) { |
| 1190 | if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x01 ) { |
| 1191 | 1191 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1192 | 1192 | } else { |
| 1193 | 1193 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| r2340 | r2341 | |
| 1196 | 1196 | } |
| 1197 | 1197 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1198 | 1198 | case 0x05: /* Boostergrip joystick */ |
| 1199 | | return ( readinputportbytag("BUTTONS_L") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1199 | return ( input_port_read(machine, "BUTTONS_L") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1200 | 1200 | default: |
| 1201 | 1201 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1202 | 1202 | } |
| 1203 | 1203 | break; |
| 1204 | 1204 | case 1: /* Right controller port PIN 5 */ |
| 1205 | | switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) { |
| 1205 | switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) { |
| 1206 | 1206 | case 0x00: /* Joystick */ |
| 1207 | 1207 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1208 | 1208 | case 0x01: /* Paddle */ |
| 1209 | | return readinputportbytag("PADDLE3"); |
| 1209 | return input_port_read(machine, "PADDLE3"); |
| 1210 | 1210 | case 0x03: /* Keypad */ |
| 1211 | 1211 | for ( i = 0; i < 4; i++ ) { |
| 1212 | 1212 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) { |
| 1213 | | if ( ( readinputportbytag("KEYPAD_L") >> 3*i ) & 0x02 ) { |
| 1213 | if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x02 ) { |
| 1214 | 1214 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1215 | 1215 | } else { |
| 1216 | 1216 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| r2340 | r2341 | |
| 1219 | 1219 | } |
| 1220 | 1220 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1221 | 1221 | case 0x05: /* Joystick w/Boostergrip */ |
| 1222 | | return ( readinputportbytag("BUTTONS_L") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1222 | return ( input_port_read(machine, "BUTTONS_L") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1223 | 1223 | default: |
| 1224 | 1224 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1225 | 1225 | } |
| 1226 | 1226 | break; |
| 1227 | 1227 | case 2: /* Left controller port PIN 9 */ |
| 1228 | | switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) { |
| 1228 | switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) { |
| 1229 | 1229 | case 0x00: /* Joystick */ |
| 1230 | 1230 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1231 | 1231 | case 0x01: /* Paddle */ |
| 1232 | | return readinputportbytag("PADDLE2"); |
| 1232 | return input_port_read(machine, "PADDLE2"); |
| 1233 | 1233 | case 0x03: /* Keypad */ |
| 1234 | 1234 | for ( i = 0; i < 4; i++ ) { |
| 1235 | 1235 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) { |
| 1236 | | if ( ( readinputportbytag("KEYPAD_R") >> 3*i ) & 0x01 ) { |
| 1236 | if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x01 ) { |
| 1237 | 1237 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1238 | 1238 | } else { |
| 1239 | 1239 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| r2340 | r2341 | |
| 1242 | 1242 | } |
| 1243 | 1243 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1244 | 1244 | case 0x05: /* Joystick w/Boostergrip */ |
| 1245 | | return ( readinputportbytag("BUTTONS_R") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1245 | return ( input_port_read(machine, "BUTTONS_R") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1246 | 1246 | default: |
| 1247 | 1247 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1248 | 1248 | } |
| 1249 | 1249 | break; |
| 1250 | 1250 | case 3: /* Right controller port PIN 9 */ |
| 1251 | | switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) { |
| 1251 | switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) { |
| 1252 | 1252 | case 0x00: /* Joystick */ |
| 1253 | 1253 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1254 | 1254 | case 0x01: /* Paddle */ |
| 1255 | | return readinputportbytag("PADDLE4"); |
| 1255 | return input_port_read(machine, "PADDLE4"); |
| 1256 | 1256 | case 0x03: /* Keypad */ |
| 1257 | 1257 | for ( i = 0; i < 4; i++ ) { |
| 1258 | 1258 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) { |
| 1259 | | if ( ( readinputportbytag("KEYPAD_R") >> 3*i ) & 0x02 ) { |
| 1259 | if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x02 ) { |
| 1260 | 1260 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1261 | 1261 | } else { |
| 1262 | 1262 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| r2340 | r2341 | |
| 1265 | 1265 | } |
| 1266 | 1266 | return TIA_INPUT_PORT_ALWAYS_ON; |
| 1267 | 1267 | case 0x05: /* Joystick w/Boostergrip */ |
| 1268 | | return ( readinputportbytag("BUTTONS_R") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1268 | return ( input_port_read(machine, "BUTTONS_R") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON; |
| 1269 | 1269 | default: |
| 1270 | 1270 | return TIA_INPUT_PORT_ALWAYS_OFF; |
| 1271 | 1271 | } |
| 1272 | 1272 | break; |
| 1273 | 1273 | case 4: /* Left controller port PIN 6 */ |
| 1274 | | switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) { |
| 1274 | switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) { |
| 1275 | 1275 | case 0x00: /* Joystick */ |
| 1276 | 1276 | case 0x05: /* Joystick w/Boostergrip */ |
| 1277 | | return readinputportbytag("BUTTONS_L"); |
| 1277 | return input_port_read(machine, "BUTTONS_L"); |
| 1278 | 1278 | case 0x01: /* Paddle */ |
| 1279 | 1279 | return 0xff; |
| 1280 | 1280 | case 0x02: /* Driving */ |
| 1281 | | return readinputportbytag("BUTTONS_L") << 3; |
| 1281 | return input_port_read(machine, "BUTTONS_L") << 3; |
| 1282 | 1282 | case 0x03: /* Keypad */ |
| 1283 | 1283 | for ( i = 0; i < 4; i++ ) { |
| 1284 | 1284 | if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) { |
| 1285 | | if ( ( readinputportbytag("KEYPAD_L") >> 3*i ) & 0x04 ) { |
| 1285 | if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x04 ) { |
| 1286 | 1286 | return 0xff; |
| 1287 | 1287 | } else { |
| 1288 | 1288 | return 0x00; |
| r2340 | r2341 | |
| 1291 | 1291 | } |
| 1292 | 1292 | return 0xff; |
| 1293 | 1293 | case 0x06: /* Trakball CX-22 */ |
| 1294 | | return readinputportbytag("BUTTONS_L") << 4; |
| 1294 | return input_port_read(machine, "BUTTONS_L") << 4; |
| 1295 | 1295 | default: |
| 1296 | 1296 | return 0xff; |
| 1297 | 1297 | } |
| 1298 | 1298 | break; |
| 1299 | 1299 | case 5: /* Right controller port PIN 6 */ |
| 1300 | | switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) { |
| 1300 | switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) { |
| 1301 | 1301 | case 0x00: /* Joystick */ |
| 1302 | 1302 | case 0x05: /* Joystick w/Boostergrip */ |
| 1303 | | return readinputportbytag("BUTTONS_R"); |
| 1303 | return input_port_read(machine, "BUTTONS_R"); |
| 1304 | 1304 | case 0x01: /* Paddle */ |
| 1305 | 1305 | return 0xff; |
| 1306 | 1306 | case 0x02: /* Driving */ |
| 1307 | | return readinputportbytag("BUTTONS_R") << 3; |
| 1307 | return input_port_read(machine, "BUTTONS_R") << 3; |
| 1308 | 1308 | case 0x03: /* Keypad */ |
| 1309 | 1309 | for ( i = 0; i < 4; i++ ) { |
| 1310 | 1310 | if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) { |
| 1311 | | if ( ( readinputportbytag("KEYPAD_R") >> 3*i ) & 0x04 ) { |
| 1311 | if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x04 ) { |
| 1312 | 1312 | return 0xff; |
| 1313 | 1313 | } else { |
| 1314 | 1314 | return 0x00; |
| r2340 | r2341 | |
| 1317 | 1317 | } |
| 1318 | 1318 | return 0xff; |
| 1319 | 1319 | case 0x06: /* Trakball CX-22 */ |
| 1320 | | return readinputportbytag("BUTTONS_R") << 4; |
| 1320 | return input_port_read(machine, "BUTTONS_R") << 4; |
| 1321 | 1321 | default: |
| 1322 | 1322 | return 0xff; |
| 1323 | 1323 | } |
src/mess/drivers/ssystem3.c
| r2340 | r2341 | |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | 36 | #include "driver.h" |
| 37 | #include "deprecat.h" |
| 37 | 38 | |
| 38 | 39 | #include "includes/ssystem3.h" |
| 39 | 40 | #include "machine/6522via.h" |
| r2340 | r2341 | |
| 79 | 80 | { |
| 80 | 81 | memset(&playfield, 0, sizeof(playfield)); |
| 81 | 82 | playfield.signal=FALSE; |
| 82 | | // playfield.on=TRUE; //readinputportbytag("Configuration")&1; |
| 83 | // playfield.on=TRUE; //input_port_read(machine, "Configuration")&1; |
| 83 | 84 | } |
| 84 | 85 | |
| 85 | 86 | static void ssystem3_playfield_write(int reset, int signal) |
| r2340 | r2341 | |
| 129 | 130 | |
| 130 | 131 | static void ssystem3_playfield_read(int *on, int *ready) |
| 131 | 132 | { |
| 132 | | *on=!(readinputportbytag("Configuration")&1); |
| 133 | | // *on=!playfield.on; |
| 134 | | *ready=FALSE; |
| 133 | running_machine *machine = Machine; |
| 134 | *on=!(input_port_read(machine, "Configuration")&1); |
| 135 | // *on=!playfield.on; |
| 136 | *ready=FALSE; |
| 135 | 137 | } |
| 136 | 138 | |
| 137 | 139 | void ssystem3_via_write_a(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data) |
| r2340 | r2341 | |
| 144 | 146 | { |
| 145 | 147 | UINT8 data=0xff; |
| 146 | 148 | #if 1 // time switch |
| 147 | | if (!(ssystem3.porta&0x10)) data&=readinputportbytag("matrix1")|0xf1; |
| 148 | | if (!(ssystem3.porta&0x20)) data&=readinputportbytag("matrix2")|0xf1; |
| 149 | | if (!(ssystem3.porta&0x40)) data&=readinputportbytag("matrix3")|0xf1; |
| 150 | | if (!(ssystem3.porta&0x80)) data&=readinputportbytag("matrix4")|0xf1; |
| 149 | if (!(ssystem3.porta&0x10)) data&=input_port_read(machine, "matrix1")|0xf1; |
| 150 | if (!(ssystem3.porta&0x20)) data&=input_port_read(machine, "matrix2")|0xf1; |
| 151 | if (!(ssystem3.porta&0x40)) data&=input_port_read(machine, "matrix3")|0xf1; |
| 152 | if (!(ssystem3.porta&0x80)) data&=input_port_read(machine, "matrix4")|0xf1; |
| 151 | 153 | #else |
| 152 | | if (!(ssystem3.porta&0x10)) data&=readinputportbytag("matrix1")|0xf0; |
| 153 | | if (!(ssystem3.porta&0x20)) data&=readinputportbytag("matrix2")|0xf0; |
| 154 | | if (!(ssystem3.porta&0x40)) data&=readinputportbytag("matrix3")|0xf0; |
| 155 | | if (!(ssystem3.porta&0x80)) data&=readinputportbytag("matrix4")|0xf0; |
| 154 | if (!(ssystem3.porta&0x10)) data&=input_port_read(machine, "matrix1")|0xf0; |
| 155 | if (!(ssystem3.porta&0x20)) data&=input_port_read(machine, "matrix2")|0xf0; |
| 156 | if (!(ssystem3.porta&0x40)) data&=input_port_read(machine, "matrix3")|0xf0; |
| 157 | if (!(ssystem3.porta&0x80)) data&=input_port_read(machine, "matrix4")|0xf0; |
| 156 | 158 | #endif |
| 157 | 159 | if (!(ssystem3.porta&1)) { |
| 158 | | if (!(readinputportbytag("matrix1")&1)) data&=~0x10; |
| 159 | | if (!(readinputportbytag("matrix2")&1)) data&=~0x20; |
| 160 | | if (!(readinputportbytag("matrix3")&1)) data&=~0x40; |
| 161 | | if (!(readinputportbytag("matrix4")&1)) data&=~0x80; |
| 160 | if (!(input_port_read(machine, "matrix1")&1)) data&=~0x10; |
| 161 | if (!(input_port_read(machine, "matrix2")&1)) data&=~0x20; |
| 162 | if (!(input_port_read(machine, "matrix3")&1)) data&=~0x40; |
| 163 | if (!(input_port_read(machine, "matrix4")&1)) data&=~0x80; |
| 162 | 164 | } |
| 163 | 165 | if (!(ssystem3.porta&2)) { |
| 164 | | if (!(readinputportbytag("matrix1")&2)) data&=~0x10; |
| 165 | | if (!(readinputportbytag("matrix2")&2)) data&=~0x20; |
| 166 | | if (!(readinputportbytag("matrix3")&2)) data&=~0x40; |
| 167 | | if (!(readinputportbytag("matrix4")&2)) data&=~0x80; |
| 166 | if (!(input_port_read(machine, "matrix1")&2)) data&=~0x10; |
| 167 | if (!(input_port_read(machine, "matrix2")&2)) data&=~0x20; |
| 168 | if (!(input_port_read(machine, "matrix3")&2)) data&=~0x40; |
| 169 | if (!(input_port_read(machine, "matrix4")&2)) data&=~0x80; |
| 168 | 170 | } |
| 169 | 171 | if (!(ssystem3.porta&4)) { |
| 170 | | if (!(readinputportbytag("matrix1")&4)) data&=~0x10; |
| 171 | | if (!(readinputportbytag("matrix2")&4)) data&=~0x20; |
| 172 | | if (!(readinputportbytag("matrix3")&4)) data&=~0x40; |
| 173 | | if (!(readinputportbytag("matrix4")&4)) data&=~0x80; |
| 172 | if (!(input_port_read(machine, "matrix1")&4)) data&=~0x10; |
| 173 | if (!(input_port_read(machine, "matrix2")&4)) data&=~0x20; |
| 174 | if (!(input_port_read(machine, "matrix3")&4)) data&=~0x40; |
| 175 | if (!(input_port_read(machine, "matrix4")&4)) data&=~0x80; |
| 174 | 176 | } |
| 175 | 177 | if (!(ssystem3.porta&8)) { |
| 176 | | if (!(readinputportbytag("matrix1")&8)) data&=~0x10; |
| 177 | | if (!(readinputportbytag("matrix2")&8)) data&=~0x20; |
| 178 | | if (!(readinputportbytag("matrix3")&8)) data&=~0x40; |
| 179 | | if (!(readinputportbytag("matrix4")&8)) data&=~0x80; |
| 178 | if (!(input_port_read(machine, "matrix1")&8)) data&=~0x10; |
| 179 | if (!(input_port_read(machine, "matrix2")&8)) data&=~0x20; |
| 180 | if (!(input_port_read(machine, "matrix3")&8)) data&=~0x40; |
| 181 | if (!(input_port_read(machine, "matrix4")&8)) data&=~0x80; |
| 180 | 182 | } |
| 181 | 183 | // logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data); |
| 182 | 184 | return data; |