Previous 15994 Revisions Next

r2341 Wednesday 9th April, 2008 at 01:43:49 UTC by Nathan Woods
Changed various calls for reading input ports, in anticipation of 0.124u2
[src/emu]inptport.c inptport.h
[src/mess/drivers]a2600.c abc80.c abc80x.c acrnsys1.c adam.c amiga.c amstrad.c apf.c atari.c atarist.c avigo.c bw2.c channelf.c coleco.c crvision.c einstein.c enterp.c exidy.c glasgow.c gmaster.c jaguar.c lynx.c mbee.c mephisto.c mk1.c mk2.c mpf1.c nc.c osi.c pasogo.c pcw.c pcw16.c psx.c ql.c saturn.c sg1000.c sord.c spectrum.c ssystem3.c studio2.c super80.c svision.c ti99_2.c tm990189.c tmc1800.c tmc2000e.c tmc600.c trs80.c tutor.c vc4000.c vip.c vtech1.c x68k.c z88.c
[src/mess/includes]amstr_pc.h apple2.h c128.h c16.h c64.h c65.h cbmb.h hp48.h pc1251.h pc1350.h pc1401.h pc1403.h pet.h vc20.h
[src/mess/machine]a7800.c adam.c advision.c aim65.c amstr_pc.c apple1.c apple2gs.c aquarius.c atom.c ay3600.c bbc.c c128.c c16.c c64.c cbmb.c cgenie.c coleco.c compis.c concept.c coupe.c cybiko.c dai.c dgn_beta.c electron.c galaxy.c galeb.c gamecom.c gamepock.c gb.c genesis.c geneve.c hp48.c ibmpc.c intv.c jupiter.c kaypro.c kc.c kim1.c lisa.c lviv.c lynx.c mac.c mc10.c microtan.c mikro80.c msx.c mtx.c mz700.c nascom1.c nes.c odyssey2.c orao.c oric.c orion.c osborne1.c p2000t.c pc.c pc1251.c pc1350.c pc1401.c pc1403.c pc8801.c pc_hdc.c pc_joy.c pc_mouse.c pc_turbo.c pce.c pclpt.c pet.c pmd85.c pokemini.c primo.c sms.c special.c spectrum.c svi318.c sym1.c thomson.c ti85.c ti99_4x.c trs80.c ut88.c vc20.c vectrex.c vtech1.c vtech2.c wswan.c zx.c
[src/mess/video]733_asr.c 911_vdt.c amstrad.c arcadia.c kim1.c m6847.c mbee.c mekd2.c nes.c pc1251.c pc1350.c pc1401.c pc1403.c pc_aga.c pc_cga.c ssystem3.c thomson.c trs80.c vc4000.c vectrex.c vic6567.c x68k.c

src/emu/inptport.c
r2340r2341
34913491
34923492
34933493
3494UINT32 input_port_read_indexed(running_machine *machine, int port) { return readinputport(port); }
3495UINT32 input_port_read(running_machine *machine, const char *tag) { return readinputportbytag(tag); }
3496UINT32 input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue) { return readinputportbytag_safe(tag, defvalue); }
3497
3498
3499
34943500/*************************************
34953501 *
34963502 *  Input port writing
src/emu/inptport.h
r2340r2341
942942
943943UINT32 get_crosshair_pos(int port_num, UINT8 player, UINT8 axis);
944944
945/* leaving these in temporarily until 0.124u2 */
945946UINT32 readinputport(int port);
946947UINT32 readinputportbytag(const char *tag);
947948UINT32 readinputportbytag_safe(const char *tag, UINT32 defvalue);
948949
950UINT32 input_port_read_indexed(running_machine *machine, int port);
951UINT32 input_port_read(running_machine *machine, const char *tag);
952UINT32 input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue);
953
949954#endif   /* __INPTPORT_H__ */
src/mess/includes/pc1401.h
r2340r2341
1010#define PC1401_H_
1111
1212
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
2121
22#define KEY_RIGHT readinputport(1)&0x80
22#define KEY_RIGHT input_port_read_indexed(machine, 1)&0x80
2323// 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
3030
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
3939
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
4848
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
5757
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
6666
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
7575
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
8484
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
9393
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
101101
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)
105105
106106
107107/*----------- defined in machine/pc1401.c -----------*/
src/mess/includes/hp48.h
r2340r2341
88#define HP48_H_
99
1010
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
6060
6161
62/*----------- defined in machine/hp48.c -----------*/
62/*----------- defined in Machine/hp48.c -----------*/
6363
6464typedef struct {
6565   int data[0x40];
src/mess/includes/c65.h
r2340r2341
88#define C65_H_
99
1010
11#define C65_KEY_DIN ( readinputportbytag ("Special") & 0x20 )
11#define C65_KEY_DIN ( input_port_read (machine, "Special") & 0x20 )
1212
1313
1414/*----------- defined in machine/c65.c -----------*/
src/mess/includes/cbmb.h
r2340r2341
7777#define JOYSTICK2 ((input_port_20_word_r(0,0)&0xe00)==0x200)
7878#define JOYSTICK_SWAP      (input_port_20_word_r(0,0)&0x100)
7979
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)
8282#define PADDLE2_BUTTON   ((input_port_15_word_r(0,0)&0x100))
8383#define PADDLE2_VALUE   (input_port_15_word_r(0,0)&0xff)
8484#define PADDLE3_BUTTON   ((input_port_16_word_r(0,0)&0x100))
r2340r2341
8686#define PADDLE4_BUTTON   ((input_port_17_word_r(0,0)&0x100))
8787#define PADDLE4_VALUE   (input_port_17_word_r(0,0)&0xff)
8888
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 */
9292
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))
105105
106106#define IEEE8ON   0
107107#define IEEE9ON   0
src/mess/includes/pc1350.h
r2340r2341
1010#define PC1350_H_
1111
1212
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
2121
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
3030
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
3939
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
4848
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
5757
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
6666
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
7575
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
8383
84#define PC1350_CONTRAST (readinputport(8)&7)
84#define PC1350_CONTRAST (input_port_read_indexed(machine, 8)&7)
8585
8686
8787/*----------- defined in machine/pc1350.c -----------*/
src/mess/includes/c128.h
r2340r2341
1515#define C128_H_
1616
1717
18#define C128_MAIN_MEMORY   ( readinputportbytag("Config") & 0x300 )
18#define C128_MAIN_MEMORY   ( input_port_read(Machine, "Config") & 0x300 )
1919#define RAM128KB         ( 0x00 )
2020#define RAM256KB         ( 0x100 )
2121#define RAM1MB            ( 0x200 )
2222
23#define VDC_RAM_64KBYTE      ( readinputportbytag("Config") & 0x40 ) /* else 16KB */
24#define MONITOR_TV         ( readinputportbytag("Config") & 0x20 ) /* else RGBI */
23#define VDC_RAM_64KBYTE      ( input_port_read(Machine, "Config") & 0x40 ) /* else 16KB */
24#define MONITOR_TV         ( input_port_read(Machine, "Config") & 0x20 ) /* else RGBI */
2525
26#define KEY_DIN            ( readinputportbytag( "Special" ) & 0x20 )
27#define KEY_4080         ( readinputportbytag( "Special" ) & 0x10 )
26#define KEY_DIN            ( input_port_read(Machine,  "Special" ) & 0x20 )
27#define KEY_4080         ( input_port_read(Machine,  "Special" ) & 0x10 )
2828
2929
3030/*----------- defined in machine/c128.c -----------*/
src/mess/includes/pet.h
r2340r2341
2525
2626/*----------- defined in machine/pet.c -----------*/
2727
28#define CBM8096_MEMORY (readinputport(11)&8)
29#define M6809_SELECT (readinputport(11)&4)
30#define IEEE8ON (readinputport(11)&2)
31#define IEEE9ON (readinputport(11)&1)
28#define CBM8096_MEMORY (input_port_read_indexed(machine, 11)&8)
29#define M6809_SELECT (input_port_read_indexed(machine, 11)&4)
30#define IEEE8ON (input_port_read_indexed(machine, 11)&2)
31#define IEEE9ON (input_port_read_indexed(machine, 11)&1)
3232
3333extern UINT8 *pet_memory;
3434extern UINT8 *pet_videoram;
src/mess/includes/c16.h
r2340r2341
88#define C16_H_
99
1010
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 )
1313
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 )
1919
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 )
2525
26#define JOYSTICK_SWAP      ( readinputportbytag("Special") & 0x80 )
26#define JOYSTICK_SWAP      ( input_port_read(Machine, "Special") & 0x80 )
2727
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 )
3131
32#define QUICKLOAD         ( readinputportbytag("CFG0") & 0x08 )
32#define QUICKLOAD         ( input_port_read(Machine, "CFG0") & 0x08 )
3333
3434
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 )
3737
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 )
4141
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 )
4545
46#define SIDCARD            ( readinputportbytag("CFG2") & 0x80 )
46#define SIDCARD            ( input_port_read(Machine, "CFG2") & 0x80 )
4747// a lot of c64 software has been converted to c16
4848// these oftenly still produce the commands for the sid chip at 0xd400
4949// 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 )
5151
52#define C16_PAL            (( readinputportbytag("CFG2") & 0x10 ) == 0x00 )
52#define C16_PAL            (( input_port_read(Machine, "CFG2") & 0x10 ) == 0x00 )
5353
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 )
5757
5858
5959/*----------- defined in machine/c16.c -----------*/
src/mess/includes/vc20.h
r2340r2341
3535  paddle 2 button to joystick right
3636 */
3737
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))
4545
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)
5151
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)
5454
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 )
5757
5858
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)
6161
62#define QUICKLOAD      (readinputportbytag( TAG_CASSETTE )&8)
62#define QUICKLOAD      (input_port_read(machine, TAG_CASSETTE )&8)
6363
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)
6767
6868#define VC20ADDR2VIC6560ADDR(a) (((a)>0x8000)?((a)&0x1fff):((a)|0x2000))
6969#define VIC6560ADDR2VC20ADDR(a) (((a)>0x2000)?((a)&0x1fff):((a)|0x8000))
src/mess/includes/pc1403.h
r2340r2341
1010#define PC1403_H_
1111
1212
13#define KEY_SMALL readinputport(1)&0x40
14#define RAM32K (readinputport(10)&0x80)==0x80
13#define KEY_SMALL input_port_read_indexed(machine, 1)&0x40
14#define RAM32K (input_port_read_indexed(machine, 10)&0x80)==0x80
1515
1616
1717/*----------- defined in machine/pc1403.c -----------*/
src/mess/includes/apple2.h
r2340r2341
9595int apple2_get_bgcolor(void);
9696
9797/* keyboard wrappers */
98#define pressed_specialkey(key)   (readinputportbytag("keyb_special") & (key))
98#define pressed_specialkey(key)   (input_port_read(machine, "keyb_special") & (key))
9999#define SPECIALKEY_CAPSLOCK      0x01
100100#define SPECIALKEY_SHIFT      0x06
101101#define SPECIALKEY_CONTROL      0x08
src/mess/includes/c64.h
r2340r2341
7575   PORT_DIPSETTING(   0x0100, DEF_STR( Yes ) )
7676
7777
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 )
8989
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 )
9898
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" ))
103103
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" ))
108108
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 */
112112
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 ))
125125
126#define QUICKLOAD         ( readinputportbytag( "Config" ) & 0x8000 )
126#define QUICKLOAD         ( input_port_read(Machine, "Config" ) & 0x8000 )
127127
128128/* 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 )
134134
135#define SID8580            (( readinputportbytag( "Config" ) & 0x80) ? MOS8580 : MOS6581)
135#define SID8580            (( input_port_read(Machine, "Config" ) & 0x80) ? MOS8580 : MOS6581)
136136
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 )
143143
144#define KEY_RESTORE         ( readinputportbytag( "Special" ) & 0x80 )
144#define KEY_RESTORE         ( input_port_read(Machine, "Special" ) & 0x80 )
145145
146146
147147/*----------- defined in machine/c64.c -----------*/
src/mess/includes/amstr_pc.h
r2340r2341
88#define AMSTR_PC_H_
99
1010
11#define PC200_MODE (readinputport(1)&0x30)
11#define PC200_MODE (input_port_read_indexed(machine, 1)&0x30)
1212#define PC200_MDA 0x30
1313
1414
src/mess/includes/pc1251.h
r2340r2341
1010#define PC1251_H_
1111
1212
13#define PC1251_SWITCH_MODE (readinputport(0)&7)
13#define PC1251_SWITCH_MODE (input_port_read_indexed(machine, 0)&7)
1414
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
2121
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
3030
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
3939
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
4848
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
5757
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
6666
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
7474
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
7878
79#define PC1251_CONTRAST (readinputport(7)&7)
79#define PC1251_CONTRAST (input_port_read_indexed(machine, 7)&7)
8080
8181
8282/*----------- defined in machine/pc1251.c -----------*/
src/mess/video/pc1401.c
r2340r2341
135135
136136VIDEO_UPDATE( pc1401 )
137137{
138   running_machine *machine = screen->machine;
138139   int x, y, i, j;
139140   int color[2];
140141
src/mess/video/911_vdt.c
r2340r2341
1111
1212
1313#include "driver.h"
14#include "deprecat.h"
1415#include "911_vdt.h"
1516#include "911_chr.h"
1617#include "911_key.h"
r2340r2341
576577
577578   /* read current key state */
578579   for (i=0; i<6; i++)
579      key_buf[i] = readinputport(i);
580      key_buf[i] = input_port_read_indexed(Machine, i);
580581
581582
582583   /* parse modifier keys */
src/mess/video/mbee.c
r2340r2341
77****************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "includes/mbee.h"
1112
1213
r2340r2341
119120{
120121   int port = (offs >> 7) & 7;
121122   int bit = (offs >> 4) & 7;
122   int data = (readinputport(port) >> bit) & 1;
123   int extra = readinputport(8);
123   int data = (input_port_read_indexed(Machine, port) >> bit) & 1;
124   int extra = input_port_read_indexed(Machine, 8);
124125
125126   if( extra & 0x01 )   /* extra: cursor up */
126127   {
src/mess/video/pc1350.c
r2340r2341
134134{
135135   int x, y, i, j, k, b;
136136   int color[2];
137   running_machine *machine = screen->machine;
137138
138139   bitmap_fill(bitmap, cliprect, 11);
139140
src/mess/video/nes.c
r2340r2341
123123   ppu2c0x_render( 0, bitmap, 0, 0, 0, 0 );
124124
125125   /* figure out what sights to draw, and draw them */
126   if ((readinputport(PORT_CONFIG1) & 0x000f) == 0x0002)
126   if ((input_port_read_indexed(screen->machine, PORT_CONFIG1) & 0x000f) == 0x0002)
127127      sights |= 0x0001;
128   if ((readinputport(PORT_CONFIG1) & 0x000f) == 0x0003)
128   if ((input_port_read_indexed(screen->machine, PORT_CONFIG1) & 0x000f) == 0x0003)
129129      sights |= 0x0002;
130   if ((readinputport(PORT_CONFIG1) & 0x00f0) == 0x0020)
130   if ((input_port_read_indexed(screen->machine, PORT_CONFIG1) & 0x00f0) == 0x0020)
131131      sights |= 0x0001;
132   if ((readinputport(PORT_CONFIG1) & 0x00f0) == 0x0030)
132   if ((input_port_read_indexed(screen->machine, PORT_CONFIG1) & 0x00f0) == 0x0030)
133133      sights |= 0x0002;
134134   if (sights & 0x0001)
135      draw_sight(bitmap, 0x30, readinputport(PORT_ZAPPER0_X), readinputport(PORT_ZAPPER0_Y));
135      draw_sight(bitmap, 0x30, input_port_read_indexed(screen->machine, PORT_ZAPPER0_X), input_port_read_indexed(screen->machine, PORT_ZAPPER0_Y));
136136   if (sights & 0x0002)
137      draw_sight(bitmap, 0x00, readinputport(PORT_ZAPPER1_X), readinputport(PORT_ZAPPER1_Y));
137      draw_sight(bitmap, 0x00, input_port_read_indexed(screen->machine, PORT_ZAPPER1_X), input_port_read_indexed(screen->machine, PORT_ZAPPER1_Y));
138138
139139   /* if this is a disk system game, check for the flip-disk key */
140140   if (nes.mapper == 20)
141141   {
142142      // latch this input so it doesn't go at warp speed
143      if ((readinputport(PORT_FLIPKEY) & 0x01) && (!last_frame_flip))
143      if ((input_port_read_indexed(screen->machine, PORT_FLIPKEY) & 0x01) && (!last_frame_flip))
144144      {
145145         last_frame_flip = 1;
146146         nes_fds.current_side++;
r2340r2341
157157         }
158158      }
159159
160      if (!(readinputport(PORT_FLIPKEY) & 0x01))
160      if (!(input_port_read_indexed(screen->machine, PORT_FLIPKEY) & 0x01))
161161      {
162162         last_frame_flip = 0;
163163      }
src/mess/video/kim1.c
r2340r2341
7777      {
7878         int sx = width - 182 + x * 37;
7979         int code = layout[y][x];
80         int color = (readinputport (code / 7) & (0x40 >> (code % 7))) ? 0 : 1;
80         int color = (input_port_read_indexed(screen->machine, code / 7) & (0x40 >> (code % 7))) ? 0 : 1;
8181         videoram[6 * 2 + code] = color;
8282         drawgfx (bitmap, screen->machine->gfx[1], layout[y][x], color, 0, 0, sx, sy, NULL, TRANSPARENCY_NONE, 0);
8383      }
src/mess/video/vectrex.c
r2340r2341
129129   return 0;
130130}
131131
132static void lightpen_show (void)
132static void lightpen_show (running_machine *machine)
133133{
134134   int color;
135135
136136   if (vectrex_lightpen_port != 0)
137137   {
138      if (readinputport(6)&0x10)
138      if (input_port_read_indexed(machine, 6)&0x10)
139139      {
140140         lightpen_down=1;
141141         color=0x00ff0000;
r2340r2341
146146         color=0x00ffffff;
147147      }
148148
149      pen_x = readinputport(8)*(x_max/0xff);
150      pen_y = readinputport(7)*(y_max/0xff);
149      pen_x = input_port_read_indexed(machine, 8)*(x_max/0xff);
150      pen_y = input_port_read_indexed(machine, 7)*(y_max/0xff);
151151
152152      vector_add_point(pen_x-250000,pen_y-250000,0,0xff);
153153      vector_add_point(pen_x+250000,pen_y+250000,color,0xff);
r2340r2341
167167   double starttime;
168168
169169   vectrex_configuration();
170   lightpen_show();
170   lightpen_show(screen->machine);
171171
172172   starttime = attotime_to_double(timer_get_time()) - vectrex_persistance;
173173   if (starttime < 0) starttime = 0;
src/mess/video/arcadia.c
r2340r2341
547547    UINT8 data=0;
548548    switch (offset) {
549549    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;
559559#if 0
560560    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;
563563   break;
564564    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;
567567   break;
568568#else
569569    case 0x1fe:
570570   data = 0x80;
571571   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;
574574   } 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;
577577   }
578578   break;
579579    case 0x1ff:
580580   data = 0x6f; // 0x7f too big for alien invaders (movs right)
581581   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;
584584   } 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;
587587   }
588588   break;
589589#endif
src/mess/video/m6847.c
r2340r2341
157157
158158
159159
160static void apply_artifacts(UINT32 *line);
160static void apply_artifacts(running_machine *machine, UINT32 *line);
161161
162162static m6847_vdg *m6847;
163163
r2340r2341
12151215
12161216
12171217
1218static void render_scanline(bitmap_t *bitmap, int scanline)
1218static void render_scanline(running_machine *machine, bitmap_t *bitmap, int scanline)
12191219{
12201220   UINT32 border_color;
12211221   UINT32 *line;
r2340r2341
12601260      if ((attrs & (M6847_AG|M6847_GM2|M6847_GM1|M6847_GM0))
12611261         == (M6847_AG|M6847_GM2|M6847_GM1|M6847_GM0))
12621262      {
1263         apply_artifacts(line + 32);
1263         apply_artifacts(machine, line + 32);
12641264      }
12651265   }
12661266   else
r2340r2341
12931293
12941294
12951295
1296static void apply_artifacts(UINT32 *line)
1296static void apply_artifacts(running_machine *machine, UINT32 *line)
12971297{
12981298   /* Boy this code sucks; this code was adapted from the old M6847
12991299    * artifacting implmentation.  The only reason that it didn't look as
r2340r2341
13531353   int i;
13541354
13551355   /* are we artifacting? */
1356   artifacting = readinputportbytag_safe("artifacting", 0x00) & 0x03;
1356   artifacting = input_port_read_safe(machine, "artifacting", 0x00) & 0x03;
13571357   if (artifacting == 0x00)
13581358      return;
13591359   artifacting &= 0x01;
r2340r2341
19531953
19541954      /* the video RAM has been dirtied; need to draw */
19551955      for (row = cliprect->min_y; row <= cliprect->max_y; row++)
1956         render_scanline(bitmap, row);
1956         render_scanline(screen->machine, bitmap, row);
19571957   }
19581958   else
19591959   {
src/mess/video/thomson.c
r2340r2341
88
99#include <math.h>
1010#include "driver.h"
11#include "deprecat.h"
1112#include "includes/thomson.h"
1213#include "cpu/m6809/m6809.h"
1314#include "machine/6821pia.h"
r2340r2341
5859{
5960   const device_config *screen = video_screen_first(machine->config);
6061   const rectangle *visarea = video_screen_get_visible_area(screen);
61   UINT8 p = readinputport( THOM_INPUT_VCONFIG );
62   UINT8 p = input_port_read_indexed(machine, THOM_INPUT_VCONFIG );
6263   int new_w, new_h, changed = 0;
6364
6465   switch ( p & 3 )
r2340r2341
139140
140141static void thom_get_lightpen_pos( int*x, int* y )
141142{
142   *x = readinputport( THOM_INPUT_LIGHTPEN     );
143   *y = readinputport( THOM_INPUT_LIGHTPEN + 1 );
143   *x = input_port_read_indexed(Machine,  THOM_INPUT_LIGHTPEN     );
144   *y = input_port_read_indexed(Machine,  THOM_INPUT_LIGHTPEN + 1 );
144145
145146   if ( *x < 0 )
146147      *x = 0;
src/mess/video/x68k.c
r2340r2341
235235   attotime end_time;
236236
237237   sys.mfp.gpio &= ~0x40;  // GPIP6
238   if((readinputportbytag("options") & 0x01))
238   if((input_port_read(machine, "options") & 0x01))
239239   {
240240      video_screen_update_partial(machine->primary_screen,scan);
241241   }
src/mess/video/mekd2.c
r2340r2341
8282            int sx = width - 182 + x * 37;
8383            int color, code = layout[y][x];
8484
85            color = (readinputport (code / 7) & (0x40 >> (code % 7))) ? 0 : 1;
85            color = (input_port_read_indexed(screen->machine, code / 7) & (0x40 >> (code % 7))) ? 0 : 1;
8686
8787            videoram[6 * 2 + code] = color;
8888            drawgfx (bitmap, screen->machine->gfx[1],
src/mess/video/pc1403.c
r2340r2341
5757}
5858
5959
60 READ8_HANDLER(pc1403_lcd_read)
60READ8_HANDLER(pc1403_lcd_read)
6161{
6262    UINT8 data=pc1403_lcd.reg[offset];
6363    return data;
r2340r2341
155155
156156VIDEO_UPDATE( pc1403 )
157157{
158   running_machine *machine = screen->machine;
158159   int x, y, i, j;
159160   int color[3];
160161
src/mess/video/pc_aga.c
r2340r2341
1515#include "video/pc_video.h"
1616
1717
18#define CGA_MONITOR      (readinputport(20)&0x1C)
18#define CGA_MONITOR      (input_port_read_indexed(machine, 20)&0x1C)
1919#define CGA_MONITOR_RGB         0x00   /* Colour RGB */
2020#define CGA_MONITOR_MONO      0x04   /* Greyscale RGB */
2121#define CGA_MONITOR_COMPOSITE   0x08   /* Colour composite */
r2340r2341
489489         data = mc6845_register_r( devconf, offset );
490490         break;
491491      case 10:
492         data = (readinputport(0) & 0x80 ) | 0x08 | aga.mda_status;
492         data = (input_port_read_indexed(machine, 0) & 0x80 ) | 0x08 | aga.mda_status;
493493         aga.mda_status ^= 0x01;
494494         break;
495495      /* 12, 13, 14  are the LPT1 ports */
r2340r2341
867867   case 0xe:
868868      // 0x20 low cga
869869      // 0x10 low special
870      result = readinputport(1)&0x38;
870      result = input_port_read_indexed(machine, 1)&0x38;
871871      break;
872872
873873   default:
src/mess/video/pc_cga.c
r2340r2341
4848***************************************************************************/
4949
5050#include "driver.h"
51#include "deprecat.h"
5152#include "video/pc_cga.h"
5253#include "video/mc6845.h"
5354#include "video/pc_video.h"
r2340r2341
125126INPUT_PORTS_END
126127
127128/* 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)
129130
130131/* 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)
132133#define CGA_MONITOR_RGB         0x00    /* Colour RGB */
133134#define CGA_MONITOR_MONO        0x04    /* Greyscale RGB */
134135#define CGA_MONITOR_COMPOSITE   0x08    /* Colour composite */
r2340r2341
137138
138139
139140/* 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)
141142#define CGA_CHIPSET_IBM         0x00    /* Original IBM CGA */
142143#define CGA_CHIPSET_PC1512      0x20    /* PC1512 CGA subset */
143144#define CGA_CHIPSET_PC200       0x40    /* PC200 in CGA mode */
r2340r2341
469470
470471
471472
472static VIDEO_UPDATE( mc6845_cga ) {
473static VIDEO_UPDATE( mc6845_cga )
474{
475   running_machine *machine = screen->machine;
473476   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
474477   mc6845_update( devconf, bitmap, cliprect);
475478
r2340r2341
10451048 */
10461049static void pc_cga_plantronics_w(int data)
10471050{
1051   running_machine *machine = Machine;
1052
10481053   CGA_LOG(1,"CGA_plantronics_w",("$%02x\n", data));
10491054
10501055   if (CGA_CHIPSET != CGA_CHIPSET_ATI) return;
r2340r2341
14981503}
14991504
15001505
1501static VIDEO_UPDATE( mc6845_pc1512 ) {
1506static VIDEO_UPDATE( mc6845_pc1512 )
1507{
1508   running_machine *machine = screen->machine;
15021509   device_config   *devconf = (device_config *) device_list_find_by_tag(screen->machine->config->devicelist, MC6845, CGA_MC6845_NAME);
15031510   mc6845_update( devconf, bitmap, cliprect);
15041511
src/mess/video/ssystem3.c
r2340r2341
209209   ssystem3_draw_led(bitmap, ssystem3_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3');
210210   ssystem3_draw_led(bitmap, ssystem3_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4');
211211
212   if (readinputportbytag("Configuration")&1) { // playfield(optional device)
212   if (input_port_read(screen->machine, "Configuration")&1) { // playfield(optional device)
213213     const int lcd_signs_on[]={
214214       0, // empty
215215       1, // bauer
src/mess/video/amstrad.c
r2340r2341
181181/* Initialise the palette */
182182PALETTE_INIT( amstrad_cpc )
183183{
184      if ( ((readinputportbytag("green_display")) & 0x01)==0 )
184      if ( ((input_port_read(machine, "green_display")) & 0x01)==0 )
185185      palette_set_colors(machine, 0, amstrad_palette, ARRAY_LENGTH(amstrad_palette));
186186      else
187187      palette_set_colors(machine, 0, amstrad_green_palette, ARRAY_LENGTH(amstrad_green_palette));
src/mess/video/vic6567.c
r2340r2341
5858#include <assert.h>
5959
6060#include "driver.h"
61#include "deprecat.h"
6162#include "vic6567.h"
6263#include "vic4567.h"
6364#include "utils.h"
src/mess/video/trs80.c
r2340r2341
2121   int width = 64 - ((trs80_port_ff & 8) << 2);
2222   int skip = 3 - (width >> 5);
2323   int i=0,x,y,chr;
24   int adj=readinputportbytag("CONFIG")&0x40;
24   int adj=input_port_read(screen->machine, "CONFIG")&0x40;
2525
2626   if (width != width_store)
2727   {
src/mess/video/pc1251.c
r2340r2341
120120{
121121   int x, y, i, j;
122122   int color[2];
123   running_machine *machine = screen->machine;
123124
124125   bitmap_fill(bitmap, cliprect, 11);
125126
src/mess/video/vc4000.c
r2340r2341
141141 
142142#ifndef ANALOG_HACK
143143   case 0xcc:
144      if (!activecpu_get_reg(S2650_FO)) data=readinputport(7);
145      else data=readinputport(8);
144      if (!activecpu_get_reg(S2650_FO)) data=input_port_read_indexed(machine, 7);
145      else data=input_port_read_indexed(machine, 8);
146146      break;
147147   case 0xcd:
148      if (!activecpu_get_reg(S2650_FO)) data=readinputport(9);
149      else data=readinputport(10);
148      if (!activecpu_get_reg(S2650_FO)) data=input_port_read_indexed(machine, 9);
149      else data=input_port_read_indexed(machine, 10);
150150      break;
151151#else
152152
r2340r2341
155155      // between 20 and 225
156156      if (!activecpu_get_reg(S2650_FO))
157157      {
158         if (readinputport(7)&0x1) data=20;
159         if (readinputport(7)&0x2) data=225;
158         if (input_port_read_indexed(machine, 7)&0x1) data=20;
159         if (input_port_read_indexed(machine, 7)&0x2) data=225;
160160      }
161161      else
162162      {
163         if (readinputport(7)&0x4) data=225;
164         if (readinputport(7)&0x8) data=20;
163         if (input_port_read_indexed(machine, 7)&0x4) data=225;
164         if (input_port_read_indexed(machine, 7)&0x8) data=20;
165165      }
166166      break;
167167
r2340r2341
169169      data = 0x66;
170170      if (!activecpu_get_reg(S2650_FO))
171171      {
172         if (readinputport(7)&0x10) data=20;
173         if (readinputport(7)&0x20) data=225;
172         if (input_port_read_indexed(machine, 7)&0x10) data=20;
173         if (input_port_read_indexed(machine, 7)&0x20) data=225;
174174      }
175175      else
176176      {
177         if (readinputport(7)&0x40) data=225;
178         if (readinputport(7)&0x80) data=20;
177         if (input_port_read_indexed(machine, 7)&0x40) data=225;
178         if (input_port_read_indexed(machine, 7)&0x80) data=20;
179179      }
180180      break;
181181#endif
src/mess/video/733_asr.c
r2340r2341
2121*/
2222
2323#include "driver.h"
24#include "deprecat.h"
2425#include "733_asr.h"
2526
2627#define MAX_ASR 1
r2340r2341
628629
629630   /* read current key state */
630631   for (i=0; i<6; i++)
631      key_buf[i] = readinputport(i);
632      key_buf[i] = input_port_read_indexed(Machine, i);
632633
633634   /* process key modifiers */
634635   if (key_buf[1] & 0x0200)
src/mess/machine/wswan.c
r2340r2341
942942         data = data & 0xF0;
943943         switch( data ) {
944944         case 0x10:   /* Read Y cursors: Y1 - Y2 - Y3 - Y4 */
945            data = data | readinputport( 2 );
945            data = data | input_port_read_indexed(machine, 2 );
946946            break;
947947         case 0x20:   /* Read X cursors: X1 - X2 - X3 - X4 */
948            data = data | readinputport( 0 );
948            data = data | input_port_read_indexed(machine, 0 );
949949            break;
950950         case 0x40:   /* Read buttons: START - A - B */
951            data = data | readinputport( 1 );
951            data = data | input_port_read_indexed(machine, 1 );
952952            break;
953953         }
954954         break;
src/mess/machine/zx.c
r2340r2341
110110
111111   if ((offset & 1) == 0)
112112   {
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);
115115
116116      ula_scancode_count = 0;
117117      if ((offset & 0x0100) == 0)
118118      {
119         data &= readinputport(1);
119         data &= input_port_read_indexed(machine, 1);
120120         /* SHIFT for extra keys */
121121         if (extra1 != 0xff || extra2 != 0xff)
122122            data &= ~0x01;
123123      }
124124      if ((offset & 0x0200) == 0)
125         data &= readinputport(2);
125         data &= input_port_read_indexed(machine, 2);
126126      if ((offset & 0x0400) == 0)
127         data &= readinputport(3);
127         data &= input_port_read_indexed(machine, 3);
128128      if ((offset & 0x0800) == 0)
129         data &= readinputport(4) & extra1;
129         data &= input_port_read_indexed(machine, 4) & extra1;
130130      if ((offset & 0x1000) == 0)
131         data &= readinputport(5) & extra2;
131         data &= input_port_read_indexed(machine, 5) & extra2;
132132      if ((offset & 0x2000) == 0)
133         data &= readinputport(6);
133         data &= input_port_read_indexed(machine, 6);
134134      if ((offset & 0x4000) == 0)
135         data &= readinputport(7);
135         data &= input_port_read_indexed(machine, 7);
136136      if ((offset & 0x8000) == 0)
137         data &= readinputport(8);
137         data &= input_port_read_indexed(machine, 8);
138138      if (video_screen_get_refresh(screen) > 55)
139139         data &= ~0x40;
140140
r2340r2341
176176
177177   if ((offset & 1) == 0)
178178   {
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);
181181
182182      ula_scancode_count = 0;
183183      if ((offset & 0x0100) == 0)
184184      {
185         data &= readinputport(1) & extra1;
185         data &= input_port_read_indexed(machine, 1) & extra1;
186186         /* SHIFT for extra keys */
187187         if (extra1 != 0xff || extra2 != 0xff)
188188            data &= ~0x01;
189189      }
190190      if ((offset & 0x0200) == 0)
191         data &= readinputport(2) & extra2;
191         data &= input_port_read_indexed(machine, 2) & extra2;
192192      if ((offset & 0x0400) == 0)
193         data &= readinputport(3);
193         data &= input_port_read_indexed(machine, 3);
194194      if ((offset & 0x0800) == 0)
195         data &= readinputport(4);
195         data &= input_port_read_indexed(machine, 4);
196196      if ((offset & 0x1000) == 0)
197         data &= readinputport(5);
197         data &= input_port_read_indexed(machine, 5);
198198      if ((offset & 0x2000) == 0)
199         data &= readinputport(6);
199         data &= input_port_read_indexed(machine, 6);
200200      if ((offset & 0x4000) == 0)
201         data &= readinputport(7);
201         data &= input_port_read_indexed(machine, 7);
202202      if ((offset & 0x8000) == 0)
203         data &= readinputport(8);
203         data &= input_port_read_indexed(machine, 8);
204204      if (video_screen_get_refresh(screen) > 55)
205205         data &= ~0x40;
206206
src/mess/machine/dgn_beta.c
r2340r2341
562562      {
563563         switch (Idx)
564564         {
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;
575575         }
576576
577577         if(Keyboard[Idx]!=0x7F)
r2340r2341
991991   {
992992      switch (Idx)
993993      {
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;
10041004         default : Row=0x7F; break;
10051005      }
10061006      Keyboard[Idx]=Row;
src/mess/machine/pc1401.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/sc61860/sc61860.h"
34
45#include "includes/pocketc.h"
r2340r2341
4142
4243int pc1401_ina(void)
4344{
45   running_machine *machine = Machine;
4446   int data=outa;
4547   if (outb&1) {
4648      if (KEY_SIGN) data|=1;
r2340r2341
148150
149151int pc1401_inb(void)
150152{
153   running_machine *machine = Machine;
151154   int data=outb;
152155   if (KEY_OFF) data|=1;
153156   return data;
r2340r2341
155158
156159int pc1401_brk(void)
157160{
161   running_machine *machine = Machine;
158162   return KEY_BRK;
159163}
160164
161165int pc1401_reset(void)
162166{
167   running_machine *machine = Machine;
163168   return KEY_RESET;
164169}
165170
src/mess/machine/apple2gs.c
r2340r2341
750750   /* read mouse values */
751751   if ((adb_kmstatus & 0x80) == 0x00)
752752   {
753      new_mouse_x = readinputportbytag("adb_mouse_x");
754      new_mouse_y = readinputportbytag("adb_mouse_y");
753      new_mouse_x = input_port_read(machine, "adb_mouse_x");
754      new_mouse_y = input_port_read(machine, "adb_mouse_y");
755755
756756      if ((apple2gs_mouse_x != new_mouse_x) || (apple2gs_mouse_y != new_mouse_y))
757757      {
src/mess/machine/hp48.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23
34#include "includes/hp48.h"
45
r2340r2341
500501      if (KEY_PLUS) data|=1;
501502   }
502503#else
503   if (out&0x100) data|=readinputport(0);
504   if (out&0x080) data|=readinputport(1);
505   if (out&0x040) data|=readinputport(2);
506   if (out&0x020) data|=readinputport(3);
507   if (out&0x010) data|=readinputport(4);
508   if (out&0x008) data|=readinputport(5);
509   if (out&0x004) data|=readinputport(6);
510   if (out&0x002) data|=readinputport(7);
511   if (out&0x001) data|=readinputport(8);
504   if (out&0x100) data|=input_port_read_indexed(machine, 0);
505   if (out&0x080) data|=input_port_read_indexed(machine, 1);
506   if (out&0x040) data|=input_port_read_indexed(machine, 2);
507   if (out&0x020) data|=input_port_read_indexed(machine, 3);
508   if (out&0x010) data|=input_port_read_indexed(machine, 4);
509   if (out&0x008) data|=input_port_read_indexed(machine, 5);
510   if (out&0x004) data|=input_port_read_indexed(machine, 6);
511   if (out&0x002) data|=input_port_read_indexed(machine, 7);
512   if (out&0x001) data|=input_port_read_indexed(machine, 8);
512513#endif
513514   return data;
514515}
src/mess/machine/dai.c
r2340r2341
3434
3535static OPBASE_HANDLER(dai_opbaseoverride)
3636{
37   tms5501_set_pio_bit_7 (0, (readinputport(8) & 0x04) ? 1:0);
37   tms5501_set_pio_bit_7 (0, (input_port_read_indexed(machine, 8) & 0x04) ? 1:0);
3838   return address;
3939}
4040
r2340r2341
6666   for (i = 0; i < 8; i++)
6767   {
6868      if (dai_keyboard_scan_mask & (1 << i))
69         data |= readinputport(i);
69         data |= input_port_read_indexed(Machine, i);
7070   }
7171   return data;
7272}
r2340r2341
169169
170170   switch(offset & 0x000f) {
171171   case 0x00:
172      data = readinputport(8);
172      data = input_port_read_indexed(machine, 8);
173173      data |= 0x08;         // serial ready
174174      if (mame_rand(machine)&0x01)
175175         data |= 0x40;      // random number generator
src/mess/machine/mac.c
r2340r2341
6666
6767static TIMER_CALLBACK(mac_scanline_tick);
6868static emu_timer *mac_scanline_timer;
69static int scan_keyboard(void);
69static int scan_keyboard(running_machine *machine);
7070static TIMER_CALLBACK(inquiry_timeout_func);
71static void keyboard_receive(int val);
71static void keyboard_receive(running_machine *machine, int val);
7272static READ8_HANDLER(mac_via_in_a);
7373static READ8_HANDLER(mac_via_in_b);
7474static WRITE8_HANDLER(mac_via_out_a);
r2340r2341
285285static int keycode_buf[2];
286286static int keycode_buf_index;
287287
288static int scan_keyboard()
288static int scan_keyboard(running_machine *machine)
289289{
290290   int i, j;
291291   int keybuf;
r2340r2341
298298
299299   for (i=0; i<7; i++)
300300   {
301      keybuf = readinputport(i+3);
301      keybuf = input_port_read_indexed(machine, i+3);
302302
303303      if (keybuf != key_matrix[i])
304304      {
r2340r2341
430430      {
431431         kbd_receive = FALSE;
432432         /* Process the command received from mac */
433         keyboard_receive(kbd_shift_reg & 0xff);
433         keyboard_receive(machine, kbd_shift_reg & 0xff);
434434      }
435435      else
436436      {
r2340r2341
478478/*
479479   called when a command is received from the mac
480480*/
481static void keyboard_receive(int val)
481static void keyboard_receive(running_machine *machine, int val)
482482{
483483   switch (val)
484484   {
r2340r2341
487487      if (LOG_KEYBOARD)
488488         logerror("keyboard command : inquiry\n");
489489
490      keyboard_reply = scan_keyboard();
490      keyboard_reply = scan_keyboard(machine);
491491      if (keyboard_reply == 0x7B)
492492      {
493493         /* if NULL, wait until key pressed or timeout */
r2340r2341
501501      if (LOG_KEYBOARD)
502502         logerror("keyboard command : instant\n");
503503
504      kbd_shift_out(scan_keyboard());
504      kbd_shift_out(scan_keyboard(machine));
505505      break;
506506
507507   case 0x16:
r2340r2341
565565   int         new_mx, new_my;
566566   int         x_needs_update = 0, y_needs_update = 0;
567567
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);
570570
571571   /* see if it moved in the x coord */
572572   if (new_mx != last_mx)
r2340r2341
12061206         val |= 0x20;
12071207      if (mouse_bit_x)   /* Mouse X2 */
12081208         val |= 0x10;
1209      if ((readinputport(0) & 0x01) == 0)
1209      if ((input_port_read_indexed(machine, 0) & 0x01) == 0)
12101210         val |= 0x08;
12111211   }
12121212   if (rtc_data_out)
r2340r2341
14191419   ncr5380_init(&macplus_5380intf);
14201420}
14211421
1422static void mac_vblank_irq(void)
1422static void mac_vblank_irq(running_machine *machine)
14231423{
14241424   static int irq_count = 0, ca1_data = 0, ca2_data = 0;
14251425
14261426   /* handle keyboard */
14271427   if (kbd_comm == TRUE)
14281428   {
1429      int keycode = scan_keyboard();
1429      int keycode = scan_keyboard(machine);
14301430
14311431      if (keycode != 0x7B)
14321432      {
r2340r2341
14671467
14681468   scanline = video_screen_get_vpos(machine->primary_screen);
14691469   if (scanline == MAC_V_VIS)
1470      mac_vblank_irq();
1470      mac_vblank_irq(machine);
14711471
14721472   /* check for mouse changes at 10 irqs per frame */
14731473   if (!(scanline % 10))
src/mess/machine/adam.c
r2340r2341
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "video/tms9928a.h"
1112#include "includes/adam.h"
1213#include "devices/cartslot.h"
r2340r2341
115116//logerror("Exploring Keyboard.............\n");
116117    for(i=0;i<=255;i++) {if (KbRepeatTable[i]>0) KbRepeatTable[i]++;} /* Update repeat table */
117118
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");
128129
129130/* Reference: Appendix of COLECO ADAM TECHNICAL MANUAL at http://drushel.cwru.edu/atm/atm.html */
130131
r2340r2341
800801 READ8_HANDLER ( adam_paddle_r )
801802{
802803
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 */
804805   /* Player 1 */
805806   if ((offset & 0x02)==0)
806807   {
r2340r2341
809810      {
810811         int inport0,inport1,inport6,data;
811812
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");
815816
816817         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
817818         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r2340r2341
838839      /* Joystick and fire 2 (SAC Red Button) */
839840      else
840841      {
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");
843844
844845         if (inport6&0x07) /* If Extra Contollers enabled */
845846         {
r2340r2341
859860      {
860861         int inport3,inport4,data;
861862
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");
864865
865866         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
866867         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r2340r2341
885886      /* Joystick and fire 2*/
886887      else
887888      {
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");
890891
891892         if (inport6&0x02) /* If Roller Controller enabled */
892893         {
src/mess/machine/cbmb.c
r2340r2341
110110static int cbmb_keyboard_line_a(void)
111111{
112112   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);
119119
120120   return data^0xff;
121121}
r2340r2341
123123static int cbmb_keyboard_line_b(void)
124124{
125125   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);
132132
133133   return data^0xff;
134134}
r2340r2341
137137{
138138   int data=0;
139139
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;
152152
153153   if (!cbm500) {
154154      if (!cbm_ntsc) data|=0x40;
r2340r2341
371371
372372   vic2_frame_interrupt (machine, 0);
373373
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);
375375#if 0
376376   set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0);
377377#endif
src/mess/machine/pc1350.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/sc61860/sc61860.h"
34
45#include "includes/pocketc.h"
r2340r2341
2526
2627int pc1350_ina(void)
2728{
29   running_machine *machine = Machine;
2830   int data=outa;
2931   int t=pc1350_keyboard_line_r();
3032   if (t&1) {
r2340r2341
127129
128130int pc1350_brk(void)
129131{
132   running_machine *machine = Machine;
130133   return PC1350_KEY_BRK;
131134}
132135
src/mess/machine/pokemini.c
r2340r2341
643643   case 0x0A:   return ( timers.seconds_counter >> 8 ) & 0xFF;
644644   case 0x0B:   return ( timers.seconds_counter >> 16 ) & 0xFF;
645645   case 0x41:   return timers.hz256_counter;
646   case 0x52:   return readinputport( 0 );
646   case 0x52:   return input_port_read_indexed(machine, 0 );
647647   }
648648   logerror( "%0X: Read from unknown hardware address: %02X\n", activecpu_get_pc(), offset );
649649   return pokemini_hwreg[offset];
src/mess/machine/nes.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/m6502/m6502.h"
34#include "video/ppu2c0x.h"
45#include "includes/nes.h"
r2340r2341
229230   retVal |= ((in_0.i0 >> in_0.shift) & 0x01);
230231
231232   /* Check the configuration to see what's connected */
232   cfg = readinputport(PORT_CONFIG1);
233   cfg = input_port_read_indexed(machine, PORT_CONFIG1);
233234
234235   if (((cfg & 0x000f) == 0x0002) || ((cfg & 0x000f) == 0x0003))
235236   {
r2340r2341
263264   retVal |= ((in_1.i0 >> in_1.shift) & 0x01);
264265
265266   /* Check the fake dip to see what's connected */
266   cfg = readinputport(PORT_CONFIG1);
267   cfg = input_port_read_indexed(machine, PORT_CONFIG1);
267268
268269   if (((cfg & 0x00f0) == 0x0020) || ((cfg & 0x00f0) == 0x0030))
269270   {
r2340r2341
309310   {
310311      case 0x01:   /* gamepad */
311312         if (pad_port >= 0)
312            vals->i0 = readinputport(pad_port);
313            vals->i0 = input_port_read_indexed(Machine, pad_port);
313314         break;
314315
315316      case 0x02:   /* zapper 1 */
316317         if (supports_zapper)
317318         {
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);
321322         }
322323         break;
323324
324325      case 0x03:   /* zapper 2 */
325326         if (supports_zapper)
326327         {
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);
330331         }
331332         break;
332333
333334      case 0x04:   /* arkanoid paddle */
334335         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;
336337         break;
337338   }
338339}
r2340r2341
355356   in_1.shift = 0;
356357
357358   /* Check the configuration to see what's connected */
358   cfg = readinputport(PORT_CONFIG1);
359   cfg = input_port_read_indexed(machine, PORT_CONFIG1);
359360
360361   /* Read the input devices */
361362   nes_read_input_device(cfg >>  0, &in_0, PORT_PAD0,  TRUE, -1);
src/mess/machine/gb.c
r2340r2341
757757   case 0x00:                  /* JOYP - Joypad */
758758      JOYPAD = 0xCF | data;
759759      if (!(data & 0x20))
760         JOYPAD &= (readinputport (0) >> 4) | 0xF0;
760         JOYPAD &= (input_port_read_indexed(machine, 0) >> 4) | 0xF0;
761761      if (!(data & 0x10))
762         JOYPAD &= readinputport (0) | 0xF0;
762         JOYPAD &= input_port_read_indexed(machine, 0) | 0xF0;
763763      return;
764764   case 0x01:                  /* SB - Serial transfer data */
765765      break;
r2340r2341
878878            sgb_bitcount = 0;
879879            sgb_start = 1;
880880            sgb_rest = 0;
881            JOYPAD = 0x0F & ((readinputport (0) >> 4) | readinputport (0) | 0xF0);
881            JOYPAD = 0x0F & ((input_port_read_indexed(machine, 0) >> 4) | input_port_read_indexed(machine, 0) | 0xF0);
882882            break;
883883         case 0x10:               /* data true */
884884            if (sgb_rest)
r2340r2341
900900               }
901901               sgb_rest = 0;
902902            }
903            JOYPAD = 0x1F & ((readinputport (0) >> 4) | 0xF0);
903            JOYPAD = 0x1F & ((input_port_read_indexed(machine, 0) >> 4) | 0xF0);
904904            break;
905905         case 0x20:            /* data false */
906906            if (sgb_rest)
r2340r2341
13211321               }
13221322               sgb_rest = 0;
13231323            }
1324            JOYPAD = 0x2F & (readinputport (0) | 0xF0);
1324            JOYPAD = 0x2F & (input_port_read_indexed(machine, 0) | 0xF0);
13251325            break;
13261326         case 0x30:               /* rest condition */
13271327            if (sgb_start)
src/mess/machine/concept.c
r2340r2341
179179
180180   for (i=0; (i</*4*/3) && (KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); i++)
181181   {
182      keystate = readinputport(input_port_keyboard_concept + i*2)
183               | (readinputport(input_port_keyboard_concept + i*2 + 1) << 16);
182      keystate = input_port_read_indexed(machine, input_port_keyboard_concept + i*2)
183               | (input_port_read_indexed(machine, input_port_keyboard_concept + i*2 + 1) << 16);
184184      key_transitions = keystate ^ KeyStateSave[i];
185185      if (key_transitions)
186186      {
r2340r2341
253253{
254254   UINT8 status;
255255
256   status = ((readinputport(dipswitch_port_concept) & 0x80) >> 1) | ((readinputport(dipswitch_port_concept) & 0x40) << 1);
256   status = ((input_port_read_indexed(machine, dipswitch_port_concept) & 0x80) >> 1) | ((input_port_read_indexed(machine, dipswitch_port_concept) & 0x40) << 1);
257257   LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status));
258258   return status;
259259}
src/mess/machine/kim1.c
r2340r2341
88******************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1112#include "cpu/m6502/m6502.h"
1213#include "includes/kim1.h"
1314#include "sound/dac.h"
r2340r2341
681682INLINE int m6530_r(int chip, int offset)
682683{
683684   int data = 0xff;
685   running_machine *machine = Machine;
684686
685687   switch (offset)
686688   {
r2340r2341
693695         switch (which)
694696         {
695697         case 0:               /* key row 1 */
696            m6530[1].dria = readinputport(0);
698            m6530[1].dria = input_port_read_indexed(machine, 0);
697699            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
698700                which,
699701                (m6530[1].dria & 0x40) ? '.' : '0',
r2340r2341
705707                (m6530[1].dria & 0x01) ? '.' : '6');
706708            break;
707709         case 1:               /* key row 2 */
708            m6530[1].dria = readinputport(1);
710            m6530[1].dria = input_port_read_indexed(machine, 1);
709711            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
710712                which,
711713                (m6530[1].dria & 0x40) ? '.' : '7',
r2340r2341
717719                (m6530[1].dria & 0x01) ? '.' : 'D');
718720            break;
719721         case 2:               /* key row 3 */
720            m6530[1].dria = readinputport(2);
722            m6530[1].dria = input_port_read_indexed(machine, 2);
721723            logerror("read keybd(%d): %c%c%c%c%c%c%c\n",
722724                which,
723725                (m6530[1].dria & 0x40) ? '.' : 'E',
src/mess/machine/msx.c
r2340r2341
405405
406406INTERRUPT_GEN( msx2_interrupt )
407407{
408   v9938_set_sprite_limit(0, readinputport (8) & 0x20);
409   v9938_set_resolution(0, readinputport (8) & 0x03);
408   v9938_set_sprite_limit(0, input_port_read_indexed(machine, 8) & 0x20);
409   v9938_set_resolution(0, input_port_read_indexed(machine, 8) & 0x03);
410410   v9938_interrupt(0);
411411}
412412
r2340r2341
416416
417417   for (i=0;i<2;i++)
418418   {
419      msx1.mouse[i] = readinputport (9+i);
419      msx1.mouse[i] = input_port_read_indexed(machine, 9+i);
420420      msx1.mouse_stat[i] = -1;
421421   }
422422
423   TMS9928A_set_spriteslimit (readinputport (8) & 0x20);
423   TMS9928A_set_spriteslimit (input_port_read_indexed(machine, 8) & 0x20);
424424   TMS9928A_interrupt();
425425}
426426
r2340r2341
457457
458458   data = (cassette_input(cassette_device_image()) > 0.0038 ? 0x80 : 0);
459459
460   if ( (msx1.psg_b ^ readinputport(8) ) & 0x40)
460   if ( (msx1.psg_b ^ input_port_read_indexed(machine, 8) ) & 0x40)
461461      {
462462      /* game port 2 */
463      inp = readinputport(7) & 0x7f;
463      inp = input_port_read_indexed(machine, 7) & 0x7f;
464464#if 0
465465      if ( !(inp & 0x80) )
466466         {
r2340r2341
485485   else
486486      {
487487      /* game port 1 */
488      inp = readinputport(6) & 0x7f;
488      inp = input_port_read_indexed(machine, 6) & 0x7f;
489489#if 0
490490      if ( !(inp & 0x80) )
491491         {
r2340r2341
540540
541541WRITE8_HANDLER ( msx_printer_w )
542542{
543   if (readinputport (8) & 0x80) {
543   if (input_port_read_indexed(machine, 8) & 0x80) {
544544      /* SIMPL emulation */
545545      if (offset == 1)
546546         DAC_signed_data_w (0, data);
r2340r2341
565565
566566READ8_HANDLER ( msx_printer_r )
567567{
568   if (offset == 0 && ! (readinputport (8) & 0x80) &&
568   if (offset == 0 && ! (input_port_read_indexed(machine, 8) & 0x80) &&
569569         printer_status(printer_image(), 0) )
570570      return 253;
571571
r2340r2341
735735   row = ppi8255_0_r(machine, 2) & 0x0f;
736736   if (row <= 10)
737737   {
738      data = readinputport (row/2);
738      data = input_port_read_indexed(machine, row/2);
739739      if (row & 1)
740740         data >>= 8;
741741      result = data & 0xff;
src/mess/machine/gamecom.c
r2340r2341
114114   static UINT32 stylus_y;
115115
116116   if ( column == 0 ) {
117      if ( ! ( readinputport(2) & 0x04 ) ) {
118         stylus_x = readinputport( 3 ) >> 4;
119         stylus_y = readinputport( 4 ) >> 4;
117      if ( ! ( input_port_read_indexed(Machine, 2) & 0x04 ) ) {
118         stylus_x = input_port_read_indexed(Machine,  3 ) >> 4;
119         stylus_y = input_port_read_indexed(Machine,  4 ) >> 4;
120120      } else {
121121         stylus_x = 16;
122122         stylus_y = 16;
r2340r2341
208208                  /* P0 bit 7 cleared => 8B (button A) */
209209                  /* P1 bit 0 cleared => 8C (button B) */
210210                  /* P1 bit 1 cleared => 8D (button C) */
211               cpunum_set_reg( 0, SM8500_P0, readinputport(0) );
212               cpunum_set_reg( 0, SM8500_P1, ( cpunum_get_reg( 0, SM8500_P1 ) & 0xFC ) | ( readinputport(1) & 0x03 ) );
211               cpunum_set_reg( 0, SM8500_P0, input_port_read_indexed(machine, 0) );
212               cpunum_set_reg( 0, SM8500_P1, ( cpunum_get_reg( 0, SM8500_P1 ) & 0xFC ) | ( input_port_read_indexed(machine, 1) & 0x03 ) );
213213               break;
214214            case 0xFFFF:   /* keys #2 */
215215                  /* P0 bit 0 cleared => 88 (power) */
r2340r2341
222222                  /* P0 bit 7 cleared => A0 */
223223                  /* P1 bit 0 cleared => A0 */
224224                  /* P1 bit 1 cleared => A0 */
225               cpunum_set_reg( 0, SM8500_P0, ( cpunum_get_reg( 0, SM8500_P0 ) & 0xFC ) | ( readinputport(2) & 0x03 ) );
225               cpunum_set_reg( 0, SM8500_P0, ( cpunum_get_reg( 0, SM8500_P0 ) & 0xFC ) | ( input_port_read_indexed(machine, 2) & 0x03 ) );
226226               cpunum_set_reg( 0, SM8500_P1, 0xFF );
227227               break;
228228            }
src/mess/machine/advision.c
r2340r2341
175175   int d, in;
176176
177177   // Get joystick switches
178   in = readinputportbytag("joystick");
178   in = input_port_read(machine, "joystick");
179179   d = in | 0x0f;
180180
181181   // Get buttons
src/mess/machine/mz700.c
r2340r2341
141141   UINT8 demux_LS145, data = 0xff;
142142
143143    demux_LS145 = pio_port_a_output & 15;
144    data = readinputport(1 + demux_LS145);
144    data = input_port_read_indexed(machine, 1 + demux_LS145);
145145   LOG(2,"mz700_pio_port_b_r",("%02X\n", data));
146146
147147    return data;
r2340r2341
166166   if (ne556_out[0])
167167        data |= 0x40;           /* set the 556OUT status */
168168
169    data |= readinputport(0);   /* get VBLANK in bit 7 */
169    data |= input_port_read_indexed(machine, 0);   /* get VBLANK in bit 7 */
170170
171171   LOG(2,"mz700_pio_port_c_r",("%02X\n", data));
172172
r2340r2341
237237
238238   case 8:
239239      data = ne556_out[1] ? 0x01 : 0x00;
240      data |= readinputport(12);   /* get joystick ports */
240      data |= input_port_read_indexed(machine, 12);   /* get joystick ports */
241241      if (video_screen_get_hpos(machine->primary_screen) >= visarea->max_x - 32)
242242         data |= 0x80;
243243      LOG(1,"mz700_e008_r",("%02X\n", data));
src/mess/machine/vectrex.c
r2340r2341
106106 *********************************************************************/
107107void vectrex_configuration(void)
108108{
109   unsigned char cport = readinputport(5);
109   unsigned char cport = input_port_read_indexed(Machine, 5);
110110
111111   /* Vectrex 'dipswitch' configuration */
112112
r2340r2341
183183      vectrex_beam_color = RGB_WHITE;
184184      imager_colors[0]=imager_colors[1]=imager_colors[2]=imager_colors[3]=imager_colors[4]=imager_colors[5]=RGB_WHITE;
185185   }
186   vectrex_lightpen_port = (readinputport(6) & 0x03);
186   vectrex_lightpen_port = (input_port_read_indexed(Machine, 6) & 0x03);
187187}
188188
189189/*********************************************************************
r2340r2341
194194   cpunum_set_input_line(Machine, 0, M6809_IRQ_LINE, level);
195195}
196196
197 READ8_HANDLER( v_via_pb_r )
197READ8_HANDLER( v_via_pb_r )
198198{
199199   int pot;
200   pot = readinputport(((vectrex_via_out[PORTB] & 0x6)>>1) + 1) - 0x80;
200   pot = input_port_read_indexed(machine, ((vectrex_via_out[PORTB] & 0x6)>>1) + 1) - 0x80;
201201
202202   if (pot > (signed char)vectrex_via_out[PORTA])
203203      vectrex_via_out[PORTB] |= 0x20;
r2340r2341
221221
222222READ8_HANDLER( s1_via_pb_r )
223223{
224   return (vectrex_via_out[PORTB] & ~0x40) | ((readinputport(1) & 0x1)<<6);
224   return (vectrex_via_out[PORTB] & ~0x40) | ((input_port_read_indexed(machine, 1) & 0x1)<<6);
225225}
226226
227227/*********************************************************************
src/mess/machine/aim65.c
r2340r2341
142142   for (row = 0; row < 8; row++) {
143143      sprintf(portname, "keyboard_%d", row);
144144      if (!(riot_port_a & (1 << row)))
145         data &= readinputportbytag(portname);
145         data &= input_port_read(machine, portname);
146146   }
147147
148148   return data;
r2340r2341
191191
192192static READ8_HANDLER( aim65_via0_b_r )
193193{
194   return readinputportbytag("switches");
194   return input_port_read(machine, "switches");
195195}
196196
197197
src/mess/machine/pclpt.c
r2340r2341
66
77
88#include "driver.h"
9#include "deprecat.h"
910#include "memconv.h"
1011#include "includes/pclpt.h"
1112#include "machine/centroni.h"
r2340r2341
5859static void pc_LPT_w(int n, int offset, int data)
5960{
6061   PC_LPT *This=LPT+n;
61   if ( !(readinputport(2) & (0x08>>n)) ) return;
62   if ( !(input_port_read_indexed(Machine, 2) & (0x08>>n)) ) return;
6263//   if (!This->on) return;
6364   switch( offset )
6465   {
r2340r2341
9394{
9495   PC_LPT *This=LPT+n;
9596    int data = 0xff;
96   if ( !(readinputport(2) & (0x08>>n)) ) return data;
97   if ( !(input_port_read_indexed(Machine, 2) & (0x08>>n)) ) return data;
9798//   if (!This->on) return data;
9899   switch( offset )
99100   {
src/mess/machine/pc_joy.c
r2340r2341
2323
2424   if (joystick_port >= 0)
2525   {
26      data = readinputport(joystick_port + 0) ^ 0xf0;
26      data = input_port_read_indexed(machine, joystick_port + 0) ^ 0xf0;
2727
2828      /* timer overflow? */
2929      if (attotime_compare(attotime_sub(new_time, JOY_time), ATTOTIME_IN_MSEC(10)) > 0)
r2340r2341
3333      else
3434      {
3535         delta = attotime_mul(attotime_sub(new_time, JOY_time), 256 * 1000).seconds;
36         if (readinputport(joystick_port + 1) < delta) data &= ~0x01;
37         if (readinputport(joystick_port + 2) < delta) data &= ~0x02;
38         if (readinputport(joystick_port + 3) < delta) data &= ~0x04;
39         if (readinputport(joystick_port + 4) < delta) data &= ~0x08;
36         if (input_port_read_indexed(machine, joystick_port + 1) < delta) data &= ~0x01;
37         if (input_port_read_indexed(machine, joystick_port + 2) < delta) data &= ~0x02;
38         if (input_port_read_indexed(machine, joystick_port + 3) < delta) data &= ~0x04;
39         if (input_port_read_indexed(machine, joystick_port + 4) < delta) data &= ~0x08;
4040      }
4141   }
4242   return data;
src/mess/machine/thomson.c
r2340r2341
370370
371371static READ8_HANDLER ( to7_timer_port_in )
372372{
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;
374374   int cass = to7_get_cassette() ? 0x80 : 0;
375375   return lightpen | cass;
376376}
r2340r2341
469469      for ( i = 0; i < 8; i++ )
470470      {
471471         if ( ! (keyline & (1 << i)) )
472            val &= readinputport( THOM_INPUT_KEYBOARD + i );
472            val &= input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + i );
473473      }
474474      return val;
475475   }
r2340r2341
758758
759759READ8_HANDLER ( to7_modem_mea8000_r )
760760{
761   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
761   if ( input_port_read_indexed(machine, THOM_INPUT_MCONFIG ) & 1 )
762762      return mea8000_r( machine, offset );
763763   else
764764   {
r2340r2341
774774
775775WRITE8_HANDLER ( to7_modem_mea8000_w )
776776{
777   if ( readinputport( THOM_INPUT_MCONFIG ) & 1 )
777   if ( input_port_read_indexed(machine, THOM_INPUT_MCONFIG ) & 1 )
778778      mea8000_w( machine, offset, data );
779779   else
780780   {
r2340r2341
822822static UINT8 to7_get_mouse_signal( void )
823823{
824824   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 */
827827   xa = ((dx + 1) & 3) <= 1;
828828   xb = (dx & 3) <= 1;
829829   ya = ((dy + 1) & 3) <= 1;
r2340r2341
843843static READ8_HANDLER ( to7_game_porta_in )
844844{
845845   UINT8 data;
846   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
846   if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 )
847847   {
848848      /* mouse */
849849      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 */
851851   }
852852   else
853853   {
854854      /* joystick */
855      data = readinputport( THOM_INPUT_GAME );
855      data = input_port_read_indexed(machine, THOM_INPUT_GAME );
856856      /* bit 0=0 => P1 up      bit 4=0 => P2 up
857857         bit 1=0 => P1 down    bit 5=0 => P2 down
858858         bit 2=0 => P1 left    bit 6=0 => P2 left
r2340r2341
884884static READ8_HANDLER ( to7_game_portb_in )
885885{
886886   UINT8 data;
887   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
887   if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 )
888888   {
889889      /* mouse */
890890      UINT8 mouse =  to7_get_mouse_signal();
r2340r2341
901901      /* bits 2-3: action buttons B (0=pressed) */
902902      /* bits 4-5: unused (ouput) */
903903      /* bits 0-1: unknown! */
904      data = readinputport( THOM_INPUT_GAME + 1 );
904      data = input_port_read_indexed(machine, THOM_INPUT_GAME + 1 );
905905   }
906906   return data;
907907}
r2340r2341
938938/* this should be called periodically */
939939static TIMER_CALLBACK(to7_game_update_cb)
940940{
941   if ( readinputport( THOM_INPUT_CONFIG ) & 1 )
941   if ( input_port_read_indexed(machine, THOM_INPUT_CONFIG ) & 1 )
942942   {
943943      /* mouse */
944944      UINT8 mouse = to7_get_mouse_signal();
r2340r2341
948948   else
949949   {
950950      /* joystick */
951      UINT8 in = readinputport( THOM_INPUT_GAME );
951      UINT8 in = input_port_read_indexed(machine, THOM_INPUT_GAME );
952952      pia_set_input_cb2( THOM_PIA_GAME, (in & 0x80) ? 1 : 0 ); /* P2 action A */
953953      pia_set_input_ca2( THOM_PIA_GAME, (in & 0x40) ? 1 : 0 ); /* P1 action A */
954954      pia_set_input_cb1( THOM_PIA_GAME, (in & 0x08) ? 1 : 0 ); /* P2 action B */
r2340r2341
13521352{
13531353   /* keyboard */
13541354   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 );
13561356}
13571357
13581358
r2340r2341
16171617{
16181618   return
16191619      (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)
16211621      /* bit 5: lightpen button */;
16221622}
16231623
r2340r2341
16351635   UINT8 portb = pia_get_output_b( THOM_PIA_SYS );
16361636   int col = (portb >> 1) & 7;       /* key column */
16371637   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;
16391639}
16401640
16411641
r2340r2341
22692269
22702270   for ( line = 0; line < 10; line++ )
22712271   {
2272      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
2272      UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line );
22732273
22742274      if ( line == 7 || line == 9 )
22752275         port |= 1; /* shift & control */
r2340r2341
24942494/* returns the ASCII code for the key, or 0 for no key */
24952495static int to9_kbd_get_key( void )
24962496{
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);
24992499   int key = -1, line, bit;
25002500
25012501   for ( line = 0; line < 10; line++ )
25022502   {
2503      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
2503      UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line );
25042504
25052505      if ( line == 7 || line == 9 )
25062506         port |= 1; /* shift & control */
r2340r2341
25912591
25922592      case 1: /* x axis */
25932593      {
2594         int newx = readinputport( THOM_INPUT_GAME + 2 );
2594         int newx = input_port_read_indexed(machine, THOM_INPUT_GAME + 2 );
25952595         UINT8 data = ( (newx - to9_mouse_x) & 0xf ) - 8;
25962596         to9_kbd_send( data, 1 );
25972597         to9_mouse_x = newx;
r2340r2341
26002600
26012601      case 2: /* y axis */
26022602      {
2603         int newy = readinputport( THOM_INPUT_GAME + 3 );
2603         int newy = input_port_read_indexed(machine, THOM_INPUT_GAME + 3 );
26042604         UINT8 data = ( (newy - to9_mouse_y) & 0xf ) - 8;
26052605         to9_kbd_send( data, 1 );
26062606         to9_mouse_y = newy;
r2340r2341
26092609
26102610      case 3: /* axis overflow & buttons */
26112611      {
2612         int b = readinputport( THOM_INPUT_GAME + 4 );
2612         int b = input_port_read_indexed(machine, THOM_INPUT_GAME + 4 );
26132613         UINT8 data = 0;
26142614         if ( b & 1 ) data |= 1;
26152615         if ( b & 2 ) data |= 4;
r2340r2341
29012901{
29022902   int line, bit;
29032903
2904   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
2904   if ( input_port_read_indexed(Machine, THOM_INPUT_CONFIG ) & 2 )
29052905      return 0; /* disabled */
29062906
29072907   for ( line = 0; line < 10; line++ )
29082908   {
2909      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
2909      UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line );
29102910
29112911      if ( line == 7 || line == 9 )
29122912         port |= 1; /* shift & control */
r2340r2341
29262926/* keyboard scan & return keycode (or -1) */
29272927static int to8_kbd_get_key( void )
29282928{
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;
29312931   int key = -1, line, bit;
29322932
2933   if ( readinputport( THOM_INPUT_CONFIG ) & 2 )
2933   if ( input_port_read_indexed(Machine, THOM_INPUT_CONFIG ) & 2 )
29342934      return -1; /* disabled */
29352935
29362936   for ( line = 0; line < 10; line++ )
29372937   {
2938      UINT8 port = readinputport( THOM_INPUT_KEYBOARD + line );
2938      UINT8 port = input_port_read_indexed(Machine, THOM_INPUT_KEYBOARD + line );
29392939
29402940      if ( line == 7 || line == 9 )
29412941         port |= 1; /* shift & control */
r2340r2341
36253625
36263626static READ8_HANDLER ( to8_timer_port_in )
36273627{
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;
36293629   int cass = to7_get_cassette() ? 0x80 : 0;
36303630   int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40;
36313631   int lock = to8_kbd_caps ? 0 : 8; /* undocumented! */
r2340r2341
38163816
38173817static READ8_HANDLER ( to9p_timer_port_in )
38183818{
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;
38203820   int cass = to7_get_cassette() ? 0x80 : 0;
38213821   int dtr = (centronics_read_handshake( 0 ) & CENTRONICS_NOT_BUSY) ? 0 : 0x40;
38223822   return lightpen | cass | dtr;
r2340r2341
41374137static TIMER_CALLBACK(mo6_game_update_cb)
41384138{
41394139   /* 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 )
41414141   {
41424142      UINT8 mouse = to7_get_mouse_signal();
41434143      pia_set_input_ca1( THOM_PIA_GAME, mouse & 1 ); /* XA */
r2340r2341
41464146   else
41474147   {
41484148      /* joystick */
4149      UINT8 in = readinputport( THOM_INPUT_GAME );
4149      UINT8 in = input_port_read_indexed(machine, THOM_INPUT_GAME );
41504150      pia_set_input_ca1( THOM_PIA_GAME, in & 0x04 ); /* P1 action B */
41514151      pia_set_input_ca2( THOM_PIA_GAME, in & 0x40 ); /* P1 action A */
41524152   }
r2340r2341
41864186   return
41874187      (mo5_get_cassette() ? 0x80 : 0) |     /* bit 7: cassette input */
41884188      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);
41904190   /* bit 1: lightpen button */;
41914191}
41924192
r2340r2341
42044204      lin = 8;     /* A bit 3: 9-th kbd line select */
42054205
42064206   return
4207      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
4207      ( input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
42084208      ?  0x80 : 0; /* bit 7: key up */
42094209}
42104210
r2340r2341
46174617   int col = (portb >> 4) & 7;    /* B bits 4-6: kbd column */
46184618   int lin = (portb >> 1) & 7;    /* B bits 1-3: kbd line */
46194619   return
4620      ( readinputport( THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
4620      ( input_port_read_indexed(machine, THOM_INPUT_KEYBOARD + lin ) & (1 << col) )
46214621      ?  0x80 : 0; /* bit 7: key up */
46224622}
46234623
src/mess/machine/lisa.c
r2340r2341
390390/* keyboard matrix to detect transition */
391391static int key_matrix[8];
392392
393static void scan_keyboard( void )
393static void scan_keyboard(running_machine *machine)
394394{
395395   int i, j;
396396   int keybuf;
r2340r2341
399399   if (! COPS_force_unplug)
400400      for (i=0; i<8; i++)
401401      {
402         keybuf = readinputport(i+2);
402         keybuf = input_port_read_indexed(machine, i+2);
403403
404404         if (keybuf != key_matrix[i])
405405         {   /* if state has changed, find first bit which has changed */
r2340r2341
444444   /*if (COPS_force_unplug)
445445      return;*/   /* ???? */
446446
447   new_mx = readinputport(0);
448   new_my = readinputport(1);
447   new_mx = input_port_read_indexed(machine, 0);
448   new_my = input_port_read_indexed(machine, 1);
449449
450450   /* see if it moved in the x coord */
451451   if (new_mx != last_mx)
r2340r2341
12991299      set_VTIR(machine, 1);
13001300
13011301   /* do keyboard scan */
1302   scan_keyboard();
1302   scan_keyboard(machine);
13031303}
13041304
13051305/*
src/mess/machine/sym1.c
r2340r2341
8888   int data = 0x7f;
8989
9090   /* 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");
9595
9696   /* 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 )
9898      data &= ~0x80;
9999
100100   return data;
r2340r2341
106106   int data = 0xff;
107107
108108   /* 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 )
110110      data &= ~1;
111111
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 )
113113      data &= ~2;
114114
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 )
116116      data &= ~4;
117117
118118   data &= ~0x80; // else hangs 8b02
r2340r2341
199199   logerror("SYM1 VIA2 W 0x%02x\n", data);
200200
201201   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);
203203
204204   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);
206206
207207   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);
209209
210210   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);
212212}
213213
214214
src/mess/machine/lynx.c
r2340r2341
686686      if (suzy.accumulate_overflow) data|=0x40;
687687      break;
688688   case 0xb0:
689      input=readinputportbytag("JOY");
689      input=input_port_read(machine, "JOY");
690690      switch (lynx_rotate) {
691691      case 1:
692692         data=input;
r2340r2341
715715         data=input;
716716      }
717717      break;
718   case 0xb1: data=readinputportbytag("PAUSE");break;
718   case 0xb1: data=input_port_read(machine, "PAUSE");break;
719719   case 0xb2:
720720      data=*(memory_region(REGION_USER1)+(suzy.high*lynx_granularity)+suzy.low);
721721      suzy.low=(suzy.low+1)&(lynx_granularity-1);
src/mess/machine/cgenie.c
r2340r2341
235235   /* wipe out font RAM */
236236   memset(&ROM[0x0f400], 0xff, 0x0400);
237237
238   if( readinputport(0) & 0x80 )
238   if( input_port_read_indexed(machine, 0) & 0x80 )
239239   {
240240      logerror("cgenie floppy discs enabled\n");
241241   }
r2340r2341
245245   }
246246
247247   /* 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 )
249249   {
250      if ( readinputport(0) & 0x080 )
250      if ( input_port_read_indexed(machine, 0) & 0x080 )
251251      {
252252         memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK10);
253253         memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
r2340r2341
271271   }
272272
273273   /* 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 )
275275   {
276276      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM);
277277      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM);
r2340r2341
745745   if( port_ff_changed & FF_CAS )   /* casette port changed ? */
746746   {
747747      /* virtual tape ? */
748      if( readinputport(0) & 0x08 )
748      if( input_port_read_indexed(machine, 0) & 0x08 )
749749         tape_put_bit(machine);
750750      else
751751         DAC_data_w(0,(data & FF_CAS) ? 127:0 );
r2340r2341
820820{
821821   /* virtual tape ? */
822822
823   if( readinputport(0) & 0x08 )
823   if( input_port_read_indexed(machine, 0) & 0x08 )
824824      tape_get_bit();
825825
826826   return port_ff;
r2340r2341
853853   {
854854      /* comparator value */
855855      psg_b_inp = 0x00;
856      if( readinputport(9) > psg_a_out )
856      if( input_port_read_indexed(machine, 9) > psg_a_out )
857857         psg_b_inp |= 0x80;
858      if( readinputport(10) > psg_a_out )
858      if( input_port_read_indexed(machine, 10) > psg_a_out )
859859         psg_b_inp |= 0x40;
860      if( readinputport(11) > psg_a_out )
860      if( input_port_read_indexed(machine, 11) > psg_a_out )
861861         psg_b_inp |= 0x20;
862      if( readinputport(12) > psg_a_out )
862      if( input_port_read_indexed(machine, 12) > psg_a_out )
863863         psg_b_inp |= 0x10;
864864   }
865865   else
r2340r2341
867867      /* read keypad matrix */
868868      psg_b_inp = 0xFF;
869869      if( !(psg_a_out & 0x01) )
870         psg_b_inp &= ~(readinputport(13) & 15);
870         psg_b_inp &= ~(input_port_read_indexed(machine, 13) & 15);
871871      if( !(psg_a_out & 0x02) )
872         psg_b_inp &= ~(readinputport(13) / 16);
872         psg_b_inp &= ~(input_port_read_indexed(machine, 13) / 16);
873873      if( !(psg_a_out & 0x04) )
874         psg_b_inp &= ~(readinputport(14) & 15);
874         psg_b_inp &= ~(input_port_read_indexed(machine, 14) & 15);
875875      if( !(psg_a_out & 0x08) )
876         psg_b_inp &= ~(readinputport(14) / 16);
876         psg_b_inp &= ~(input_port_read_indexed(machine, 14) / 16);
877877      if( !(psg_a_out & 0x10) )
878         psg_b_inp &= ~(readinputport(15) & 15);
878         psg_b_inp &= ~(input_port_read_indexed(machine, 15) & 15);
879879      if( !(psg_a_out & 0x20) )
880         psg_b_inp &= ~(readinputport(15) / 16);
880         psg_b_inp &= ~(input_port_read_indexed(machine, 15) / 16);
881881   }
882882   return psg_b_inp;
883883}
r2340r2341
895895 READ8_HANDLER( cgenie_status_r )
896896{
897897   /* If the floppy isn't emulated, return 0 */
898   if( (readinputport(0) & 0x80) == 0 )
898   if( (input_port_read_indexed(machine, 0) & 0x80) == 0 )
899899      return 0;
900900   return wd17xx_status_r(machine, offset);
901901}
r2340r2341
903903 READ8_HANDLER( cgenie_track_r )
904904{
905905   /* If the floppy isn't emulated, return 0xff */
906   if( (readinputport(0) & 0x80) == 0 )
906   if( (input_port_read_indexed(machine, 0) & 0x80) == 0 )
907907      return 0xff;
908908   return wd17xx_track_r(machine, offset);
909909}
r2340r2341
911911 READ8_HANDLER( cgenie_sector_r )
912912{
913913   /* If the floppy isn't emulated, return 0xff */
914   if( (readinputport(0) & 0x80) == 0 )
914   if( (input_port_read_indexed(machine, 0) & 0x80) == 0 )
915915      return 0xff;
916916   return wd17xx_sector_r(machine, offset);
917917}
r2340r2341
919919 READ8_HANDLER(cgenie_data_r )
920920{
921921   /* If the floppy isn't emulated, return 0xff */
922   if( (readinputport(0) & 0x80) == 0 )
922   if( (input_port_read_indexed(machine, 0) & 0x80) == 0 )
923923      return 0xff;
924924   return wd17xx_data_r(machine, offset);
925925}
r2340r2341
927927WRITE8_HANDLER( cgenie_command_w )
928928{
929929   /* If the floppy isn't emulated, return immediately */
930   if( (readinputport(0) & 0x80) == 0 )
930   if( (input_port_read_indexed(machine, 0) & 0x80) == 0 )
931931      return;
932932   wd17xx_command_w(machine, offset, data);
933933}
r2340r2341
935935WRITE8_HANDLER( cgenie_track_w )
936936{
937937   /* 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 )
939939      return;
940940   wd17xx_track_w(machine, offset, data);
941941}
r2340r2341
943943WRITE8_HANDLER( cgenie_sector_w )
944944{
945945   /* 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 )
947947      return;
948948   wd17xx_sector_w(machine, offset, data);
949949}
r2340r2341
951951WRITE8_HANDLER( cgenie_data_w )
952952{
953953   /* 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 )
955955      return;
956956   wd17xx_data_w(machine, offset, data);
957957}
r2340r2341
985985void cgenie_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
986986{
987987   /* 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 ))
989989      return;
990990
991991   switch( event )
r2340r2341
10391039   int result = 0;
10401040
10411041   if( offset & 0x01 )
1042      result |= readinputport(1);
1042      result |= input_port_read_indexed(machine, 1);
10431043   if( offset & 0x02 )
1044      result |= readinputport(2);
1044      result |= input_port_read_indexed(machine, 2);
10451045   if( offset & 0x04 )
1046      result |= readinputport(3);
1046      result |= input_port_read_indexed(machine, 3);
10471047   if( offset & 0x08 )
1048      result |= readinputport(4);
1048      result |= input_port_read_indexed(machine, 4);
10491049   if( offset & 0x10 )
1050      result |= readinputport(5);
1050      result |= input_port_read_indexed(machine, 5);
10511051   if( offset & 0x20 )
1052      result |= readinputport(6);
1052      result |= input_port_read_indexed(machine, 6);
10531053   if( offset & 0x40 )
1054      result |= readinputport(7);
1054      result |= input_port_read_indexed(machine, 7);
10551055   if( offset & 0x80 )
1056      result |= readinputport(8);
1056      result |= input_port_read_indexed(machine, 8);
10571057
10581058   return result;
10591059}
r2340r2341
11291129
11301130INTERRUPT_GEN( cgenie_frame_interrupt )
11311131{
1132   if( cgenie_tv_mode != (readinputport(0) & 0x10) )
1132   if( cgenie_tv_mode != (input_port_read_indexed(machine, 0) & 0x10) )
11331133   {
1134      cgenie_tv_mode = readinputport(0) & 0x10;
1134      cgenie_tv_mode = input_port_read_indexed(machine, 0) & 0x10;
11351135      /* force setting of background color */
11361136      port_ff ^= FF_BGD0;
11371137      cgenie_port_ff_w(machine, 0, port_ff ^ FF_BGD0);
src/mess/machine/aquarius.c
r2340r2341
1818MACHINE_RESET( aquarius )
1919{
2020   logerror("aquarius_init\r\n");
21   if (readinputportbytag("ram") != aquarius_ramsize)
21   if (input_port_read(machine, "ram") != aquarius_ramsize)
2222   {
23      aquarius_ramsize = readinputportbytag("ram");
23      aquarius_ramsize = input_port_read(machine, "ram");
2424      switch (aquarius_ramsize)
2525      {
2626         case 02:
r2340r2341
5757   {
5858      if (!(bc & loop))
5959      {
60// TODO: replace it with readinputportbytag
61         rpl &= readinputport (loop2);
60// TODO: replace it with input_port_read
61         rpl &= input_port_read_indexed (machine, loop2);
6262      }
6363   }
6464
src/mess/machine/pmd85.c
r2340r2341
202202
203203static  READ8_HANDLER ( pmd85_ppi_0_portb_r )
204204{
205   return readinputport(pmd85_ppi_port_outputs[0][0]&0x0f) & readinputport(0x0f);
205   return input_port_read_indexed(machine, pmd85_ppi_port_outputs[0][0]&0x0f) & input_port_read_indexed(machine, 0x0f);
206206}
207207
208208static  READ8_HANDLER ( pmd85_ppi_0_portc_r )
r2340r2341
243243   for (i = 0; i < 8; i++)
244244   {
245245      if (!(pmd85_ppi_port_outputs[0][0] & (1 << i)))
246         data &= readinputport(i);
246         data &= input_port_read_indexed(machine, i);
247247   }
248248   return data;
249249}
250250
251251static  READ8_HANDLER ( mato_ppi_0_portc_r )
252252{
253   return readinputport(0x08) | 0x8f;
253   return input_port_read_indexed(machine, 0x08) | 0x8f;
254254}
255255
256256static WRITE8_HANDLER ( mato_ppi_0_portc_w )
r2340r2341
696696   static int clk_level = 1;
697697   static int clk_level_tape = 1;
698698
699   if (!(readinputport(0x11)&0x02))   /* V.24 / Tape Switch */
699   if (!(input_port_read_indexed(machine, 0x11)&0x02))   /* V.24 / Tape Switch */
700700   {
701701      /* tape reading */
702702      if (cassette_get_state(image_from_devtype_and_index(IO_CASSETTE, 0))&CASSETTE_PLAY)
r2340r2341
759759
760760static OPBASE_HANDLER(pmd85_opbaseoverride)
761761{
762   if (readinputport(0x10)&0x01)
762   if (input_port_read_indexed(machine, 0x10)&0x01)
763763      mame_schedule_soft_reset(machine);
764764   return address;
765765}
766766
767767static OPBASE_HANDLER(mato_opbaseoverride)
768768{
769   if (readinputport(0x09)&0x01)
769   if (input_port_read_indexed(machine, 0x09)&0x01)
770770      mame_schedule_soft_reset(machine);
771771   return address;
772772}
r2340r2341
844844      case PMD85_1:
845845      case PMD85_2A:
846846      case PMD85_3:
847         pmd85_rom_module_present = (readinputport(0x11)&0x01) ? 1 : 0;
847         pmd85_rom_module_present = (input_port_read_indexed(machine, 0x11)&0x01) ? 1 : 0;
848848         break;
849849      case ALFA:
850850      case MATO:
src/mess/machine/spectrum.c
r2340r2341
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "deprecat.h"
2728#include "cpu/z80/z80.h"
2829#include "includes/spectrum.h"
2930#include "eventlst.h"
r2340r2341
156157 *******************************************************************/
157158static int spectrum_setup_tap(offs_t address, UINT8 *snapshot_data, int snapshot_length)
158159{
160   running_machine *machine = Machine;
159161   int i, tap_block_length, load_length;
160162   unsigned char lo, hi, a_reg;
161163   unsigned short load_addr, return_addr, af_reg, de_reg, sp_reg;
r2340r2341
270272   if (TapePosition >= snapshot_length)
271273   {
272274      /* End of tape - either rewind or disable op base override */
273      if (readinputportbytag("CONFIG") & 0x40)
275      if (input_port_read(machine, "CONFIG") & 0x40)
274276      {
275277         if (data_loaded)
276278         {
src/mess/machine/kaypro.c
r2340r2341
167167   }
168168
169169   row = 9;
170   new = readinputport(10);
170   new = input_port_read_indexed(machine, 10);
171171   chg = keyrows[row] ^ new;
172172
173   if (!chg) { new = readinputport(9); chg = keyrows[--row] ^ new; }
174   if (!chg) { new = readinputport(8); chg = keyrows[--row] ^ new; }
175   if (!chg) { new = readinputport(7); chg = keyrows[--row] ^ new; }
176   if (!chg) { new = readinputport(6); chg = keyrows[--row] ^ new; }
177   if (!chg) { new = readinputport(5); chg = keyrows[--row] ^ new; }
178   if (!chg) { new = readinputport(4); chg = keyrows[--row] ^ new; }
179   if (!chg) { new = readinputport(3); chg = keyrows[--row] ^ new; }
180   if (!chg) { new = readinputport(2); chg = keyrows[--row] ^ new; }
181   if (!chg) { new = readinputport(1); chg = keyrows[--row] ^ new; }
173   if (!chg) { new = input_port_read_indexed(machine, 9); chg = keyrows[--row] ^ new; }
174   if (!chg) { new = input_port_read_indexed(machine, 8); chg = keyrows[--row] ^ new; }
175   if (!chg) { new = input_port_read_indexed(machine, 7); chg = keyrows[--row] ^ new; }
176   if (!chg) { new = input_port_read_indexed(machine, 6); chg = keyrows[--row] ^ new; }
177   if (!chg) { new = input_port_read_indexed(machine, 5); chg = keyrows[--row] ^ new; }
178   if (!chg) { new = input_port_read_indexed(machine, 4); chg = keyrows[--row] ^ new; }
179   if (!chg) { new = input_port_read_indexed(machine, 3); chg = keyrows[--row] ^ new; }
180   if (!chg) { new = input_port_read_indexed(machine, 2); chg = keyrows[--row] ^ new; }
181   if (!chg) { new = input_port_read_indexed(machine, 1); chg = keyrows[--row] ^ new; }
182182   if (!chg) --row;
183183
184184   if (row >= 0)
src/mess/machine/geneve.c
r2340r2341
254254   KeyReset = 1;
255255
256256   /* 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;
262262
263263   /* set up optional expansion hardware */
264264   ti99_peb_reset(0, inta_callback, intb_callback);
r2340r2341
10351035
10361036static void poll_keyboard(void)
10371037{
1038   running_machine *machine = Machine;
10381039   UINT32 keystate;
10391040   UINT32 key_transitions;
10401041   int i, j;
r2340r2341
10761077   /* Poll keyboard */
10771078   for (i=0; (i<4) && (KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); i++)
10781079   {
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);
10811082      key_transitions = keystate ^ KeyStateSave[i];
10821083      if (key_transitions)
10831084      {
r2340r2341
12751276   int new_mx, new_my;
12761277   int delta_x, delta_y, buttons;
12771278
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);
12811282
12821283   /* compute x delta */
12831284   delta_x = new_mx - last_mx;
r2340r2341
13581359{
13591360   int answer;
13601361
1361   answer = readinputport(input_port_joysticks_geneve) >> (JoySel * 8);
1362   answer = input_port_read_indexed(Machine, input_port_joysticks_geneve) >> (JoySel * 8);
13621363
13631364   return (answer);
13641365}
r2340r2341
13791380{
13801381   int answer;
13811382
1382   answer = (readinputport(input_port_mouse_buttons_geneve) & 4) ^ 4;
1383   answer = (input_port_read_indexed(Machine, input_port_mouse_buttons_geneve) & 4) ^ 4;
13831384
13841385   return answer;
13851386}
r2340r2341
14001401{
14011402   int answer = 0;
14021403
1403   if (! (readinputport(input_port_mouse_buttons_geneve) & 4))
1404   if (! (input_port_read_indexed(Machine, input_port_mouse_buttons_geneve) & 4))
14041405      answer |= 0x10;
14051406
14061407   return answer;
src/mess/machine/c128.c
r2340r2341
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1314#include "includes/c128.h"
1415#include "includes/c64.h"
1516
src/mess/machine/pc_turbo.c
r2340r2341
2727   struct pc_turbo_info *ti = (struct pc_turbo_info *) ptr;
2828   int val;
2929
30   val = readinputport(ti->port) & ti->mask;
30   val = input_port_read_indexed(machine, ti->port) & ti->mask;
3131
3232   if (val != ti->cur_val)
3333   {
src/mess/machine/lviv.c
r2340r2341
4343
4444static OPBASE_HANDLER(lviv_opbaseoverride)
4545{
46   if (readinputport(12)&0x01)
46   if (input_port_read_indexed(machine, 12)&0x01)
4747      mame_schedule_soft_reset(machine);
4848   return address;
4949}
r2340r2341
6363   UINT8 data = lviv_ppi_port_outputs[0][2] & 0x0f;
6464   if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0.038)
6565      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))
6767      data |= 0x80;
6868   return data;
6969}
r2340r2341
9595
9696static  READ8_HANDLER ( lviv_ppi_1_portb_r )   /* keyboard reading */
9797{
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));
106106}
107107
108108static  READ8_HANDLER ( lviv_ppi_1_portc_r )     /* keyboard reading */
109109{
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));
114114}
115115
116116static WRITE8_HANDLER ( lviv_ppi_1_porta_w )   /* kayboard scaning */
src/mess/machine/ay3600.c
r2340r2341
298298   return !a2_has_repeat(); /* BUG: Doesn't work with Ace */
299299}
300300
301INLINE int a2_no_ctrl_reset(void)
301INLINE int a2_no_ctrl_reset(running_machine *machine)
302302{
303303   return ((a2_has_repeat() && !a2_has_reset_dip()) ||
304         (a2_has_reset_dip() && !readinputportbytag("reset_dip")));
304         (a2_has_reset_dip() && !input_port_read(machine, "reset_dip")));
305305}
306306
307307
r2340r2341
362362
363363   /* only repeat keys on a 2/2+ if special REPT key is pressed */
364364   if (a2_has_repeat())
365      time_until_repeat = readinputportbytag("keyb_repeat") & 0x01 ? 0 : ~0;
365      time_until_repeat = input_port_read(machine, "keyb_repeat") & 0x01 ? 0 : ~0;
366366
367367   /* check caps lock and set LED here */
368368   if (pressed_specialkey(SPECIALKEY_CAPSLOCK))
r2340r2341
424424
425425   /* reset key check */
426426   if (pressed_specialkey(SPECIALKEY_RESET) &&
427      (a2_no_ctrl_reset() || switchkey & A2_KEY_CONTROL)) {
427      (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) {
428428         if (!reset_flag) {
429429            reset_flag = 1;
430430            /* using PULSE_LINE does not allow us to press and hold key */
r2340r2341
446446
447447   for (port = 0; port < num_ports; port++)
448448   {
449      data = readinputport(AY3600_KEYS_BASEPORT + port);
449      data = input_port_read_indexed(machine, AY3600_KEYS_BASEPORT + port);
450450      for (bit = 0; bit < 8; bit++)
451451      {
452452         if (a2_has_capslock()) {
src/mess/machine/pc8801.c
r2340r2341
194194  if((port_save&0x04) == 0x00 && (data&0x04) != 0x00) calender_shift();
195195  port_save=data;
196196
197  if((readinputport(17)&0x40)==0x00) {
197  if((input_port_read_indexed(machine, 17)&0x40)==0x00) {
198198    data&=0x7f;
199199  }
200200  switch(data&0xa0) {
r2340r2341
241241  int r;
242242
243243  /* read DIP-SW */
244  r=readinputport(17)<<1;
244  r=input_port_read_indexed(machine, 17)<<1;
245245  /* change bit 0 according BASIC mode */
246246  if(is_Nbasic) {
247247    r&=0xfe;
r2340r2341
268268  int r;
269269
270270  /* read DIP-SW */
271  r=readinputport(18)<<1;
271  r=input_port_read_indexed(machine, 18)<<1;
272272  /* change bit 6 according speed switch */
273273  if(pc88sr_is_highspeed) {
274274    r|=0x40;
r2340r2341
572572   pc8801_update_bank();
573573   pc8801_video_init(machine, hireso);
574574
575  if(extmem_mode!=readinputport(19)) {
576    extmem_mode=readinputport(19);
575  if(extmem_mode!=input_port_read_indexed(machine, 19)) {
576    extmem_mode=input_port_read_indexed(machine, 19);
577577    if(extRAM!=NULL) {
578578      free(extRAM);
579579      extRAM=NULL;
r2340r2341
695695{
696696  int a;
697697
698  a=readinputport(16);
698  a=input_port_read_indexed(machine, 16);
699699  is_Nbasic = ((a&0x01)==0x00);
700700  is_V2mode = ((a&0x02)==0x00);
701701  pc88sr_is_highspeed = ((a&0x04)!=0x00);
r2340r2341
810810
811811static void pc8801_init_5fd(void)
812812{
813   use_5FD = (readinputport(18)&0x80)!=0x00;
813   use_5FD = (input_port_read_indexed(Machine, 18)&0x80)!=0x00;
814814   ppi8255_init(&pc8801_8255_config);
815815   if (!use_5FD)
816816      cpunum_suspend(1, SUSPEND_REASON_DISABLE, 1);
src/mess/machine/p2000t.c
r2340r2341
4444{
4545   if (p2000t_ports.port_101f & P2000M_101F_KEYINT)
4646   {
47      return (readinputport (0) & readinputport (1) &
48      readinputport (2) & readinputport (3) &
49      readinputport (4) & readinputport (5) &
50      readinputport (6) & readinputport (7) &
51      readinputport (8) & readinputport (9));
47      return (input_port_read_indexed(machine, 0) & input_port_read_indexed(machine, 1) &
48      input_port_read_indexed(machine, 2) & input_port_read_indexed(machine, 3) &
49      input_port_read_indexed(machine, 4) & input_port_read_indexed(machine, 5) &
50      input_port_read_indexed(machine, 6) & input_port_read_indexed(machine, 7) &
51      input_port_read_indexed(machine, 8) & input_port_read_indexed(machine, 9));
5252   }
5353   else if (offset < 10)
5454   {
55      return (readinputport (offset));
55      return (input_port_read_indexed(machine, offset));
5656   }
5757   return (0xff);
5858}
src/mess/machine/pet.c
r2340r2341
7979{
8080   UINT8 data = 0xff;
8181   if ( pet_keyline_select < 10 ) {
82      data = readinputport( pet_keyline_select );
82      data = input_port_read_indexed(machine, pet_keyline_select );
8383      /* Check for left-shift lock */
84      if ( pet_keyline_select == 8 && ( readinputport(10) & 0x80 ) ) {
84      if ( pet_keyline_select == 8 && ( input_port_read_indexed(machine, 10) & 0x80 ) ) {
8585         data &= 0xFE;
8686      }
8787   }
r2340r2341
9393{
9494   UINT8 data = 0xff;
9595   if ( pet_keyline_select < 10 ) {
96      data = readinputport( pet_keyline_select );
96      data = input_port_read_indexed(machine, pet_keyline_select );
9797      /* Check for left-shift lock */
98      if ( pet_keyline_select == 6 && ( readinputport(10) & 0x80 ) ) {
98      if ( pet_keyline_select == 6 && ( input_port_read_indexed(machine, 10) & 0x80 ) ) {
9999         data &= 0xFE;
100100      }
101101   }
r2340r2341
611611      }
612612   }
613613
614   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , readinputport(10) & 0x80 ? 1 : 0);
614   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , input_port_read_indexed(machine, 10) & 0x80 ? 1 : 0);
615615}
src/mess/machine/c16.c
r2340r2341
99***************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1213#include "image.h"
1314#include "cpu/m6502/m6502.h"
1415#include "sound/sid6581.h"
r2340r2341
641642
642643   value = 0xff;
643644
644   value &= ~readinputportbytag( "ROW0" );
645   value &= ~input_port_read(machine, "ROW0" );
645646   keyline[0] = value;
646647
647648   value = 0xff;
648649
649   value &= ~readinputportbytag( "ROW1" );
650   value &= ~input_port_read(machine, "ROW1" );
650651   keyline[1] = value;
651652
652653   value = 0xff;
653654
654   value &= ~readinputportbytag( "ROW2" );
655   value &= ~input_port_read(machine, "ROW2" );
655656   keyline[2] = value;
656657
657658   value = 0xff;
658659
659   value &= ~readinputportbytag( "ROW3" );
660   value &= ~input_port_read(machine, "ROW3" );
660661   keyline[3] = value;
661662
662663   value = 0xff;
663664
664   value &= ~readinputportbytag( "ROW4" );
665   value &= ~input_port_read(machine, "ROW4" );
665666   keyline[4] = value;
666667
667668   value = 0xff;
668669
669   value &= ~readinputportbytag( "ROW5" );
670   value &= ~input_port_read(machine, "ROW5" );
670671   keyline[5] = value;
671672
672673   value = 0xff;
673674
674   value &= ~readinputportbytag( "ROW6" );
675   value &= ~input_port_read(machine, "ROW6" );
675676   keyline[6] = value;
676677
677678   value = 0xff;
678679
679   value &= ~readinputportbytag( "ROW7" );
680   value &= ~input_port_read(machine, "ROW7" );
680681   keyline[7] = value;
681682
682683
r2340r2341
730731
731732   vc20_tape_config (DATASSETTE, DATASSETTE_TONE);
732733   vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP);
733   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , readinputportbytag("Special") & 0x80 ? 1 : 0);
734   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , input_port_read(machine, "Special") & 0x80 ? 1 : 0);
734735   set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0);
735736}
src/mess/machine/oric.c
r2340r2341
7575      /* oric 1 or oric atmos */
7676
7777      /* 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)
7979      {
8080         oric_irqs &=~(1<<1);
8181      }
r2340r2341
121121   /* what if data is 0, can it sense if any of the keys on a line are pressed? */
122122   int input_port_data;
123123
124    input_port_data = readinputport(1+oric_keyboard_line);
124    input_port_data = input_port_read_indexed(Machine, 1+oric_keyboard_line);
125125
126126   /* go through all bits in line */
127127   for (i=0; i<8; i++)
r2340r2341
291291   to the via cb1 input. Interrupts can be generated from the vertical
292292   sync, and flicker free games can be produced */
293293
294   input_port_9 = readinputport(9);
294   input_port_9 = input_port_read_indexed(machine, 9);
295295   /* cable is enabled? */
296296   if ((input_port_9 & 0x08)!=0)
297297   {
r2340r2341
10601060
10611061static void oric_wd179x_callback(running_machine *machine, wd17xx_state_t State, void *param)
10621062{
1063   switch (readinputport(9) &  0x07)
1063   switch (input_port_read_indexed(machine, 9) &  0x07)
10641064   {
10651065      default:
10661066      case ORIC_FLOPPY_INTERFACE_NONE:
r2340r2341
11351135
11361136MACHINE_RESET( oric )
11371137{
1138   int disc_interface_id = readinputportbytag("oric_floppy_interface") & 0x07;
1138   int disc_interface_id = input_port_read(machine, "oric_floppy_interface") & 0x07;
11391139
11401140   switch (disc_interface_id)
11411141   {
r2340r2341
11951195READ8_HANDLER ( oric_IO_r )
11961196{
11971197#if 0
1198   switch (readinputport(9) & 0x07)
1198   switch (input_port_read_indexed(machine, 9) & 0x07)
11991199   {
12001200      default:
12011201      case ORIC_FLOPPY_INTERFACE_NONE:
r2340r2341
12341234WRITE8_HANDLER ( oric_IO_w )
12351235{
12361236#if 0
1237   switch (readinputport(9) & 0x07)
1237   switch (input_port_read_indexed(machine, 9) & 0x07)
12381238   {
12391239      default:
12401240      case ORIC_FLOPPY_INTERFACE_NONE:
r2340r2341
14081408   /* left joystick selected? */
14091409   if (telestrat_via2_port_b_data & (1<<6))
14101410   {
1411      data &= readinputport(10);
1411      data &= input_port_read_indexed(machine, 10);
14121412   }
14131413
14141414   /* right joystick selected? */
14151415   if (telestrat_via2_port_b_data & (1<<7))
14161416   {
1417      data &= readinputport(11);
1417      data &= input_port_read_indexed(machine, 11);
14181418   }
14191419
14201420   data |= telestrat_via2_port_b_data & ((1<<7) | (1<<6) | (1<<5));
src/mess/machine/mc10.c
r2340r2341
6969
7070   int val = 0x40;
7171
72   if ((readinputport(0) | mc10_keyboard_strobe) == 0xff)
72   if ((input_port_read_indexed(machine, 0) | mc10_keyboard_strobe) == 0xff)
7373      val |= 0x01;
74   if ((readinputport(1) | mc10_keyboard_strobe) == 0xff)
74   if ((input_port_read_indexed(machine, 1) | mc10_keyboard_strobe) == 0xff)
7575      val |= 0x02;
76   if ((readinputport(2) | mc10_keyboard_strobe) == 0xff)
76   if ((input_port_read_indexed(machine, 2) | mc10_keyboard_strobe) == 0xff)
7777      val |= 0x04;
78   if ((readinputport(3) | mc10_keyboard_strobe) == 0xff)
78   if ((input_port_read_indexed(machine, 3) | mc10_keyboard_strobe) == 0xff)
7979      val |= 0x08;
80   if ((readinputport(4) | mc10_keyboard_strobe) == 0xff)
80   if ((input_port_read_indexed(machine, 4) | mc10_keyboard_strobe) == 0xff)
8181      val |= 0x10;
82   if ((readinputport(5) | mc10_keyboard_strobe) == 0xff)
82   if ((input_port_read_indexed(machine, 5) | mc10_keyboard_strobe) == 0xff)
8383      val |= 0x20;
8484
8585   return val;
r2340r2341
138138   const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
139139   int val = 0xed;
140140
141   if ((readinputport(6) | mc10_keyboard_strobe) == 0xff)
141   if ((input_port_read_indexed(machine, 6) | mc10_keyboard_strobe) == 0xff)
142142      val |= 0x02;
143143
144144   if (cassette_input(img) >= 0)
src/mess/machine/atom.c
r2340r2341
358358 READ8_HANDLER ( atom_8255_portb_r )
359359{
360360   /* ilogerror("8255: Read port b: %02X %02X\n",
361         readinputport ((atom_8255.atom_8255_porta & 0x0f) + 1),
362         readinputport (11) & 0xc0); */
363// TODO: convert to readinputportbytag
364   return ((readinputport ((atom_8255_porta & 0x0f) + 1) & 0x3f) |
365                                 (readinputport (11) & 0xc0));
361         input_port_read_indexed(machine, (atom_8255.atom_8255_porta & 0x0f) + 1),
362         input_port_read_indexed(machine, 11) & 0xc0); */
363// TODO: convert to input_port_read
364   return ((input_port_read_indexed(machine, (atom_8255_porta & 0x0f) + 1) & 0x3f) |
365                                 (input_port_read_indexed (machine, 11) & 0xc0));
366366}
367367
368368READ8_HANDLER ( atom_8255_portc_r )
r2340r2341
382382   }
383383
384384   atom_8255_portc |= (m6847_get_field_sync() ? 0x00 : 0x80);
385   atom_8255_portc |= (readinputportbytag("keyboard_12") & 0x40);
385   atom_8255_portc |= (input_port_read(machine, "keyboard_12") & 0x40);
386386   /* logerror("8255: Read port c (%02X)\n",atom_8255.atom_8255_portc); */
387387   return (atom_8255_portc);
388388}
src/mess/machine/orao.c
r2340r2341
3434   
3535    switch(offset) {
3636       /* 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;
5757       /* Tape */
5858       case 0x07FF : level = cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0));                                               
5959                            if (level <  0) {
src/mess/machine/coleco.c
r2340r2341
4040      {
4141         int inport0,inport1,inport6,data;
4242
43         inport0 = readinputport(0);
44         inport1 = readinputport(1);
45         inport6 = readinputport(6);
43         inport0 = input_port_read_indexed(machine, 0);
44         inport1 = input_port_read_indexed(machine, 1);
45         inport6 = input_port_read_indexed(machine, 6);
4646
4747         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
4848         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r2340r2341
6969      /* Joystick and fire 2 (SAC Red Button) */
7070      else
7171      {
72         int data = readinputport(2) & 0xCF;
73         int inport6 = readinputport(6);
72         int data = input_port_read_indexed(machine, 2) & 0xCF;
73         int inport6 = input_port_read_indexed(machine, 6);
7474
7575         if (inport6&0x07) /* If Extra Contollers enabled */
7676         {
r2340r2341
8888      {
8989         int inport3,inport4,data;
9090
91         inport3 = readinputport(3);
92         inport4 = readinputport(4);
91         inport3 = input_port_read_indexed(machine, 3);
92         inport4 = input_port_read_indexed(machine, 4);
9393
9494         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
9595         than one, a real ColecoVision think that it is a third button, so we are going to emulate
r2340r2341
114114      /* Joystick and fire 2*/
115115      else
116116      {
117         int data = readinputport(5) & 0xCF;
118         int inport6 = readinputport(6);
117         int data = input_port_read_indexed(machine, 5) & 0xCF;
118         int inport6 = input_port_read_indexed(machine, 6);
119119
120120         if (inport6&0x02) /* If Roller Controller enabled */
121121         {
src/mess/machine/galeb.c
r2340r2341
2323
2424READ8_HANDLER( galeb_keyboard_r )
2525{
26    return readinputport(offset);
26    return input_port_read_indexed(machine, offset);
2727}
2828
2929WRITE8_HANDLER( galeb_speaker_w )
src/mess/machine/pc1403.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/sc61860/sc61860.h"
34
45#include "includes/pocketc.h"
r2340r2341
5960int pc1403_ina(void)
6061{
6162    UINT8 data=outa;
63   running_machine *machine = Machine;
6264
6365    if (asic[3]&1) {
6466   if (KEY_7) data|=1;
r2340r2341
193195
194196int pc1403_brk(void)
195197{
198   running_machine *machine = Machine;
196199   return KEY_BRK;
197200}
198201
199202int pc1403_reset(void)
200203{
204   running_machine *machine = Machine;
201205   return KEY_RESET;
202206}
203207
src/mess/machine/vc20.c
r2340r2341
6464
6565static  READ8_HANDLER( vc20_via0_read_ca1 )
6666{
67   return ! ( readinputportbytag( TAG_KEYBOARD_EXTRA ) & 0x02 );
67   return ! ( input_port_read(machine, TAG_KEYBOARD_EXTRA ) & 0x02 );
6868}
6969
7070static  READ8_HANDLER( vc20_via0_read_ca2 )
r2340r2341
713713INTERRUPT_GEN( vc20_frame_interrupt )
714714{
715715   via_0_ca1_w(machine, 0, vc20_via0_read_ca1 (machine, 0));
716   keyboard[0] = readinputportbytag( TAG_KEYBOARD_ROW0 );
717   keyboard[1] = readinputportbytag( TAG_KEYBOARD_ROW1 );
718   keyboard[2] = readinputportbytag( TAG_KEYBOARD_ROW2 );
719   keyboard[3] = readinputportbytag( TAG_KEYBOARD_ROW3 );
720   keyboard[4] = readinputportbytag( TAG_KEYBOARD_ROW4 );
721   keyboard[5] = readinputportbytag( TAG_KEYBOARD_ROW5 );
722   keyboard[6] = readinputportbytag( TAG_KEYBOARD_ROW6 );
723   keyboard[7] = readinputportbytag( TAG_KEYBOARD_ROW7 );
716   keyboard[0] = input_port_read(machine,  TAG_KEYBOARD_ROW0 );
717   keyboard[1] = input_port_read(machine,  TAG_KEYBOARD_ROW1 );
718   keyboard[2] = input_port_read(machine,  TAG_KEYBOARD_ROW2 );
719   keyboard[3] = input_port_read(machine,  TAG_KEYBOARD_ROW3 );
720   keyboard[4] = input_port_read(machine,  TAG_KEYBOARD_ROW4 );
721   keyboard[5] = input_port_read(machine,  TAG_KEYBOARD_ROW5 );
722   keyboard[6] = input_port_read(machine,  TAG_KEYBOARD_ROW6 );
723   keyboard[7] = input_port_read(machine,  TAG_KEYBOARD_ROW7 );
724724
725725   vc20_tape_config (DATASSETTE, DATASSETTE_TONE);
726726   vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP);
727   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , ( readinputportbytag( TAG_KEYBOARD_EXTRA ) & 0x01 ) ? 1 : 0);
727   set_led_status (1 /*KB_CAPSLOCK_FLAG */ , ( input_port_read(machine, TAG_KEYBOARD_EXTRA ) & 0x01 ) ? 1 : 0);
728728}
src/mess/machine/electron.c
r2340r2341
100100   //logerror( "PC=%04x: keyboard read from paged rom area, address: %04x", activecpu_get_pc(), offset );
101101   for( i = 0; i < 14; i++ ) {
102102      if ( ! ( offset & 1 ) ) {
103         data |= readinputport(i) & 0x0f;
103         data |= input_port_read_indexed(machine, i) & 0x0f;
104104      }
105105      offset = offset >> 1;
106106   }
src/mess/machine/pc_hdc.c
r2340r2341
1919#include <stdio.h>
2020
2121#include "driver.h"
22#include "deprecat.h"
2223#include "machine/pc_hdc.h"
2324#include "machine/pic8259.h"
2425#include "machine/8237dma.h"
r2340r2341
719720static UINT8 pc_HDC_r(int chip, offs_t offs)
720721{
721722   UINT8 data = 0xff;
722   if( !(readinputport(3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
723   if( !(input_port_read_indexed(Machine, 3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
723724      return data;
724725   switch( offs )
725726   {
r2340r2341
742743   if (LOG_HDC_CALL)
743744      logerror("pc_HDC_w(): chip=%d offs=%d data=0x%02x\n", chip, offs, data);
744745
745   if( !(readinputport(3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
746   if( !(input_port_read_indexed(Machine, 3) & (0x08>>chip)) || !pc_hdc_file(chip<<1) )
746747      return;
747748
748749   switch( offs )
src/mess/machine/apple1.c
r2340r2341
298298   /* First we check the RESET and CLEAR SCREEN pushbutton switches. */
299299
300300   /* The RESET switch resets the CPU and the 6820 PIA. */
301   if (readinputport(5) & 0x0001)
301   if (input_port_read_indexed(machine, 5) & 0x0001)
302302   {
303303      if (!reset_flag) {
304304         reset_flag = 1;
r2340r2341
314314   }
315315
316316   /* The CLEAR SCREEN switch clears the video hardware. */
317   if (readinputport(5) & 0x0002)
317   if (input_port_read_indexed(machine, 5) & 0x0002)
318318   {
319319      if (!apple1_vh_clrscrn_pressed)
320320      {
r2340r2341
339339   /* The keyboard strobe line should always be low when a scan starts. */
340340   pia_set_input_ca1(0, 0);
341341
342   shiftkeys = readinputport(4) & 0x0003;
343   ctrlkeys = readinputport(4) & 0x000c;
342   shiftkeys = input_port_read_indexed(machine, 4) & 0x0003;
343   ctrlkeys = input_port_read_indexed(machine, 4) & 0x000c;
344344
345345   for (port = 0; port < 4; port++)
346346   {
347      UINT32 portval = readinputport(port);
347      UINT32 portval = input_port_read_indexed(machine, port);
348348      UINT32 newkeys = portval & ~(kbd_last_scan[port]);
349349
350350      if (newkeys)
src/mess/machine/orion.c
r2340r2341
3535READ8_HANDLER (orion_romdisk_porta_r )
3636{
3737   UINT8 *romdisk = memory_region(REGION_CPU1) + 0x10000;     
38   switch(readinputport(9)) {
38   switch(input_port_read_indexed(machine, 9)) {
3939     case 3 : return romdisk[romdisk_msb*256+romdisk_lsb];   
4040     case 1 : return romdisk[romdisk_msb*256+romdisk_lsb+0x10000];           
4141   }
r2340r2341
5454
5555READ8_HANDLER (orion_keyboard_portb_r )
5656{     
57   return readinputport(orion_keyboard_line);
57   return input_port_read_indexed(machine, orion_keyboard_line);
5858}
5959
6060READ8_HANDLER (orion_keyboard_portc_r )
6161{
62   return readinputport(8);     
62   return input_port_read_indexed(machine, 8);     
6363}
6464
6565WRITE8_HANDLER (orion_keyboard_porta_w )
src/mess/machine/ibmpc.c
r2340r2341
122122       *      01 - color 40x25
123123       * 6-7  The number of floppy disk drives
124124       */
125      data = readinputport(1);
125      data = input_port_read_indexed(machine, 1);
126126   }
127127   else
128128   {
r2340r2341
152152   if (pc_ppi.portc_switch_high)
153153   {
154154      /* read hi nibble of S2 */
155      data = (data&0xf0)|((readinputport(1) >> 4) & 0x0f);
155      data = (data&0xf0)|((input_port_read_indexed(machine, 1) >> 4) & 0x0f);
156156      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
157157   }
158158   else
159159   {
160160      /* read lo nibble of S2 */
161      data = (data&0xf0)|(readinputport(1) & 0x0f);
161      data = (data&0xf0)|(input_port_read_indexed(machine, 1) & 0x0f);
162162      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
163163   }
164164
src/mess/machine/a7800.c
r2340r2341
5050
5151/****** RIOT ****************************************/
5252
53/* TODO: Convert the definitions into a syntax accepting readinputportbytag */
53/* TODO: Convert the definitions into a syntax accepting input_port_read */
5454
5555static const struct riot6532_interface r6532_interface =
5656{
r2340r2341
347347   switch(offset)
348348   {
349349      case 0x08:
350           return((readinputportbytag("buttons") & 0x02) << 6);
350           return((input_port_read(machine, "buttons") & 0x02) << 6);
351351      case 0x09:
352           return((readinputportbytag("buttons") & 0x08) << 4);
352           return((input_port_read(machine, "buttons") & 0x08) << 4);
353353      case 0x0A:
354           return((readinputportbytag("buttons") & 0x01) << 7);
354           return((input_port_read(machine, "buttons") & 0x01) << 7);
355355      case 0x0B:
356           return((readinputportbytag("buttons") & 0x04) << 5);
356           return((input_port_read(machine, "buttons") & 0x04) << 5);
357357      case 0x0c:
358         if((readinputportbytag("buttons") & 0x08) ||(readinputportbytag("buttons") & 0x02))
358         if((input_port_read(machine, "buttons") & 0x08) ||(input_port_read(machine, "buttons") & 0x02))
359359            return 0x00;
360360         else
361361            return 0x80;
362362      case 0x0d:
363         if((readinputportbytag("buttons") & 0x01) ||(readinputportbytag("buttons") & 0x04))
363         if((input_port_read(machine, "buttons") & 0x01) ||(input_port_read(machine, "buttons") & 0x04))
364364            return 0x00;
365365         else
366366            return 0x80;
src/mess/machine/nascom1.c
r2340r2341
150150READ8_HANDLER ( nascom1_port_00_r )
151151{
152152   if (nascom1_portstat.stat_count < 9)
153      return (readinputport (nascom1_portstat.stat_count) | ~0x7f);
153      return (input_port_read_indexed(machine, nascom1_portstat.stat_count) | ~0x7f);
154154
155155   return (0xff);
156156}
src/mess/machine/mtx.c
r2340r2341
174174{
175175   UINT8 data = 0xff;
176176
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");
185185
186186   return data;
187187}
188188
189189READ8_HANDLER( mtx_key_hi_r )
190190{
191   UINT8 data = readinputportbytag("country_code");
191   UINT8 data = input_port_read(machine, "country_code");
192192
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");
201201
202202   return data;
203203}
src/mess/machine/microtan.c
r2340r2341
153153 **************************************************************/
154154static  READ8_HANDLER (via_0_in_a )
155155{
156    int data = readinputport(10);
156    int data = input_port_read_indexed(machine, 10);
157157    LOG(("microtan_via_0_in_a %02X\n", data));
158158    return data;
159159}
r2340r2341
604604    }
605605
606606    row = 9;
607    new = readinputport(row);
607    new = input_port_read_indexed(machine, row);
608608    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; }
617617    if (!chg) --row;
618618
619619    if (row >= 0)
r2340r2341
881881        dst += 4;
882882    }
883883
884    switch (readinputport(0) & 3)
884    switch (input_port_read_indexed(machine, 0) & 3)
885885    {
886886        case 0:  // 1K only :)
887887            memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0400, 0xbbff, 0, 0, SMH_NOP);
r2340r2341
906906    int i;
907907
908908    for (i = 1; i < 10;  i++)
909        keyrows[i] = readinputport(1+i);
909        keyrows[i] = input_port_read_indexed(machine, 1+i);
910910    set_led_status(1, (keyrows[3] & 0x80) ? 0 : 1);
911911
912912    via_config(0, &via6522[0]);
src/mess/machine/intv.c
r2340r2341
5353      switch (offset)
5454      {
5555         case 0x000:
56            rv = readinputport(10) & 0x80;
56            rv = input_port_read_indexed(machine, 10) & 0x80;
5757            logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset);
5858            break;
5959         case 0x001:
60            rv = (readinputport(10) & 0x40) << 1;
60            rv = (input_port_read_indexed(machine, 10) & 0x40) << 1;
6161            logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset);
6262            break;
6363         case 0x002:
64            rv = (readinputport(10) & 0x20) << 2;
64            rv = (input_port_read_indexed(machine, 10) & 0x20) << 2;
6565            logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset);
6666            break;
6767         case 0x003:
68            rv = (readinputport(10) & 0x10) << 3;
68            rv = (input_port_read_indexed(machine, 10) & 0x10) << 3;
6969            logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset);
7070            break;
7171         case 0x004:
72            rv = (readinputport(10) & 0x08) << 4;
72            rv = (input_port_read_indexed(machine, 10) & 0x08) << 4;
7373            logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset);
7474            break;
7575         case 0x005:
76            rv = (readinputport(10) & 0x04) << 5;
76            rv = (input_port_read_indexed(machine, 10) & 0x04) << 5;
7777            logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset);
7878            break;
7979         case 0x006:
r2340r2341
9393         case 0x060:   /* Keyboard Read */
9494            rv = 0xff;
9595            if (intvkbd_keyboard_col == 0)
96               rv = readinputport(0);
96               rv = input_port_read_indexed(machine, 0);
9797            if (intvkbd_keyboard_col == 1)
98               rv = readinputport(1);
98               rv = input_port_read_indexed(machine, 1);
9999            if (intvkbd_keyboard_col == 2)
100               rv = readinputport(2);
100               rv = input_port_read_indexed(machine, 2);
101101            if (intvkbd_keyboard_col == 3)
102               rv = readinputport(3);
102               rv = input_port_read_indexed(machine, 3);
103103            if (intvkbd_keyboard_col == 4)
104               rv = readinputport(4);
104               rv = input_port_read_indexed(machine, 4);
105105            if (intvkbd_keyboard_col == 5)
106               rv = readinputport(5);
106               rv = input_port_read_indexed(machine, 5);
107107            if (intvkbd_keyboard_col == 6)
108               rv = readinputport(6);
108               rv = input_port_read_indexed(machine, 6);
109109            if (intvkbd_keyboard_col == 7)
110               rv = readinputport(7);
110               rv = input_port_read_indexed(machine, 7);
111111            if (intvkbd_keyboard_col == 8)
112               rv = readinputport(8);
112               rv = input_port_read_indexed(machine, 8);
113113            if (intvkbd_keyboard_col == 9)
114               rv = readinputport(9);
114               rv = input_port_read_indexed(machine, 9);
115115            break;
116116         case 0x80:
117117            rv = 0x00;
r2340r2341
458458      switch(byte)
459459      {
460460         case 0:
461            value = readinputport(0);
461            value = input_port_read_indexed(machine, 0);
462462            break;
463463         case 1:
464            value = readinputport(1);
464            value = input_port_read_indexed(machine, 1);
465465            break;
466466         case 2:
467            value = readinputport(2);
467            value = input_port_read_indexed(machine, 2);
468468            break;
469469      }
470470      for(bit=7; bit>=0; bit--)
src/mess/machine/special.c
r2340r2341
3636
3737READ8_HANDLER (specialist_8255_porta_r )
3838{
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;   
4747   return 0xff;
4848}
4949
r2340r2341
5353   int dat = 0;
5454   double level;   
5555   
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);
6868     
6969   dat = (dat  << 2) ^0xff;   
70   if (readinputport(12)!=0xff) dat ^= 0x02;
70   if (input_port_read_indexed(machine, 12)!=0xff) dat ^= 0x02;
7171     
7272   level = cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0));                                               
7373   if (level >=  0) {
r2340r2341
7878
7979READ8_HANDLER (specialist_8255_portc_r )
8080{
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;
8585   return 0x0f;
8686}
8787
src/mess/machine/jupiter.c
r2340r2341
9090   logerror("jupiter_init\r\n");
9191   logerror("data: %p\n", jupiter_data);
9292
93   if (readinputport(8) != jupiter_ramsize)
93   if (input_port_read_indexed(machine, 8) != jupiter_ramsize)
9494   {
95      jupiter_ramsize = readinputport(8);
95      jupiter_ramsize = input_port_read_indexed(machine, 8);
9696      switch (jupiter_ramsize)
9797      {
9898         case 03:
r2340r2341
274274
275275 READ8_HANDLER ( jupiter_port_fefe_r )
276276{
277   return (readinputport (0));
277   return (input_port_read_indexed(machine, 0));
278278}
279279
280280 READ8_HANDLER ( jupiter_port_fdfe_r )
281281{
282   return (readinputport (1));
282   return (input_port_read_indexed(machine, 1));
283283}
284284
285285 READ8_HANDLER ( jupiter_port_fbfe_r )
286286{
287   return (readinputport (2));
287   return (input_port_read_indexed(machine, 2));
288288}
289289
290290 READ8_HANDLER ( jupiter_port_f7fe_r )
291291{
292   return (readinputport (3));
292   return (input_port_read_indexed(machine, 3));
293293}
294294
295295 READ8_HANDLER ( jupiter_port_effe_r )
296296{
297   return (readinputport (4));
297   return (input_port_read_indexed(machine, 4));
298298}
299299
300300 READ8_HANDLER ( jupiter_port_dffe_r )
301301{
302   return (readinputport (5));
302   return (input_port_read_indexed(machine, 5));
303303}
304304
305305 READ8_HANDLER ( jupiter_port_bffe_r )
306306{
307   return (readinputport (6));
307   return (input_port_read_indexed(machine, 6));
308308}
309309
310310 READ8_HANDLER ( jupiter_port_7ffe_r )
311311{
312312   speaker_level_w(0,0);
313   return (readinputport (7));
313   return (input_port_read_indexed(machine, 7));
314314}
315315
316316WRITE8_HANDLER ( jupiter_port_fe_w )
src/mess/machine/osborne1.c
r2340r2341
8888         break;
8989      case 0x200:   /* Keyboard */
9090         /* Row 0 */
91         if ( offset & 0x01 )   data &= readinputport(0);
91         if ( offset & 0x01 )   data &= input_port_read_indexed(machine, 0);
9292         /* Row 1 */
93         if ( offset & 0x02 )   data &= readinputport(1);
93         if ( offset & 0x02 )   data &= input_port_read_indexed(machine, 1);
9494         /* Row 2 */
95         if ( offset & 0x04 )   data &= readinputport(3);
95         if ( offset & 0x04 )   data &= input_port_read_indexed(machine, 3);
9696         /* Row 3 */
97         if ( offset & 0x08 )   data &= readinputport(4);
97         if ( offset & 0x08 )   data &= input_port_read_indexed(machine, 4);
9898         /* Row 4 */
99         if ( offset & 0x10 )   data &= readinputport(5);
99         if ( offset & 0x10 )   data &= input_port_read_indexed(machine, 5);
100100         /* Row 5 */
101         if ( offset & 0x20 )   data &= readinputport(2);
101         if ( offset & 0x20 )   data &= input_port_read_indexed(machine, 2);
102102         /* Row 6 */
103         if ( offset & 0x40 )   data &= readinputport(6);
103         if ( offset & 0x40 )   data &= input_port_read_indexed(machine, 6);
104104         /* Row 7 */
105         if ( offset & 0x80 )   data &= readinputport(7);
105         if ( offset & 0x80 )   data &= input_port_read_indexed(machine, 7);
106106         break;
107107      case 0x900:   /* IEEE488 PIA */
108108         data = pia_0_r( machine, offset & 0x03 );
src/mess/machine/mikro80.c
r2340r2341
2626
2727READ8_HANDLER (mikro80_8255_portb_r )
2828{   
29   return readinputport(mikro80_keyboard_line);
29   return input_port_read_indexed(machine, mikro80_keyboard_line);
3030}
3131
3232READ8_HANDLER (mikro80_8255_portc_r )
3333{
34   return readinputport(8);   
34   return input_port_read_indexed(machine, 8);   
3535}
3636
3737WRITE8_HANDLER (mikro80_8255_porta_w )
src/mess/machine/vtech1.c
r2340r2341
472472    int data = 0xff;
473473
474474   if (!(offset & 1))
475      data &= readinputportbytag("joystick_0");
475      data &= input_port_read(machine, "joystick_0");
476476   if (!(offset & 2))
477      data &= readinputportbytag("joystick_0_arm");
477      data &= input_port_read(machine, "joystick_0_arm");
478478   if (!(offset & 4))
479      data &= readinputportbytag("joystick_1");
479      data &= input_port_read(machine, "joystick_1");
480480   if (!(offset & 8))
481      data &= readinputportbytag("joystick_1_arm");
481      data &= input_port_read(machine, "joystick_1_arm");
482482
483483    return data;
484484}
r2340r2341
494494   for (row = 0; row < 8; row++) {
495495      sprintf(portname, "keyboard_%d", row);
496496      if (!(offset & (1 << row)))
497         data &= readinputportbytag(portname);
497         data &= input_port_read(machine, portname);
498498   }
499499
500500   if (video_screen_get_vblank(machine->primary_screen))
src/mess/machine/sms.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "image.h"
34#include "includes/sms.h"
45#include "video/smsvdp.h"
r2340r2341
7677static WRITE8_HANDLER( sms_input_write ) {
7778   switch( offset ) {
7879   case 0:
79      switch( readinputport(11) & 0x0F ) {
80      switch( input_port_read_indexed(machine, 11) & 0x0F ) {
8081      case 0x03:   /* Sports Pad */
8182         if ( data != sports_pad_last_data_1 ) {
8283            UINT32 cpu_cycles = activecpu_gettotalcycles();
r2340r2341
8485            sports_pad_last_data_1 = data;
8586            if ( cpu_cycles - last_sports_pad_time_1 > 512 ) {
8687               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);
8990            }
9091            last_sports_pad_time_1 = cpu_cycles;
9192            sports_pad_state_1 = ( sports_pad_state_1 + 1 ) & 3;
r2340r2341
9495      }
9596      break;
9697   case 1:
97      switch( readinputport(11) >> 4 ) {
98      switch( input_port_read_indexed(machine, 11) >> 4 ) {
9899      case 0x03:   /* Sports Pad */
99100         if ( data != sports_pad_last_data_2 ) {
100101            UINT32 cpu_cycles = activecpu_gettotalcycles();
r2340r2341
102103            sports_pad_last_data_2 = data;
103104            if ( cpu_cycles - last_sports_pad_time_2 > 2048 ) {
104105               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);
107108            }
108109            last_sports_pad_time_2 = cpu_cycles;
109110            sports_pad_state_2 = ( sports_pad_state_2 + 1 ) & 3;
r2340r2341
127128   }
128129
129130   /* Player 1 */
130   switch( readinputport(11) & 0x0F ) {
131   switch( input_port_read_indexed(Machine, 11) & 0x0F ) {
131132   case 0x00:  /* Joystick */
132      data = readinputport(0);
133      data = input_port_read_indexed(Machine, 0);
133134      /* Rapid Fire setting for Button A */
134      if ( readinputport(7) & 0x01 ) {
135      if ( input_port_read_indexed(Machine, 7) & 0x01 ) {
135136         data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 );
136137      }
137138      /* Check Rapid Fire setting for Button B */
138      if ( readinputport(7) & 0x02 ) {
139      if ( input_port_read_indexed(Machine, 7) & 0x02 ) {
139140         data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 );
140141      }
141142      sms_input_port0 = ( sms_input_port0 & 0xC0 ) | ( data & 0x3F );
r2340r2341
144145      break;
145146   case 0x02:  /* Paddle Control */
146147      /* Get button A state */
147      data = readinputport(8);
148      data = input_port_read_indexed(Machine, 8);
148149      if ( paddle_read_state ) {
149150         data = data >> 4;
150151      }
151152      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 );
153154      break;
154155   case 0x03:   /* Sega Sports Pad */
155156      switch( sports_pad_state_1 ) {
r2340r2341
166167         data = sports_pad_1_y & 0x0F;
167168         break;
168169      }
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 );
170171      break;
171172   }
172173
173174   /* Player 2 */
174   switch( readinputport(11) >> 4 ) {
175   switch( input_port_read_indexed(Machine, 11) >> 4 ) {
175176   case 0x00:   /* Joystick */
176      data = readinputport(0);
177      data = input_port_read_indexed(Machine, 0);
177178      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 ) {
180181         data = ( data & 0xFB ) | ( rapid_fire_state_2 & 0x04 );
181182      }
182      if ( readinputport(7) & 0x08 ) {
183      if ( input_port_read_indexed(Machine, 7) & 0x08 ) {
183184         data = ( data & 0xF7 ) | ( rapid_fire_state_2 & 0x08 );
184185      }
185186      sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data & 0x0F );
r2340r2341
188189      break;
189190   case 0x02:   /* Paddle Control */
190191      /* Get button A state */
191      data = readinputport(9);
192      data = input_port_read_indexed(Machine, 9);
192193      if ( paddle_read_state ) {
193194         data = data >> 4;
194195      }
195196      sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 );
196197      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 );
198199      break;
199200   case 0x03:   /* Sega Sports Pad */
200201      switch( sports_pad_state_2 ) {
r2340r2341
211212         break;
212213      }
213214      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 );
215216      break;
216217   }
217218}
r2340r2341
280281
281282void sms_check_pause_button( running_machine *machine ) {
282283   if ( ! IS_GAMEGEAR ) {
283      if ( ! (readinputport(2) & 0x80) ) {
284      if ( ! (input_port_read_indexed(machine, 2) & 0x80) ) {
284285         if ( ! smsPaused ) {
285286            cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE );
286287            cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE );
r2340r2341
315316}
316317
317318 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));
320321}
321322
322323 READ8_HANDLER(sms_mapper_r)
src/mess/machine/ut88.c
r2340r2341
2828READ8_HANDLER (ut88_8255_portb_r )
2929{
3030   switch (ut88_8255_porta ^ 0xff) {
31        case 0x01 : return readinputport(0);break;
32        case 0x02 : return readinputport(1);break;
33        case 0x04 : return readinputport(2);break;
34        case 0x08 : return readinputport(3);break;
35        case 0x10 : return readinputport(4);break;
36        case 0x20 : return readinputport(5);break;
37        case 0x40 : return readinputport(6);break;
38        case 0x80 : return readinputport(7);break;
31        case 0x01 : return input_port_read_indexed(machine, 0);break;
32        case 0x02 : return input_port_read_indexed(machine, 1);break;
33        case 0x04 : return input_port_read_indexed(machine, 2);break;
34        case 0x08 : return input_port_read_indexed(machine, 3);break;
35        case 0x10 : return input_port_read_indexed(machine, 4);break;
36        case 0x20 : return input_port_read_indexed(machine, 5);break;
37        case 0x40 : return input_port_read_indexed(machine, 6);break;
38        case 0x80 : return input_port_read_indexed(machine, 7);break;
3939   }   
4040   return 0xff;
4141}
4242
4343READ8_HANDLER (ut88_8255_portc_r )
4444{
45   return readinputport(8);   
45   return input_port_read_indexed(machine, 8);   
4646}
4747
4848WRITE8_HANDLER (ut88_8255_porta_w )
r2340r2341
104104
105105READ8_HANDLER( ut88mini_keyboard_r )
106106{
107   return readinputport(0);   
107   return input_port_read_indexed(machine, 0);   
108108}
109109
110110static int lcd_digit[6];
src/mess/machine/pc_mouse.c
r2340r2341
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "machine/uart8250.h"
1112#include "includes/pc_mouse.h"
1213
r2340r2341
6263   /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */
6364   if (pc_mouse.head==pc_mouse.tail)
6465   {
65      nx = readinputportbytag("pc_mouse_x");
66      nx = input_port_read(machine, "pc_mouse_x");
6667
6768      dx = nx - ox;
6869      if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */
6970      if (dx>=0x800) dx = nx - 0x1000 - ox;
7071      ox = nx;
7172
72      ny = readinputportbytag("pc_mouse_y");
73      ny = input_port_read(machine, "pc_mouse_y");
7374
7475      dy = ny - oy;
7576      if (dy<=-0x800) dy = ny + 0x1000 - oy;
7677      if (dy>=0x800) dy = ny - 0x1000 - oy;
7778      oy = ny;
7879
79      nb = readinputportbytag("pc_mouse_misc");
80      nb = input_port_read(machine, "pc_mouse_misc");
8081      if ((nb & 0x80) != 0)
8182      {
8283         pc_mouse.protocol=TYPE_MOUSE_SYSTEMS;
r2340r2341
219220         /* reset mouse */
220221         pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0;
221222
222         if ((readinputportbytag("pc_mouse_misc") & 0x80) == 0 )
223         if ((input_port_read(Machine, "pc_mouse_misc") & 0x80) == 0 )
223224         {
224225            /* Identify as Microsoft 3 Button Mouse */
225226            pc_mouse.queue[pc_mouse.head] = 'M';
src/mess/machine/coupe.c
r2340r2341
124124    coupe_regs.line_int = 0xff;  /* line interrupts disabled */
125125    coupe_regs.status = 0x1f;    /* no interrupts active */
126126
127   if (readinputportbytag("config") & 0x01)
127   if (input_port_read(machine, "config") & 0x01)
128128   {
129129      /* install RTC */
130130      memory_install_readwrite8_handler(0, ADDRESS_SPACE_IO, 0xef, 0xef, 0xffff, 0xff00, coupe_rtc_r, coupe_rtc_w);
src/mess/machine/cybiko.c
r2340r2341
422422   // A11
423423   if (!(offset & (1 << 11))) data &= 0xFE;
424424   // A1 .. A9
425   for (i=1;i<10;i++) if (!(offset & (1 << i))) data &= readinputport( i - 1);
425   for (i=1;i<10;i++) if (!(offset & (1 << i))) data &= input_port_read_indexed(machine, i - 1);
426426   // A0
427427   if (!(offset & (1 <<  0))) data |= 0xFF;
428428   //
r2340r2341
448448      // keyboard
449449      case H8S_IO_PORT1 :
450450      {
451         //if (readinputport(0) & 0x02) data = data | 0x08; else data = data & (~0x08); // "esc" key
451         //if (input_port_read_indexed(machine, 0) & 0x02) data = data | 0x08; else data = data & (~0x08); // "esc" key
452452         data = data | 0x08;
453453      }
454454      break;
src/mess/machine/trs80.c
r2340r2341
493493   if( changes & 0x03 )
494494   {
495495      /* virtual tape ? */
496      if( readinputportbytag("CONFIG") & 0x20 )
496      if( input_port_read(machine, "CONFIG") & 0x20 )
497497      {
498498         int now_cycles = activecpu_gettotalcycles();
499499         int diff = now_cycles - put_cycles;
r2340r2341
584584{
585585   int now_cycles = activecpu_gettotalcycles();
586586   /* virtual tape ? */
587   if( readinputportbytag("CONFIG") & 0x20 )
587   if( input_port_read(machine, "CONFIG") & 0x20 )
588588   {
589589      int diff = now_cycles - get_cycles;
590590      /* overrun since last read ? */
r2340r2341
754754   int result = 0;
755755
756756   if (offset & 1)
757      result |= readinputportbytag("LINE0");
757      result |= input_port_read(machine, "LINE0");
758758   if (offset & 2)
759      result |= readinputportbytag("LINE1");
759      result |= input_port_read(machine, "LINE1");
760760   if (offset & 4)
761      result |= readinputportbytag("LINE2");
761      result |= input_port_read(machine, "LINE2");
762762   if (offset & 8)
763      result |= readinputportbytag("LINE3");
763      result |= input_port_read(machine, "LINE3");
764764   if (offset & 16)
765      result |= readinputportbytag("LINE4");
765      result |= input_port_read(machine, "LINE4");
766766   if (offset & 32)
767      result |= readinputportbytag("LINE5");
767      result |= input_port_read(machine, "LINE5");
768768   if (offset & 64)
769      result |= readinputportbytag("LINE6");
769      result |= input_port_read(machine, "LINE6");
770770   if (offset & 128)
771      result |= readinputportbytag("LINE7");
771      result |= input_port_read(machine, "LINE7");
772772
773773   return result;
774774}
src/mess/machine/odyssey2.c
r2340r2341
152152    if (!(p1 & P1_KEYBOARD_SCAN_ENABLE))
153153   {
154154      if ((p2 & P2_KEYBOARD_SELECT_MASK) <= 5)  /* read keyboard */
155         h &= readinputport(p2 & P2_KEYBOARD_SELECT_MASK);
155         h &= input_port_read_indexed(machine, p2 & P2_KEYBOARD_SELECT_MASK);
156156
157157      for (i= 0x80, j = 0; i > 0; i >>= 1, j++)
158158      {
r2340r2341
188188    UINT8 data = 0xff;
189189
190190    if ((p2 & P2_KEYBOARD_SELECT_MASK) == 1)
191      data &= readinputport(6);       /* read joystick 1 */
191      data &= input_port_read_indexed(machine, 6);       /* read joystick 1 */
192192
193193    if ((p2 & P2_KEYBOARD_SELECT_MASK) == 0)
194      data &= readinputport(7);       /* read joystick 2 */
194      data &= input_port_read_indexed(machine, 7);       /* read joystick 2 */
195195
196196    logerror("%.6f bus read %.2x\n", attotime_to_double(timer_get_time()), data);
197197    return data;
src/mess/machine/primo.c
r2340r2341
9393   data |= (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) < 0.1) ? 0x04 : 0x00;
9494
9595   // bit 1 - reset button
96   data |= (readinputport(4)) ? 0x02 : 0x00;
96   data |= (input_port_read_indexed(machine, 4)) ? 0x02 : 0x00;
9797
9898   // bit 0 - keyboard
99   data |= (readinputport((offset&0x0030)>>4) >> (offset&0x000f))&0x0001 ? 0x01 : 0x00;
99   data |= (input_port_read_indexed(machine, (offset&0x0030)>>4) >> (offset&0x000f))&0x0001 ? 0x01 : 0x00;
100100
101101   return data;
102102}
r2340r2341
196196
197197WRITE8_HANDLER( primo_FD_w )
198198{
199   if (!readinputport(6))
199   if (!input_port_read_indexed(machine, 6))
200200   {
201201      primo_port_FD = data;
202202      primo_update_memory();
r2340r2341
240240
241241static void primo_common_machine_init (running_machine *machine)
242242{
243   if (readinputport(6))
243   if (input_port_read_indexed(machine, 6))
244244      primo_port_FD = 0x00;
245245   primo_update_memory();
246   cpunum_set_clockscale(machine, 0, readinputport(5) ? 1.5 : 1.0);
246   cpunum_set_clockscale(machine, 0, input_port_read_indexed(machine, 5) ? 1.5 : 1.0);
247247}
248248
249249MACHINE_RESET( primoa )
src/mess/machine/ti85.c
r2340r2341
110110
111111static TIMER_CALLBACK(ti85_timer_callback)
112112{
113   if (readinputport(8)&0x01)
113   if (input_port_read_indexed(machine, 8)&0x01)
114114   {
115115      if (ti85_ON_interrupt_mask && !ti85_ON_pressed)
116116      {
r2340r2341
292292   for (bit = 0; bit < 7; bit++)
293293      if (~ti85_keypad_mask&(0x01<<bit))
294294         for (port = 0; port < 8; port++)
295            data ^= readinputport(port)&(0x01<<bit) ? 0x01<<port : 0x00;
295            data ^= input_port_read_indexed(machine, port)&(0x01<<bit) ? 0x01<<port : 0x00;
296296   return data;
297297}
298298
r2340r2341
794794{
795795   if (ti85_serial_status == TI85_SEND_STOP)
796796   {
797      if (readinputport(9)&0x01)
797      if (input_port_read_indexed(machine, 9)&0x01)
798798      {
799799         if(!ti85_alloc_serial_data_memory(15)) return;
800800         if(!ti85_receive_serial (ti85_receive_buffer, 7*8))
r2340r2341
813813      {
814814         ti85_receive_serial(NULL, 0);
815815         ti85_free_serial_data_memory(machine);
816         if (readinputport(10)&0x01)
816         if (input_port_read_indexed(machine, 10)&0x01)
817817         {
818818            ti85_serial_status = TI85_PREPARE_SCREEN_REQUEST;
819819            ti85_serial_transfer_type = TI85_RECEIVE_SCREEN;
src/mess/machine/c64.c
r2340r2341
755755
756756UINT8 c64_m6510_port_read(UINT8 direction)
757757{
758   running_machine *machine = Machine;
758759   UINT8 data = c64_port_data;
759760
760761   if (c64_tape_on && !vc20_tape_switch ())
761762      data &= ~0x10;
762763   /* WP: motor is always marked as on??? */
763764   data &= ~0x20;
764   if (is_c128(Machine) && !c128_capslock_r ())
765   if (is_c128(machine) && !c128_capslock_r ())
765766      data &= ~0x40;
766   if (is_c65(Machine) && C65_KEY_DIN)
767   if (is_c65(machine) && C65_KEY_DIN)
767768      data &= ~0x40; /*? */
768769   return data;
769770}
r2340r2341
11371138
11381139   c64_nmi(machine);
11391140
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" );
11481149   
11491150   value = 0xff;
11501151   if (JOYSTICK1||JOYSTICK1_2BUTTON) {
r2340r2341
11981199
11991200   if (is_c65(machine))
12001201   {
1201      c65_keyline = readinputportbytag("ROW8");   
1202      c65_keyline = input_port_read(machine, "ROW8");   
12021203   }
12031204
12041205   vic2_frame_interrupt (machine, cpunum);
r2340r2341
12071208      vc20_tape_config (DATASSETTE, DATASSETTE_TONE);
12081209      vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP);
12091210   }
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);
12111212   set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0);
12121213}
12131214
r2340r2341
12371238
12381239   value = 0xff;
12391240
1240   value &= ~readinputportbytag( "ROW0" );
1241   value &= ~input_port_read(machine, "ROW0" );
12411242   c64_keyline[0] = value;
12421243
12431244   value = 0xff;
12441245   
1245   value &= ~readinputportbytag( "ROW1" );
1246   value &= ~input_port_read(machine, "ROW1" );
12461247   c64_keyline[1] = value;
12471248
12481249   value = 0xff;
12491250   
1250   value &= ~readinputportbytag( "ROW2" );
1251   value &= ~input_port_read(machine, "ROW2" );
12511252   c64_keyline[2] = value;
12521253
12531254   value = 0xff;
12541255   
1255   value &= ~readinputportbytag( "ROW3" );
1256   value &= ~input_port_read(machine, "ROW3" );
12561257   c64_keyline[3] = value;
12571258
12581259   value = 0xff;
12591260   
1260   value &= ~readinputportbytag( "ROW4" );
1261   value &= ~input_port_read(machine, "ROW4" );
12611262   c64_keyline[4] = value;
12621263
12631264   value = 0xff;
12641265   
1265   value &= ~readinputportbytag( "ROW5" );
1266   value &= ~input_port_read(machine, "ROW5" );
12661267   c64_keyline[5] = value;
12671268
12681269   value = 0xff;
12691270   
1270   value &= ~readinputportbytag( "ROW6" );
1271   value &= ~input_port_read(machine, "ROW6" );
12711272   c64_keyline[6] = value;
12721273   
12731274   value = 0xff;
12741275   
1275   value &= ~readinputportbytag( "ROW7" );
1276   value &= ~input_port_read(machine, "ROW7" );
12761277   c64_keyline[7] = value;
12771278
12781279   value = 0xff;
r2340r2341
13271328
13281329   value = 0xff;
13291330   
1330   value &= ~readinputportbytag( "ROW8" );
1331   value &= ~input_port_read(machine, "ROW8" );
13311332   c128_keyline[0] = value;
13321333
13331334   value = 0xff;
13341335   
1335   value &= ~readinputportbytag( "ROW9" );
1336   value &= ~input_port_read(machine, "ROW9" );
13361337   c128_keyline[1] = value;
13371338
13381339   value = 0xff;
13391340   
1340   value &= ~readinputportbytag( "ROW10" );
1341   value &= ~input_port_read(machine, "ROW10" );
13411342   c128_keyline[2] = value;
13421343
13431344/* 2008 FP: still unsure which frame_interrupt must be used for c65, since it's not_working */
13441345/*   if (is_c65(machine)) {
13451346      value = 0xff;
13461347
1347      value &= ~readinputportbytag( "ROW8" );
1348      value &= ~input_port_read(machine, "ROW8" );
13481349      c65_keyline = value;
13491350   }*/
13501351
r2340r2341
13551356      vc20_tape_config (DATASSETTE, DATASSETTE_TONE);
13561357      vc20_tape_buttons (DATASSETTE_PLAY, DATASSETTE_RECORD, DATASSETTE_STOP);
13571358   }
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);
13591360   set_led_status (0 /*KB_NUMLOCK_FLAG */ , JOYSTICK_SWAP ? 1 : 0);
13601361}
src/mess/machine/genesis.c
r2340r2341
12951295         /* process pad input for std 3 button pad */
12961296
12971297
1298         p = readinputport(0);
1298         p = input_port_read_indexed(machine, 0);
12991299         if (genesis_io_ram[offset]&0x40)
13001300         {
13011301            paddata = ((p&0x0f)>>0) | ((p&0xc0)>>2) | 0x40;
r2340r2341
13211321      case 0x02:
13221322//         logerror("I/O Data B read \n");
13231323
1324         p = readinputport(1);
1324         p = input_port_read_indexed(machine, 1);
13251325         if (genesis_io_ram[offset]&0x40)
13261326         {
13271327            paddata = ((p&0x0f)>>0) | ((p&0xc0)>>2) | 0x40;
src/mess/machine/svi318.c
r2340r2341
174174      data |= 0x80;
175175   if (!svi318_cassette_present(0))
176176      data |= 0x40;
177   data |= readinputport(12) & 0x30;
177   data |= input_port_read_indexed(machine, 12) & 0x30;
178178
179179   return data;
180180}
r2340r2341
200200   if (row <= 10)
201201   {
202202      if (row == 6)
203         return readinputport(row) & readinputport(14);
203         return input_port_read_indexed(machine, row) & input_port_read_indexed(machine, 14);
204204      else
205         return readinputport(row);
205         return input_port_read_indexed(machine, row);
206206   }
207207   return 0xff;
208208}
r2340r2341
303303
304304READ8_HANDLER( svi318_psg_port_a_r )
305305{
306   return readinputport (11);
306   return input_port_read_indexed(machine, 11);
307307}
308308
309309/*
r2340r2341
678678{
679679   int set;
680680
681   set = readinputport (13);
681   set = input_port_read_indexed(machine, 13);
682682   TMS9928A_set_spriteslimit (set & 0x20);
683683   TMS9928A_interrupt();
684684}
src/mess/machine/pc.c
r2340r2341
163163static void pc_com_refresh_connected(int n, int data)
164164{
165165   /* mouse connected to this port? */
166   if (readinputport(3) & (0x80>>n))
166   if (input_port_read_indexed(Machine, 3) & (0x80>>n))
167167      pc_mouse_handshake_in(n,data);
168168}
169169
src/mess/machine/pce.c
r2340r2341
264264READ8_HANDLER ( pce_joystick_r )
265265{
266266   UINT8 ret;
267   int data = readinputport(0);
267   int data = input_port_read_indexed(machine, 0);
268268   if(joystick_data_select) data >>= 4;
269269   ret = (data & 0x0F) | pce.io_port_options;
270270#ifdef UNIFIED_PCE
src/mess/machine/amstr_pc.c
r2340r2341
202202 READ8_HANDLER( pc200_port378_r )
203203{
204204   int data=pc_parallelport1_r(machine, offset);
205   if (offset==1) data=(data&~7)|(readinputport(1)&7);
206   if (offset==2) data=(data&~0xe0)|(readinputport(1)&0xc0);
205   if (offset==1) data=(data&~7)|(input_port_read_indexed(machine, 1)&7);
206   if (offset==2) data=(data&~0xe0)|(input_port_read_indexed(machine, 1)&0xc0);
207207   return data;
208208}
209209
r2340r2341
211211 READ8_HANDLER( pc1640_port378_r )
212212{
213213   int data=pc_parallelport1_r(machine, offset);
214   if (offset==1) data=(data&~7)|(readinputport(1)&7);
214   if (offset==1) data=(data&~7)|(input_port_read_indexed(machine, 1)&7);
215215   if (offset==2) {
216216      switch (pc1640.dipstate) {
217217      case 0:
218         data=(data&~0xe0)|(readinputport(1)&0xe0);
218         data=(data&~0xe0)|(input_port_read_indexed(machine, 1)&0xe0);
219219         break;
220220      case 1:
221         data=(data&~0xe0)|((readinputport(1)&0xe000)>>8);
221         data=(data&~0xe0)|((input_port_read_indexed(machine, 1)&0xe000)>>8);
222222         break;
223223      case 2:
224         data=(data&~0xe0)|((readinputport(1)&0xe00)>>4);
224         data=(data&~0xe0)|((input_port_read_indexed(machine, 1)&0xe00)>>4);
225225         break;
226226
227227      }
r2340r2341
251251
252252static READ8_HANDLER( pc1640_mouse_x_r )
253253{
254   return pc1640.mouse.x-readinputport(13);
254   return pc1640.mouse.x-input_port_read_indexed(machine, 13);
255255}
256256
257257static READ8_HANDLER( pc1640_mouse_y_r )
258258{
259   return pc1640.mouse.y-readinputport(14);
259   return pc1640.mouse.y-input_port_read_indexed(machine, 14);
260260}
261261
262262static WRITE8_HANDLER( pc1640_mouse_x_w )
263263{
264   pc1640.mouse.x=data+readinputport(13);
264   pc1640.mouse.x=data+input_port_read_indexed(machine, 13);
265265}
266266
267267static WRITE8_HANDLER( pc1640_mouse_y_w )
268268{
269   pc1640.mouse.y=data+readinputport(14);
269   pc1640.mouse.y=data+input_port_read_indexed(machine, 14);
270270}
271271
272272READ16_HANDLER( pc1640_16le_mouse_x_r )    { return read16le_with_read8_handler(pc1640_mouse_x_r, machine, offset, mem_mask); }
src/mess/machine/ti99_4x.c
r2340r2341
792792   else if (ti99_model == model_99_4p)
793793      xRAM_kind = xRAM_kind_99_4p_1Mb;   /* hack */
794794   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;
796796   if (ti99_model == model_99_8)
797797      has_speech = TRUE;
798798   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;
806806
807807   /* set up optional expansion hardware */
808808   ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL);
r2340r2341
947947   TMS9928A_interrupt();
948948   if (has_handset)
949949      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;
951951   if (has_mecmouse)
952952      mecmouse_poll();
953953}
r2340r2341
959959   if (++line_count == 262)
960960   {
961961      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;
963963      if (has_mecmouse)
964964         mecmouse_poll();
965965   }
r2340r2341
18151815*/
18161816static int ti99_handset_poll_keyboard(int num)
18171817{
1818   running_machine *machine = Machine;
18181819   static UINT8 previous_key[max_handsets];
18191820
18201821   UINT32 key_buf;
r2340r2341
18231824
18241825
18251826   /* 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);
18281829
18291830   /* If a key was previously pressed, this key was not shift, and this key is
18301831   still down, then don't change the current key press. */
r2340r2341
18971898static int ti99_handset_poll_joystick(int num)
18981899{
18991900   static UINT8 previous_joy[max_handsets];
1901   running_machine *machine = Machine;
19001902   UINT8 current_joy;
19011903   int current_joy_x, current_joy_y;
19021904   int message;
19031905
19041906   /* 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);
19071909   /* compare with last saved position */
19081910   current_joy = current_joy_x | (current_joy_y << 4);
19091911   if (current_joy != previous_joy[num])
r2340r2341
20852087static void mecmouse_poll(void)
20862088{
20872089   static int last_mx = 0, last_my = 0;
2090   running_machine *machine = Machine;
20882091   int new_mx, new_my;
20892092   int delta_x, delta_y;
20902093
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);
20932096
20942097   /* compute x delta */
20952098   delta_x = new_mx - last_mx;
r2340r2341
22182221*/
22192222static int ti99_R9901_0(int offset)
22202223{
2224   running_machine *machine = Machine;
22212225   int answer;
22222226
2223
22242227   if ((ti99_model == model_99_4) && (KeyCol == 7))
22252228      answer = (ti99_handset_poll_bus() << 3) | 0x80;
22262229   else if (has_mecmouse && (KeyCol == ((ti99_model == model_99_4) ? 6 : 7)))
22272230   {
2228      int buttons = readinputport(input_port_mouse_buttons) & 3;
2231      int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3;
22292232
22302233      answer = (mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 4;
22312234
r2340r2341
22372240         answer |= 0x80;
22382241   }
22392242   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;
22412244
22422245   if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p))
22432246   {
22442247      if (! AlphaLockLine)
2245         answer &= ~ (readinputport(input_port_caps_lock) << 3);
2248         answer &= ~ (input_port_read_indexed(machine, input_port_caps_lock) << 3);
22462249   }
22472250
22482251   return answer;
r2340r2341
22592262*/
22602263static int ti99_R9901_1(int offset)
22612264{
2265   running_machine *machine = Machine;
22622266   int answer;
22632267
2264
22652268   if (/*(ti99_model == model_99_4) &&*/ (KeyCol == 7))
22662269      answer = 0x07;
22672270   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;
22692272
22702273   /* we don't take CS2 into account, as CS2 is a write-only unit */
22712274   /*if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0)
r2340r2341
23432346*/
23442347static int ti99_8_R9901_0(int offset)
23452348{
2349   running_machine *machine = Machine;
23462350   int answer;
23472351
2348
23492352   if (has_mecmouse && (KeyCol == 15))
23502353   {
2351      int buttons = readinputport(input_port_mouse_buttons) & 3;
2354      int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3;
23522355
23532356      answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 7) & 0x80;
23542357
r2340r2341
23572360         answer |= 0x40;
23582361   }
23592362   else
2360      answer = (readinputport(input_port_keyboard + KeyCol) << 6) & 0xC0;
2363      answer = (input_port_read_indexed(machine, input_port_keyboard + KeyCol) << 6) & 0xC0;
23612364
23622365   return answer;
23632366}
r2340r2341
23732376*/
23742377static int ti99_8_R9901_1(int offset)
23752378{
2379   running_machine *machine = Machine;
23762380   int answer;
23772381
2378
23792382   if (has_mecmouse && (KeyCol == 15))
23802383   {
2381      int buttons = readinputport(input_port_mouse_buttons) & 3;
2384      int buttons = input_port_read_indexed(machine, input_port_mouse_buttons) & 3;
23822385
23832386      answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 1) & 0x03;
23842387
r2340r2341
23872390         answer |= 0x04;
23882391   }
23892392   else
2390      answer = (readinputport(input_port_keyboard + KeyCol) >> 2) & 0x07;
2393      answer = (input_port_read_indexed(machine, input_port_keyboard + KeyCol) >> 2) & 0x07;
23912394
23922395   /* we don't take CS2 into account, as CS2 is a write-only unit */
23932396   /*if (cassette_input(image_from_devtype_and_index(IO_CASSETTE, 0)) > 0)
src/mess/machine/pc1251.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/sc61860/sc61860.h"
34
45#include "includes/pocketc.h"
r2340r2341
2829int pc1251_ina(void)
2930{
3031   int data=outa;
32   running_machine *machine = Machine;
3133
3234   if (outb&1) {
3335      if (PC1251_KEY_MINUS) data|=1;
r2340r2341
108110int pc1251_inb(void)
109111{
110112   int data=outb;
113   running_machine *machine = Machine;
111114   if (outb&8) data|=PC1251_SWITCH_MODE;
112115   return data;
113116}
114117
115118int pc1251_brk(void)
116119{
120   running_machine *machine = Machine;
117121   return PC1251_KEY_BRK;
118122}
119123
120124int pc1251_reset(void)
121125{
126   running_machine *machine = Machine;
122127   return PC1251_KEY_RESET;
123128}
124129
src/mess/machine/galaxy.c
r2340r2341
2424
2525READ8_HANDLER( galaxy_keyboard_r )
2626{
27   return readinputport((offset>>3)&0x07) & (0x01<<(offset&0x07)) ? 0xfe : 0xff;
27   return input_port_read_indexed(machine, (offset>>3)&0x07) & (0x01<<(offset&0x07)) ? 0xfe : 0xff;
2828}
2929
3030READ8_HANDLER( galaxy_latch_r )
r2340r2341
167167MACHINE_RESET( galaxy )
168168{
169169   /* ROM 2 enable/disable */
170   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, readinputport(7) ? SMH_BANK10 : SMH_NOP);
170   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, input_port_read_indexed(machine, 7) ? SMH_BANK10 : SMH_NOP);
171171   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, SMH_NOP);
172   if (readinputport(7))
172   if (input_port_read_indexed(machine, 7))
173173      memory_set_bankptr(10, memory_region(REGION_CPU1) + 0x1000);
174174
175175   cpunum_set_irq_callback(0, galaxy_irq_callback);
src/mess/machine/gamepock.c
r2340r2341
105105   UINT8   data = 0xFF;
106106
107107   if ( gamepock_port_a & 0x80 ) {
108      data &= readinputport(0);
108      data &= input_port_read_indexed(machine, 0);
109109   }
110110
111111   if ( gamepock_port_a & 0x40 ) {
112      data &= readinputport(1);
112      data &= input_port_read_indexed(machine, 1);
113113   }
114114
115115   return data;
src/mess/machine/bbc.c
r2340r2341
765765           /* set the value of via_system ca2, by checking for any keys
766766              being pressed on the selected column */
767767
768         if ((readinputport(column)|0x01)!=0xff)
768         if ((input_port_read_indexed(machine, column)|0x01)!=0xff)
769769         {
770770            via_0_ca2_w(machine, 0,1);
771771         } else {
r2340r2341
797797         /* set the value of via_system ca2, by checking for any keys
798798             being pressed on the selected column */
799799
800         if ((readinputport(column)|0x01)!=0xff)
800         if ((input_port_read_indexed(machine, column)|0x01)!=0xff)
801801         {
802802            via_0_ca2_w(machine, 0,1);
803803         } else {
r2340r2341
823823   bit=0;
824824
825825   if (column<10) {
826      res=readinputport(column);
826      res=input_port_read_indexed(machine, column);
827827   } else {
828828      res=0xff;
829829   }
r2340r2341
11011101//{
11021102//   TMSint=(!status)&1;
11031103//   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)));
11051105//}
11061106
11071107
r2340r2341
11111111//   TMSint=(!tms5220_int_r())&1;
11121112//   TMSrdy=(!tms5220_ready_r())&1;
11131113
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));
11151115
1116   return (0xf | readinputport(16)|(TMSint<<6)|(TMSrdy<<7));
1116   return (0xf | input_port_read_indexed(machine, 16)|(TMSint<<6)|(TMSrdy<<7));
11171117
11181118
11191119}
r2340r2341
12871287   switch(channel_number)
12881288   {
12891289      case 0:
1290         return ((0xff-readinputport(17))<<8);
1290         return ((0xff-input_port_read_indexed(Machine, 17))<<8);
12911291         break;
12921292      case 1:
1293         return ((0xff-readinputport(18))<<8);
1293         return ((0xff-input_port_read_indexed(Machine, 18))<<8);
12941294         break;
12951295      case 2:
1296         return ((0xff-readinputport(19))<<8);
1296         return ((0xff-input_port_read_indexed(Machine, 19))<<8);
12971297         break;
12981298      case 3:
1299         return ((0xff-readinputport(20))<<8);
1299         return ((0xff-input_port_read_indexed(Machine, 20))<<8);
13001300         break;
13011301   }
13021302
r2340r2341
21242124{
21252125   //removed from here because MACHINE_START can no longer read DIP swiches.
21262126   //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;
21302130
21312131   via_config(0, &bbcb_system_via);
21322132   via_set_clock(0,1000000);
r2340r2341
21492149
21502150MACHINE_RESET( bbcb )
21512151{
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;
21552155
21562156   memory_set_bankptr(1,memory_region(REGION_CPU1));
21572157   if (bbc_RAMSize)
src/mess/machine/compis.c
r2340r2341
215215/*-------------------------------------------------------------------------*/
216216/*  Keyboard                                                               */
217217/*-------------------------------------------------------------------------*/
218static void compis_keyb_update(void)
218static void compis_keyb_update(running_machine *machine)
219219{
220220   UINT8 key_code;
221221   UINT8 key_status;
r2340r2341
229229
230230   for (irow = 0; irow < 6; irow++)
231231   {
232      data = readinputport(irow);
232      data = input_port_read_indexed(machine, irow);
233233      if (data != 0)
234234      {
235235         ibit = 1;
r2340r2341
291291static void compis_fdc_tc(int state)
292292{
293293   /* Terminal count if iSBX-218A has DMA enabled */
294     if (readinputport(7))
294     if (input_port_read_indexed(Machine, 7))
295295   {
296296      nec765_set_tc_state(state);
297297   }
r2340r2341
300300static void compis_fdc_int(int state)
301301{
302302   /* No interrupt requests if iSBX-218A has DMA enabled */
303     if (!readinputport(7) && state)
303     if (!input_port_read_indexed(Machine, 7) && state)
304304   {
305305      compis_osp_pic_irq(COMPIS_IRQ_SBX0_INT1);
306306   }
r2340r2341
309309static void compis_fdc_dma_drq(int state, int read)
310310{
311311   /* DMA requst if iSBX-218A has DMA enabled */
312     if (readinputport(7) && state)
312     if (input_port_read_indexed(Machine, 7) && state)
313313   {
314314      //compis_dma_drq(state, read);
315315   }
r2340r2341
326326   UINT16 data;
327327   data = 0xffff;
328328   /* DMA acknowledge if iSBX-218A has DMA enabled */
329     if (readinputport(7))
329     if (input_port_read_indexed(machine, 7))
330330     {
331331      data = nec765_dack_r(machine, 0);
332332   }
r2340r2341
402402   UINT8 data;
403403
404404   /* DIP switch - Test mode */
405   data = readinputport(6);
405   data = input_port_read_indexed(machine, 6);
406406
407407   /* Centronics busy */
408408   if (!printer_status(image_from_devtype_and_index(IO_PRINTER, 0), 0))
r2340r2341
16061606INTERRUPT_GEN( compis_vblank_int )
16071607{
16081608//   compis_gdc_vblank_int();
1609   compis_keyb_update();
1609   compis_keyb_update(machine);
16101610}
src/mess/machine/vtech2.c
r2340r2341
1414****************************************************************************/
1515
1616#include "driver.h"
17#include "deprecat.h"
1718#include "includes/vtech2.h"
1819#include "devices/cassette.h"
1920#include "sound/speaker.h"
r2340r2341
224225      static int row_a,row_b,row_c,row_d;
225226      if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */
226227      {
227         if( readinputport( 8) != row_a )
228         if( input_port_read_indexed(Machine, 8) != row_a )
228229         {
229            row_a = readinputport(8);
230            row_a = input_port_read_indexed(Machine, 8);
230231            data &= row_a;
231232         }
232233      }
233234      if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */
234235      {
235         if( readinputport( 9) != row_b )
236         if( input_port_read_indexed(Machine, 9) != row_b )
236237         {
237            row_b = readinputport( 9);
238            row_b = input_port_read_indexed(Machine, 9);
238239            data &= row_b;
239240         }
240241      }
241242      if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */
242243      {
243         if( readinputport(10) != row_c )
244         if( input_port_read_indexed(Machine, 10) != row_c )
244245         {
245            row_c = readinputport(10);
246            row_c = input_port_read_indexed(Machine, 10);
246247            data &= row_c;
247248         }
248249      }
249250      if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */
250251      {
251         if( readinputport(11) != row_d )
252         if( input_port_read_indexed(Machine, 11) != row_d )
252253         {
253            row_d = readinputport(11);
254            row_d = input_port_read_indexed(Machine, 11);
254255            data &= row_d;
255256         }
256257      }
r2340r2341
259260   {
260261      /* All Lasers keyboard rows 0 through 7 */
261262        if( !(offs & 0x01) )
262         data &= readinputport( 0);
263         data &= input_port_read_indexed(Machine, 0);
263264      if( !(offs & 0x02) )
264         data &= readinputport( 1);
265         data &= input_port_read_indexed(Machine, 1);
265266      if( !(offs & 0x04) )
266         data &= readinputport( 2);
267         data &= input_port_read_indexed(Machine, 2);
267268      if( !(offs & 0x08) )
268         data &= readinputport( 3);
269         data &= input_port_read_indexed(Machine, 3);
269270      if( !(offs & 0x10) )
270         data &= readinputport( 4);
271         data &= input_port_read_indexed(Machine, 4);
271272      if( !(offs & 0x20) )
272         data &= readinputport( 5);
273         data &= input_port_read_indexed(Machine, 5);
273274      if( !(offs & 0x40) )
274         data &= readinputport( 6);
275         data &= input_port_read_indexed(Machine, 6);
275276      if( !(offs & 0x80) )
276         data &= readinputport( 7);
277         data &= input_port_read_indexed(Machine, 7);
277278   }
278279
279280    /* what's bit 7 good for? tape input maybe? */
src/mess/machine/kc.c
r2340r2341
927927   for (i=0; i<KC_KEYBOARD_NUM_LINES-1; i++)
928928   {
929929      /* read input port */
930      kc_previous_keyboard[i] = readinputport(i);
930      kc_previous_keyboard[i] = input_port_read_indexed(Machine, i);
931931   }
932932}
933933
r2340r2341
982982   scan = scan_code;
983983
984984   /* state of shift key */
985   kc_keyboard_add_bit(((readinputport(8) & 0x01)^0x01));
985   kc_keyboard_add_bit(((input_port_read_indexed(Machine, 8) & 0x01)^0x01));
986986
987987   for (i=0; i<6; i++)
988988   {
r2340r2341
10531053      int mask = 0x001;
10541054
10551055      /* read input port */
1056      keyboard_line_data = readinputport(i);
1056      keyboard_line_data = input_port_read_indexed(machine, i);
10571057      /* identify keys that have changed */
10581058      changed_keys = keyboard_line_data ^ kc_previous_keyboard[i];
10591059      /* store input port for next time */
src/mess/drivers/vip.c
r2340r2341
8787
8888static UINT8 vip_mode_r(void)
8989{
90   if (readinputportbytag("RUN") & 0x01)
90   if (input_port_read(Machine, "RUN") & 0x01)
9191   {
9292      if (!vip_run)
9393      {
r2340r2341
117117
118118   if (cdp1861_efx) ef -= EF1;
119119   // EF2 = tape (high when tone read)
120   if (readinputportbytag("KEYPAD") & (1 << keylatch)) ef -= EF3;
120   if (input_port_read(Machine, "KEYPAD") & (1 << keylatch)) ef -= EF3;
121121
122122   return ef;
123123}
src/mess/drivers/jaguar.c
r2340r2341
210210      if ((joystick_data & (0x10000 << i)) == 0)
211211      {
212212         sprintf(port, "JOY%d", i);
213         joystick_result &= readinputportbytag(port);
213         joystick_result &= input_port_read(machine, port);
214214
215215         sprintf(port, "BUTTONS%d", i);
216         joybuts_result &= readinputportbytag(port);
216         joybuts_result &= input_port_read(machine, port);
217217      }
218218   }
219219
src/mess/drivers/atari.c
r2340r2341
673673
674674
675675
676static READ8_HANDLER( analog_0_r ) { return (UINT8) readinputportbytag("analog_0"); }
677static READ8_HANDLER( analog_1_r ) { return (UINT8) readinputportbytag("analog_1"); }
678static READ8_HANDLER( analog_2_r ) { return (UINT8) readinputportbytag("analog_2"); }
679static READ8_HANDLER( analog_3_r ) { return (UINT8) readinputportbytag("analog_3"); }
680static READ8_HANDLER( analog_4_r ) { return (UINT8) readinputportbytag("analog_4"); }
681static READ8_HANDLER( analog_5_r ) { return (UINT8) readinputportbytag("analog_5"); }
682static READ8_HANDLER( analog_6_r ) { return (UINT8) readinputportbytag("analog_6"); }
683static READ8_HANDLER( analog_7_r ) { return (UINT8) readinputportbytag("analog_7"); }
676static READ8_HANDLER( analog_0_r ) { return (UINT8) input_port_read(machine, "analog_0"); }
677static READ8_HANDLER( analog_1_r ) { return (UINT8) input_port_read(machine, "analog_1"); }
678static READ8_HANDLER( analog_2_r ) { return (UINT8) input_port_read(machine, "analog_2"); }
679static READ8_HANDLER( analog_3_r ) { return (UINT8) input_port_read(machine, "analog_3"); }
680static READ8_HANDLER( analog_4_r ) { return (UINT8) input_port_read(machine, "analog_4"); }
681static READ8_HANDLER( analog_5_r ) { return (UINT8) input_port_read(machine, "analog_5"); }
682static READ8_HANDLER( analog_6_r ) { return (UINT8) input_port_read(machine, "analog_6"); }
683static READ8_HANDLER( analog_7_r ) { return (UINT8) input_port_read(machine, "analog_7"); }
684684
685685
686686
src/mess/drivers/nc.c
r2340r2341
400400            memory_set_bankptr(bank+1, addr);
401401
402402            /* write enabled? */
403            if (readinputportbytag("EXTRA") & 0x02)
403            if (input_port_read(Machine, "EXTRA") & 0x02)
404404            {
405405               /* yes */
406406               memory_set_bankptr(bank+5, addr);
r2340r2341
518518   int inputport_10_state;
519519   int changed_bits;
520520
521    inputport_10_state = readinputportbytag("EXTRA");
521    inputport_10_state = input_port_read(machine, "EXTRA");
522522
523523   changed_bits = inputport_10_state^previous_inputport_10_state;
524524
r2340r2341
571571    nc_memory_config[2] = 0;
572572    nc_memory_config[3] = 0;
573573
574   previous_inputport_10_state = readinputportbytag("EXTRA");
574   previous_inputport_10_state = input_port_read(machine, "EXTRA");
575575
576576    /* setup reset state ints are masked */
577577    nc_irq_mask = 0;
r2340r2341
695695      nc_update_interrupts(machine);
696696   }
697697   sprintf(port, "LINE%d", offset);
698   return readinputportbytag(port);
698   return input_port_read(machine, port);
699699}
700700
701701
r2340r2341
10211021      nc_card_battery_status &=~(1<<7);
10221022   }
10231023
1024   if (readinputport(10) & 0x02)
1024   if (input_port_read_indexed(machine, 10) & 0x02)
10251025   {
10261026      /* card write enable */
10271027      nc_card_battery_status &=~(1<<6);
r2340r2341
14321432      nc_card_battery_status&=~(1<<7);
14331433   }
14341434
1435   if (readinputport(10) & 0x02)
1435   if (input_port_read_indexed(machine, 10) & 0x02)
14361436   {
14371437      /* card write enable */
14381438      nc_card_battery_status &=~(1<<6);
src/mess/drivers/adam.c
r2340r2341
441441
442442static TIMER_CALLBACK(adam_paddle_callback)
443443{
444   int port7 = readinputportbytag("controller1_analog");
445   int port8 = readinputportbytag("controller2_analog");
444   int port7 = input_port_read(machine, "controller1_analog");
445   int port8 = input_port_read(machine, "controller2_analog");
446446
447447   if (port7 == 0)
448448      adam_joy_stat[0] = 0;
src/mess/drivers/sord.c
r2340r2341
324324   else
325325      sprintf(port, "LINE%d", offset);
326326
327   return readinputportbytag(port);
327   return input_port_read(machine, port);
328328}
329329
330330static ADDRESS_MAP_START( sord_m5_mem , ADDRESS_SPACE_PROGRAM, 8)
src/mess/drivers/mbee.c
r2340r2341
438438
439439static QUICKLOAD_LOAD( mbee )
440440{
441   UINT8 sw = readinputportbytag("CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
441   UINT8 sw = input_port_read(machine, "CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
442442   UINT16 exec_addr, start_addr, end_addr;
443443
444444   if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL)
r2340r2341
478478static SNAPSHOT_LOAD( mbee )
479479{
480480   UINT16 i, j;
481   UINT8 data, sw = readinputportbytag("CONFIG") & 1;   /* reading the dipswitch: 1 = autorun */
481   UINT8 data, sw = input_port_read(machine, "CONFIG") & 1;   /* reading the dipswitch: 1 = autorun */
482482
483483   for (i = 0; i < snapshot_size; i++)
484484   {
src/mess/drivers/mk1.c
r2340r2341
5555    UINT8 data = mk1_f8[offset];
5656
5757    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");
6262      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;
6767      }
6868      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;
7373      }
7474      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;
7979      }
8080      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;
8585      }
8686    }
8787    return data;
src/mess/drivers/z88.c
r2340r2341
8888      for (i=0; i<8; i++)
8989      {
9090         sprintf(port, "LINE%d", i);
91         data &= readinputportbytag(port);
91         data &= input_port_read(machine, port);
9292      }
9393
9494      /* if any key is pressed, then one or more bits will be 0 */
r2340r2341
547547
548548
549549         if ((lines & 0x080)==0)
550            data &=readinputportbytag("LINE7");
550            data &=input_port_read(machine, "LINE7");
551551
552552         if ((lines & 0x040)==0)
553            data &=readinputportbytag("LINE6");
553            data &=input_port_read(machine, "LINE6");
554554
555555         if ((lines & 0x020)==0)
556            data &=readinputportbytag("LINE5");
556            data &=input_port_read(machine, "LINE5");
557557
558558         if ((lines & 0x010)==0)
559            data &=readinputportbytag("LINE4");
559            data &=input_port_read(machine, "LINE4");
560560
561561         if ((lines & 0x008)==0)
562            data &=readinputportbytag("LINE3");
562            data &=input_port_read(machine, "LINE3");
563563
564564         if ((lines & 0x004)==0)
565            data &=readinputportbytag("LINE2");
565            data &=input_port_read(machine, "LINE2");
566566
567567         if ((lines & 0x002)==0)
568            data &=readinputportbytag("LINE1");
568            data &=input_port_read(machine, "LINE1");
569569
570570         if ((lines & 0x001)==0)
571            data &=readinputportbytag("LINE0");
571            data &=input_port_read(machine, "LINE0");
572572
573573         logerror("lines: %02x\n",lines);
574574         logerror("key r: %02x\n",data);
src/mess/drivers/pcw16.c
r2340r2341
10381038{
10391039//  logerror("system status r: \n");
10401040
1041   return pcw16_system_status | (readinputport(0) & 0x04);
1041   return pcw16_system_status | (input_port_read_indexed(machine, 0) & 0x04);
10421042}
10431043
10441044static READ8_HANDLER(pcw16_timer_interrupt_counter_r)
r2340r2341
12441244         new_inputs = 0;
12451245
12461246         /* Power switch is connected to Ring indicator */
1247         if (readinputport(0) & 0x040)
1247         if (input_port_read_indexed(Machine, 0) & 0x040)
12481248         {
12491249            new_inputs = UART8250_INPUTS_RING_INDICATOR;
12501250         }
src/mess/drivers/glasgow.c
r2340r2341
318318{
319319  UINT16 data;
320320  data=0x0300;
321  key_low = readinputportbytag("LINE0");
322  key_hi =  readinputportbytag("LINE1");
321  key_low = input_port_read(machine, "LINE0");
322  key_hi =  input_port_read(machine, "LINE1");
323323//logerror("Keyboard Offset = %x Data = %x\n  ",offset,data);
324324  if (key_select==key_low){data=data&0x100;}
325325  if (key_select==key_hi){data=data&0x200;}
r2340r2341
330330{
331331 UINT16 data;
332332
333 if (key_selector==0) data=readinputportbytag("LINE0");else data=readinputportbytag("LINE1");
333 if (key_selector==0) data=input_port_read(machine, "LINE0");else data=input_port_read(machine, "LINE1");
334334 logerror("read Keyboard Offset = %x Data = %x   Select = %x \n  ",offset,data,key_selector);
335335 data=data<<8;
336336 return data ;
r2340r2341
493493static READ32_HANDLER(read_newkeys32) // Dallas 32, Roma 32
494494{
495495 UINT32 data;
496 if (key_selector==0) data=readinputportbytag("LINE0");else data=readinputportbytag("LINE1");
497 //if (key_selector==1) data=readinputportbytag("LINE0");else data=0;
496 if (key_selector==0) data=input_port_read(machine, "LINE0");else data=input_port_read(machine, "LINE1");
497 //if (key_selector==1) data=input_port_read(machine, "LINE0");else data=0;
498498 logerror("read Keyboard Offset = %x Data = %x\n  ",offset,data);
499499 data=data<<24;
500500 return data ;
r2340r2341
605605   if (my_cursor != NULL)
606606      set_cursor (my_cursor);
607607
608    m_button1=readinputportbytag("BUTTON_L");
609    m_button2=readinputportbytag("BUTTON_R");
608    m_button1=input_port_read(screen->machine, "BUTTON_L");
609    m_button2=input_port_read(screen->machine, "BUTTON_R");
610610
611611    if ( m_button1) MOUSE_BUTTON1_WAIT = 0;
612612
r2340r2341
991991    save_x = m_x;
992992    save_y = m_y;
993993
994    m_x=readinputportbytag("MOUSE_X");
995    m_y=readinputportbytag("MOUSE_Y");
994    m_x=input_port_read(Machine, "MOUSE_X");
995    m_y=input_port_read(Machine, "MOUSE_Y");
996996
997997//    logerror("m_x   = %d \n  ",m_x);
998998//    logerror("m_y   = %d \n  ",m_y);
src/mess/drivers/tmc600.c
r2340r2341
8282*/
8383
8484#include "driver.h"
85#include "deprecat.h"
8586#include "devices/printer.h"
8687#include "devices/basicdsk.h"
8788#include "devices/cassette.h"
r2340r2341
267268
268269static UINT8 tmc600_mode_r(void)
269270{
270   if (readinputportbytag("RUN") & 0x01)
271   if (input_port_read(Machine, "RUN") & 0x01)
271272   {
272273      return CDP1802_MODE_RESET;
273274   }
r2340r2341
291292
292293   // keyboard
293294   sprintf(port, "IN%d", keylatch / 8);
294   flags -= (~readinputportbytag(port) & (1 << (keylatch % 8))) ? EF3 : 0;
295   flags -= (~input_port_read(Machine, port) & (1 << (keylatch % 8))) ? EF3 : 0;
295296
296297   return flags;
297298}
src/mess/drivers/tm990189.c
r2340r2341
412412   if (digitsel < 9)
413413   {
414414      sprintf(port, "LINE%d", digitsel);
415      reply |= readinputportbytag(port) << 1;
415      reply |= input_port_read(Machine, port) << 1;
416416   }
417417
418418   /* tape input */
r2340r2341
632632
633633static READ8_HANDLER(video_joy_r)
634634{
635   int reply = readinputportbytag("BUTTONS");
635   int reply = input_port_read(machine, "BUTTONS");
636636
637637
638638   if (attotime_compare(timer_timeleft(joy1x_timer), attotime_zero) < 0)
r2340r2341
652652
653653static WRITE8_HANDLER(video_joy_w)
654654{
655   timer_reset(joy1x_timer, ATTOTIME_IN_USEC(readinputportbytag("JOY1_X")*28+28));
656   timer_reset(joy1y_timer, ATTOTIME_IN_USEC(readinputportbytag("JOY1_Y")*28+28));
657   timer_reset(joy2x_timer, ATTOTIME_IN_USEC(readinputportbytag("JOY2_X")*28+28));
658   timer_reset(joy2y_timer, ATTOTIME_IN_USEC(readinputportbytag("JOY2_Y")*28+28));
655   timer_reset(joy1x_timer, ATTOTIME_IN_USEC(input_port_read(machine, "JOY1_X")*28+28));
656   timer_reset(joy1y_timer, ATTOTIME_IN_USEC(input_port_read(machine, "JOY1_Y")*28+28));
657   timer_reset(joy2x_timer, ATTOTIME_IN_USEC(input_port_read(machine, "JOY2_X")*28+28));
658   timer_reset(joy2y_timer, ATTOTIME_IN_USEC(input_port_read(machine, "JOY2_Y")*28+28));
659659}
660660
661661
src/mess/drivers/pasogo.c
r2340r2341
100100      case 0x09: break;
101101      case 0x0a:
102102   if (vg230.data[9]&1) {
103     data=readinputportbytag("JOY");
103     data=input_port_read(machine, "JOY");
104104   } else {
105105     data=0xff;
106106   }
src/mess/drivers/lynx.c
r2340r2341
5252static INTERRUPT_GEN( lynx_frame_int )
5353{
5454    lynx_rotate=rotate;
55    if ((readinputportbytag("ROTATION")&3)!=3)
56      lynx_rotate=readinputportbytag("ROTATION")&3;
55    if ((input_port_read(machine, "ROTATION")&3)!=3)
56      lynx_rotate=input_port_read(machine, "ROTATION")&3;
5757}
5858
5959static UINT8 lynx_read_vram(UINT16 address)
src/mess/drivers/abc80.c
r2340r2341
162162   { 0x5f, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 }
163163};
164164
165static void abc80_keyboard_scan(void)
165static void abc80_keyboard_scan(running_machine *machine)
166166{
167167   UINT8 keycode = 0;
168168   UINT8 data;
169169   int table = 0, row, col;
170170
171171   // shift, upper case
172   if (readinputportbytag("ROW7") & 0x07)
172   if (input_port_read(machine, "ROW7") & 0x07)
173173   {
174174      table |= 0x01;
175175   }
176176
177177   // ctrl
178   if (readinputportbytag("ROW7") & 0x08)
178   if (input_port_read(machine, "ROW7") & 0x08)
179179   {
180180      table |= 0x02;
181181   }
r2340r2341
185185      char port[5];
186186      sprintf(port, "ROW%d", row);
187187
188      data = readinputportbytag(port);
188      data = input_port_read(machine, port);
189189
190190      if (data != 0)
191191      {
r2340r2341
438438
439439static TIMER_CALLBACK(abc80_keyboard_tick)
440440{
441   abc80_keyboard_scan();
441   abc80_keyboard_scan(machine);
442442}
443443
444444static MACHINE_START( abc80 )
src/mess/drivers/x68k.c
r2340r2341
469469      {
470470         sys.keyboard.keytime[x] -= 5;
471471      }
472      if(!(readinputportbytag(port) & (1 << (x % 32))))
472      if(!(input_port_read(machine, port) & (1 << (x % 32))))
473473      {
474474         if(sys.keyboard.keyon[x] != 0)
475475         {
r2340r2341
484484      if(sys.keyboard.keyon[x] != 0 && sys.keyboard.keytime[x] == 0 && sys.keyboard.last_pressed == x)
485485      {
486486         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)))
488488         {
489489            x68k_keyboard_push_scancode(sys.keyboard.last_pressed);
490490            sys.keyboard.keytime[sys.keyboard.last_pressed] = (sys.keyboard.repeat^2)*5+30;
r2340r2341
492492         }
493493      }
494494      sprintf(port, "key%d", (x / 32) + 1);
495      if((readinputportbytag(port) & (1 << (x % 32))))
495      if((input_port_read(machine, port) & (1 << (x % 32))))
496496      {
497497         if(sys.keyboard.keyon[x] == 0)
498498         {
r2340r2341
522522// mouse input
523523// port B of the Z8530 SCC
524524// typically read from the SCC data port on receive buffer full interrupt per byte
525static int x68k_read_mouse(void)
525static int x68k_read_mouse(running_machine *machine)
526526{
527527   char val = 0;
528528   char ipt = 0;
r2340r2341
530530   switch(sys.mouse.inputtype)
531531   {
532532   case 0:
533      ipt = readinputportbytag("mouse1");
533      ipt = input_port_read(machine, "mouse1");
534534      break;
535535   case 1:
536      val = readinputportbytag("mouse2");
536      val = input_port_read(machine, "mouse2");
537537      ipt = val - sys.mouse.last_mouse_x;
538538      sys.mouse.last_mouse_x = val;
539539      break;
540540   case 2:
541      val = readinputportbytag("mouse3");
541      val = input_port_read(machine, "mouse3");
542542      ipt = val - sys.mouse.last_mouse_y;
543543      sys.mouse.last_mouse_y = val;
544544      break;
r2340r2341
571571   case 0:
572572      return scc_r(machine, 0);
573573   case 1:
574      return x68k_read_mouse();
574      return x68k_read_mouse(machine);
575575   case 2:
576576      return scc_r(machine, 1);
577577   case 3:
r2340r2341
643643{
644644   // Joystick 1
645645   if(sys.joy.joy1_enable == 0)
646      return readinputportbytag("joy1");
646      return input_port_read(machine, "joy1");
647647   else
648648      return 0xff;
649649}
r2340r2341
652652{
653653   // Joystick 2
654654   if(sys.joy.joy2_enable == 0)
655      return readinputportbytag("joy2");
655      return input_port_read(machine, "joy2");
656656   else
657657      return 0xff;
658658}
r2340r2341
13511351static READ16_HANDLER( x68k_exp_r )
13521352{
13531353   /* 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)
13551355   {
13561356      current_vector[2] = 0x02;  // bus error
13571357      current_irq_line = 2;
r2340r2341
13671367static WRITE16_HANDLER( x68k_exp_w )
13681368{
13691369   /* 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)
13711371   {
13721372      current_vector[2] = 0x02;  // bus error
13731373      current_irq_line = 2;
src/mess/drivers/spectrum.c
r2340r2341
229229   int lines = offset>>8;
230230   int data = 0xff;
231231
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;
237237
238   if ( readinputportbytag("MOTOR") & 0x01 ) {
238   if ( input_port_read(machine, "MOTOR") & 0x01 ) {
239239      if ( motor_toggle_previous == 0 ) {
240240         cassette_motor_mode = cassette_motor_mode ^ 0x01;
241241         cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), cassette_motor_mode ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR );
r2340r2341
248248   /* Caps - V */
249249   if ((lines & 1)==0)
250250   {
251      data &= readinputportbytag("LINE0");
251      data &= input_port_read(machine, "LINE0");
252252      /* CAPS for extra keys */
253253      if (cs_extra1 != 0x1f || cs_extra2 != 0x1f || cs_extra3 != 0x1f)
254254         data &= ~0x01;
r2340r2341
256256
257257   /* A - G */
258258   if ((lines & 2)==0)
259      data &= readinputportbytag("LINE1");
259      data &= input_port_read(machine, "LINE1");
260260
261261   /* Q - T */
262262   if ((lines & 4)==0)
263      data &= readinputportbytag("LINE2");
263      data &= input_port_read(machine, "LINE2");
264264
265265   /* 1 - 5 */
266266   if ((lines & 8)==0)
267      data &= readinputportbytag("LINE3") & cs_extra1;
267      data &= input_port_read(machine, "LINE3") & cs_extra1;
268268
269269   /* 6 - 0 */
270270   if ((lines & 16)==0)
271      data &= readinputportbytag("LINE4") & cs_extra2;
271      data &= input_port_read(machine, "LINE4") & cs_extra2;
272272
273273   /* Y - P */
274274   if ((lines & 32)==0)
275      data &= readinputportbytag("LINE5") & ss_extra1;
275      data &= input_port_read(machine, "LINE5") & ss_extra1;
276276
277277   /* H - Enter */
278278   if ((lines & 64)==0)
279      data &= readinputportbytag("LINE6");
279      data &= input_port_read(machine, "LINE6");
280280
281281   /* B - Space */
282282   if ((lines & 128)==0)
283283   {
284      data &= readinputportbytag("LINE7") & cs_extra3 & ss_extra2;
284      data &= input_port_read(machine, "LINE7") & cs_extra3 & ss_extra2;
285285      /* SYMBOL SHIFT for extra keys */
286286      if (ss_extra1 != 0x1f || ss_extra2 != 0x1f)
287287         data &= ~0x02;
r2340r2341
297297
298298   /* Issue 2 Spectrums default to having bits 5, 6 & 7 set.
299299    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)
301301      data ^= (0x40);
302302   return data;
303303}
r2340r2341
305305/* kempston joystick interface */
306306static  READ8_HANDLER(spectrum_port_1f_r)
307307{
308  return readinputportbytag("KEMPSTON") & 0x1f;
308  return input_port_read(machine, "KEMPSTON") & 0x1f;
309309}
310310
311311/* fuller joystick interface */
312312static  READ8_HANDLER(spectrum_port_7f_r)
313313{
314  return readinputportbytag("FULLER") | (0xff^0x8f);
314  return input_port_read(machine, "FULLER") | (0xff^0x8f);
315315}
316316
317317/* mikrogen joystick interface */
318318static  READ8_HANDLER(spectrum_port_df_r)
319319{
320  return readinputportbytag("MIKROGEN") | (0xff^0x1f);
320  return input_port_read(machine, "MIKROGEN") | (0xff^0x1f);
321321}
322322
323323static  READ8_HANDLER ( spectrum_port_r )
r2340r2341
568568
569569static WRITE8_HANDLER(spectrum_plus3_port_3ffd_w)
570570{
571      if (~readinputportbytag("CONFIG") & 0x20)
571      if (~input_port_read(machine, "CONFIG") & 0x20)
572572            nec765_data_w(machine, 0,data);
573573}
574574
575575static  READ8_HANDLER(spectrum_plus3_port_3ffd_r)
576576{
577      if (readinputportbytag("CONFIG") & 0x20)
577      if (input_port_read(machine, "CONFIG") & 0x20)
578578            return 0xff;
579579      else
580580            return nec765_data_r(machine, 0);
r2340r2341
583583
584584static  READ8_HANDLER(spectrum_plus3_port_2ffd_r)
585585{
586      if (readinputportbytag("CONFIG") & 0x20)
586      if (input_port_read(machine, "CONFIG") & 0x20)
587587            return 0xff;
588588      else
589589            return nec765_status_r(machine, 0);
src/mess/drivers/mpf1.c
r2340r2341
404404   if( keycol != 6 )
405405   {
406406      sprintf(port, "LINE%d", keycol);
407      retval = readinputportbytag(port);
407      retval = input_port_read(machine, port);
408408   }
409409   else
410410   {
src/mess/drivers/super80.c
r2340r2341
211211static VIDEO_EOF( super80m )
212212{
213213   /* 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
215215
216216   if (chosen_palette != current_palette)                  // any changes?
217217   {
r2340r2341
228228   UINT8 x, y, code=32, screen_on=0;
229229   UINT8 mask = screen->machine->gfx[0]->total_elements - 1;   /* 0x3F for super80; 0xFF for super80d & super80e */
230230
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 */
232232      screen_on++;
233233
234234   /* display the picture */
r2340r2341
249249
250250static VIDEO_UPDATE( super80m )
251251{
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");
253253
254254   /* get selected character generator */
255255   UINT8 cgen = current_charset ^ ((options & 0x10)>>4);   /* bit 0 of port F1 and cgen config switch */
r2340r2341
291291   UINT8 speed = mc6845_reg[10]&0x20, flash = mc6845_reg[10]&0x40;            // cursor modes
292292   UINT16 cursor = (mc6845_reg[14]<<8) | mc6845_reg[15];               // get cursor position
293293   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");
295295   framecnt++;
296296
297297   /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines,
r2340r2341
380380      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
381381
382382   /* does user want to hear the sound? */
383   if (readinputportbytag("CONFIG") & 8)
383   if (input_port_read(Machine, "CONFIG") & 8)
384384      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_SPEAKER_ENABLED, CASSETTE_MASK_SPEAKER);
385385   else
386386      cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0), CASSETTE_SPEAKER_MUTED, CASSETTE_MASK_SPEAKER);
r2340r2341
409409   for ( i=0; i < 8;i++)
410410   {
411411      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);
413413      mask<<=1;
414414   }
415415
r2340r2341
440440
441441static READ8_HANDLER( super80_f2_r )
442442{
443   UINT8 data = readinputportbytag("DSW") & 0xf0;   // dip switches on pcb
443   UINT8 data = input_port_read(machine, "DSW") & 0xf0;   // dip switches on pcb
444444   data |= cass_out;         // bit 0 = output of U1, bit 1 = current wave_state
445445   data |= 0x0c;            // bits 2,3 - not used
446446   return data;
r2340r2341
750750static TIMER_CALLBACK( super80_halfspeed )
751751{
752752   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 */
754754      go_fast++;
755755
756756   /* code to slow down computer to 1mhz by halting cpu on every second frame */
r2340r2341
952952
953953static QUICKLOAD_LOAD( super80 )
954954{
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 */
956956   UINT16 exec_addr, start_addr, end_addr;
957957
958958   if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL)
src/mess/drivers/atarist.c
r2340r2341
315315
316316    */
317317
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);
319319}
320320
321321static WRITE8_HANDLER( ikbd_port2_w )
r2340r2341
354354
355355   set_led_status(1, data & 0x01);
356356
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");
364364}
365365
366366static READ8_HANDLER( ikbd_port4_r )
r2340r2341
380380
381381    */
382382
383   if (readinputportbytag("config") & 0x01)
383   if (input_port_read(machine, "config") & 0x01)
384384   {
385385      /*
386386
r2340r2341
391391
392392        */
393393
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);
397397
398398      if (x == ikbd.mouse_x)
399399      {
r2340r2341
440440   }
441441   else
442442   {
443      return readinputportbytag_safe("IKBD_JOY0", 0xff);
443      return input_port_read_safe(machine, "IKBD_JOY0", 0xff);
444444   }
445445}
446446
r2340r2341
461461
462462    */
463463
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");
472472}
473473
474474/* DMA Sound */
r2340r2341
812812
813813    */
814814
815   return (readinputportbytag("SW400") << 8) | 0xff;
815   return (input_port_read(machine, "SW400") << 8) | 0xff;
816816}
817817
818818static WRITE16_HANDLER( stbook_lcd_control_w )
r2340r2341
14051405
14061406   data |= (acia_irq << 4);
14071407   data |= (fdc.irq << 5);
1408   data |= (readinputportbytag("config") & 0x80);
1408   data |= (input_port_read(machine, "config") & 0x80);
14091409
14101410   return data;
14111411}
r2340r2341
15671567
15681568   data |= (acia_irq << 4);
15691569   data |= (fdc.irq << 5);
1570   data |= (readinputportbytag("config") & 0x80) ^ (dmasound.active << 7);
1570   data |= (input_port_read(machine, "config") & 0x80) ^ (dmasound.active << 7);
15711571
15721572   return data;
15731573}
src/mess/drivers/sg1000.c
r2340r2341
4747{
4848   if (data & 0x01)
4949   {
50      tvdraw_data = readinputportbytag("TVDRAW_X");
50      tvdraw_data = input_port_read(machine, "TVDRAW_X");
5151
5252      if (tvdraw_data < 4) tvdraw_data = 4;
5353      if (tvdraw_data > 251) tvdraw_data = 251;
5454   }
5555   else
5656   {
57      tvdraw_data = readinputportbytag("TVDRAW_Y") + 32;
57      tvdraw_data = input_port_read(machine, "TVDRAW_Y") + 32;
5858   }
5959}
6060
6161static READ8_HANDLER( tvdraw_status_r )
6262{
63   return readinputportbytag("TVDRAW_PEN");
63   return input_port_read(machine, "TVDRAW_PEN");
6464}
6565
6666static READ8_HANDLER( tvdraw_data_r )
r2340r2341
356356    */
357357
358358   sprintf(port, "PA%d", keylatch);
359   return readinputportbytag(port);
359   return input_port_read(machine, port);
360360}
361361
362362static READ8_HANDLER( sc3000_ppi8255_b_r )
r2340r2341
377377    */
378378
379379   sprintf(port, "PB%d", keylatch);
380   return ( readinputportbytag(port) | 0x70 );
380   return ( input_port_read(machine, port) | 0x70 );
381381}
382382
383383static WRITE8_HANDLER( sc3000_ppi8255_c_w )
r2340r2341
835835   if (device_load_serial_device(image)==INIT_PASS)
836836   {
837837      /* setup transmit parameters */
838      serial_device_setup(image, 9600 >> readinputportbytag("BAUD"), 8, 1, SERIAL_PARITY_NONE);
838      serial_device_setup(image, 9600 >> input_port_read(image->machine, "BAUD"), 8, 1, SERIAL_PARITY_NONE);
839839
840840      /* connect serial chip to serial device */
841841      msm8251_connect_to_serial_device(image);
src/mess/drivers/exidy.c
r2340r2341
454454static WRITE8_HANDLER(exidy_ff_port_w)
455455{
456456   /* reading the config switch */
457   switch ((readinputportbytag("CONFIG")>>1) & 0x01)
457   switch ((input_port_read(machine, "CONFIG")>>1) & 0x01)
458458   {
459459      case 0: /* speaker */
460460         speaker_level_w(0, (data) ? 1 : 0);
r2340r2341
518518   char port[7];
519519
520520   /* bit 5 - vsync (inverted) */
521   data |= (((~readinputportbytag("VS")) & 0x01)<<5);
521   data |= (((~input_port_read(machine, "VS")) & 0x01)<<5);
522522
523523   /* bits 4..0 - keyboard data */
524524   sprintf(port, "LINE%d", exidy_keyboard_line);
525   data |= (readinputportbytag(port) & 0x01f);
525   data |= (input_port_read(machine, port) & 0x01f);
526526
527527   return data;
528528}
r2340r2341
793793
794794static QUICKLOAD_LOAD( exidy )
795795{
796   UINT8 sw = readinputportbytag("CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
796   UINT8 sw = input_port_read(machine, "CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
797797   UINT16 exec_addr, start_addr, end_addr;
798798
799799   if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL)
src/mess/drivers/a2600.c
r2340r2341
10701070static WRITE8_HANDLER( switch_A_w )
10711071{
10721072   /* Left controller port */
1073   if ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT == 0x03 ) {
1073   if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 ) {
10741074      keypad_left_column = data / 16;
10751075   }
10761076
10771077   /* Right controller port */
1078   switch( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) {
1078   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
10791079   case 0x03:   /* Keypad */
10801080      keypad_right_column = data & 0x0F;
10811081      break;
r2340r2341
10911091   UINT8 val = 0;
10921092
10931093   /* Left controller port PINs 1-4 ( 4321 ) */
1094   switch( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) {
1094   switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
10951095   case 0x00:  /* Joystick */
10961096   case 0x05:   /* Joystick w/Boostergrip */
1097      val |= readinputportbytag("SWA_JOY") & 0xF0;
1097      val |= input_port_read(machine, "SWA_JOY") & 0xF0;
10981098      break;
10991099   case 0x01:  /* Paddle */
1100      val |= readinputportbytag("SWA_PAD") & 0xF0;
1100      val |= input_port_read(machine, "SWA_PAD") & 0xF0;
11011101      break;
11021102   case 0x02:   /* Driving */
11031103      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 );
11051105      break;
11061106   case 0x06:   /* Trakball CX-22 */
11071107   case 0x07:   /* Trakball CX-80 / ST mouse */
r2340r2341
11121112   }
11131113
11141114   /* Right controller port PINs 1-4 ( 4321 ) */
1115   switch( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) {
1115   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
11161116   case 0x00:   /* Joystick */
11171117   case 0x05:   /* Joystick w/Boostergrip */
1118      val |= readinputportbytag("SWA_JOY") & 0x0F;
1118      val |= input_port_read(machine, "SWA_JOY") & 0x0F;
11191119      break;
11201120   case 0x01:   /* Paddle */
1121      val |= readinputportbytag("SWA_PAD") & 0x0F;
1121      val |= input_port_read(machine, "SWA_PAD") & 0x0F;
11221122      break;
11231123   case 0x02:   /* Driving */
11241124      val |= 0x0C;
1125      val |= ( driving_lookup[ ( readinputportbytag("WHEEL_R") & 0x18 ) >> 3 ] );
1125      val |= ( driving_lookup[ ( input_port_read(machine, "WHEEL_R") & 0x18 ) >> 3 ] );
11261126      break;
11271127   case 0x06:   /* Trakball CX-22 */
11281128   case 0x07:   /* Trakball CX-80 / ST mouse */
r2340r2341
11791179
11801180   switch( offset ) {
11811181   case 0:   /* Left controller port PIN 5 */
1182      switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) {
1182      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
11831183      case 0x00:   /* Joystick */
11841184         return TIA_INPUT_PORT_ALWAYS_OFF;
11851185      case 0x01:   /* Paddle */
1186         return readinputportbytag("PADDLE1");
1186         return input_port_read(machine, "PADDLE1");
11871187      case 0x03:   /* Keypad */
11881188         for ( i = 0; i < 4; i++ ) {
11891189            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 ) {
11911191                  return TIA_INPUT_PORT_ALWAYS_ON;
11921192               } else {
11931193                  return TIA_INPUT_PORT_ALWAYS_OFF;
r2340r2341
11961196         }
11971197         return TIA_INPUT_PORT_ALWAYS_ON;
11981198      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;
12001200      default:
12011201         return TIA_INPUT_PORT_ALWAYS_OFF;
12021202      }
12031203      break;
12041204   case 1:   /* Right controller port PIN 5 */
1205      switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) {
1205      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
12061206      case 0x00:   /* Joystick */
12071207         return TIA_INPUT_PORT_ALWAYS_OFF;
12081208      case 0x01:   /* Paddle */
1209         return readinputportbytag("PADDLE3");
1209         return input_port_read(machine, "PADDLE3");
12101210      case 0x03:   /* Keypad */
12111211         for ( i = 0; i < 4; i++ ) {
12121212            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 ) {
12141214                  return TIA_INPUT_PORT_ALWAYS_ON;
12151215               } else {
12161216                  return TIA_INPUT_PORT_ALWAYS_OFF;
r2340r2341
12191219         }
12201220         return TIA_INPUT_PORT_ALWAYS_ON;
12211221      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;
12231223      default:
12241224         return TIA_INPUT_PORT_ALWAYS_OFF;
12251225      }
12261226      break;
12271227   case 2:   /* Left controller port PIN 9 */
1228      switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) {
1228      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
12291229      case 0x00:   /* Joystick */
12301230         return TIA_INPUT_PORT_ALWAYS_OFF;
12311231      case 0x01:   /* Paddle */
1232         return readinputportbytag("PADDLE2");
1232         return input_port_read(machine, "PADDLE2");
12331233      case 0x03:   /* Keypad */
12341234         for ( i = 0; i < 4; i++ ) {
12351235            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 ) {
12371237                  return TIA_INPUT_PORT_ALWAYS_ON;
12381238               } else {
12391239                  return TIA_INPUT_PORT_ALWAYS_OFF;
r2340r2341
12421242         }
12431243         return TIA_INPUT_PORT_ALWAYS_ON;
12441244      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;
12461246      default:
12471247         return TIA_INPUT_PORT_ALWAYS_OFF;
12481248      }
12491249      break;
12501250   case 3:   /* Right controller port PIN 9 */
1251      switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) {
1251      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
12521252      case 0x00:   /* Joystick */
12531253         return TIA_INPUT_PORT_ALWAYS_OFF;
12541254      case 0x01:   /* Paddle */
1255         return readinputportbytag("PADDLE4");
1255         return input_port_read(machine, "PADDLE4");
12561256      case 0x03:   /* Keypad */
12571257         for ( i = 0; i < 4; i++ ) {
12581258            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 ) {
12601260                  return TIA_INPUT_PORT_ALWAYS_ON;
12611261               } else {
12621262                  return TIA_INPUT_PORT_ALWAYS_OFF;
r2340r2341
12651265         }
12661266         return TIA_INPUT_PORT_ALWAYS_ON;
12671267      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;
12691269      default:
12701270         return TIA_INPUT_PORT_ALWAYS_OFF;
12711271      }
12721272      break;
12731273   case 4:   /* Left controller port PIN 6 */
1274      switch ( readinputportbytag("CONTROLLERS") / CATEGORY_SELECT ) {
1274      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
12751275      case 0x00:   /* Joystick */
12761276      case 0x05:   /* Joystick w/Boostergrip */
1277         return readinputportbytag("BUTTONS_L");
1277         return input_port_read(machine, "BUTTONS_L");
12781278      case 0x01:   /* Paddle */
12791279         return 0xff;
12801280      case 0x02:   /* Driving */
1281         return readinputportbytag("BUTTONS_L") << 3;
1281         return input_port_read(machine, "BUTTONS_L") << 3;
12821282      case 0x03:   /* Keypad */
12831283         for ( i = 0; i < 4; i++ ) {
12841284            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 ) {
12861286                  return 0xff;
12871287               } else {
12881288                  return 0x00;
r2340r2341
12911291         }
12921292         return 0xff;
12931293      case 0x06:   /* Trakball CX-22 */
1294         return readinputportbytag("BUTTONS_L") << 4;
1294         return input_port_read(machine, "BUTTONS_L") << 4;
12951295      default:
12961296         return 0xff;
12971297      }
12981298      break;
12991299   case 5:   /* Right controller port PIN 6 */
1300      switch ( readinputportbytag("CONTROLLERS") % CATEGORY_SELECT ) {
1300      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
13011301      case 0x00:   /* Joystick */
13021302      case 0x05:   /* Joystick w/Boostergrip */
1303         return readinputportbytag("BUTTONS_R");
1303         return input_port_read(machine, "BUTTONS_R");
13041304      case 0x01:   /* Paddle */
13051305         return 0xff;
13061306      case 0x02:   /* Driving */
1307         return readinputportbytag("BUTTONS_R") << 3;
1307         return input_port_read(machine, "BUTTONS_R") << 3;
13081308      case 0x03:   /* Keypad */
13091309         for ( i = 0; i < 4; i++ ) {
13101310            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 ) {
13121312                  return 0xff;
13131313               } else {
13141314                  return 0x00;
r2340r2341
13171317         }
13181318         return 0xff;
13191319      case 0x06:   /* Trakball CX-22 */
1320         return readinputportbytag("BUTTONS_R") << 4;
1320         return input_port_read(machine, "BUTTONS_R") << 4;
13211321      default:
13221322         return 0xff;
13231323      }
src/mess/drivers/studio2.c
r2340r2341
100100*/
101101
102102#include "driver.h"
103#include "deprecat.h"
103104#include "cpu/cdp1802/cdp1802.h"
104105#include "video/cdp1861.h"
105106#include "video/cdp1864.h"
r2340r2341
189190
190191   if (cdp1861_efx) ef -= EF1;
191192
192   if (readinputportbytag("KEYPAD_L") & (1 << keylatch)) ef -= EF3;
193   if (readinputportbytag("KEYPAD_R") & (1 << keylatch)) ef -= EF4;
193   if (input_port_read(Machine, "KEYPAD_L") & (1 << keylatch)) ef -= EF3;
194   if (input_port_read(Machine, "KEYPAD_R") & (1 << keylatch)) ef -= EF4;
194195
195196   return ef;
196197}
r2340r2341
216217
217218   if (cdp1864_efx) ef -= EF1;
218219
219   if (readinputportbytag("KEYPAD_L") & (1 << keylatch)) ef -= EF3;
220   if (readinputportbytag("KEYPAD_R") & (1 << keylatch)) ef -= EF4;
220   if (input_port_read(Machine, "KEYPAD_L") & (1 << keylatch)) ef -= EF3;
221   if (input_port_read(Machine, "KEYPAD_R") & (1 << keylatch)) ef -= EF4;
221222
222223   return ef;
223224}
src/mess/drivers/pcw.c
r2340r2341
247247/* PCW keyboard is mapped into memory */
248248static  READ8_HANDLER(pcw_keyboard_r)
249249{
250   return readinputport(offset);
250   return input_port_read_indexed(machine, offset);
251251}
252252
253253
r2340r2341
368368/* from Jacob Nevins docs */
369369static int pcw_get_sys_status(void)
370370{
371   return pcw_interrupt_counter | (readinputport(16) & (0x040 | 0x010)) | pcw_system_status;
371   return pcw_interrupt_counter | (input_port_read_indexed(Machine, 16) & (0x040 | 0x010)) | pcw_system_status;
372372}
373373
374374static READ8_HANDLER(pcw_interrupt_counter_r)
r2340r2341
593593      case 0x0e0:
594594      {
595595         /* spectravideo joystick */
596         if (readinputport(16) & 0x020)
596         if (input_port_read_indexed(machine, 16) & 0x020)
597597         {
598            return readinputport(17);
598            return input_port_read_indexed(machine, 17);
599599         }
600600         else
601601         {
r2340r2341
607607      {
608608
609609         /* kempston joystick */
610         return readinputport(18);
610         return input_port_read_indexed(machine, 18);
611611      }
612612
613613      case 0x0e1:
src/mess/drivers/mk2.c
r2340r2341
154154static int mk2_read_a(int chip)
155155{
156156   int data=0xff;
157   int help=readinputportbytag("BLACK")|readinputportbytag("WHITE"); // looks like white and black keys are the same!
157   int help=input_port_read(Machine, "BLACK")|input_port_read(Machine, "WHITE"); // looks like white and black keys are the same!
158158
159159   switch (rriot_0_b_r(Machine, 0)&0x7) {
160160   case 4:
r2340r2341
165165      if (help&2) data&=~0x10; // B
166166      if (help&1) data&=~0x20; // A
167167#if 0
168      if (readinputport(3)&1) data&=~0x40; //?
168      if (input_port_read_indexed(machine, 3)&1) data&=~0x40; //?
169169#endif
170170      break;
171171   case 5:
172172#if 0
173      if (readinputport(3)&2) data&=~0x1; //?
174      if (readinputport(3)&4) data&=~0x2; //?
175      if (readinputport(3)&8) data&=~0x4; //?
173      if (input_port_read_indexed(machine, 3)&2) data&=~0x1; //?
174      if (input_port_read_indexed(machine, 3)&4) data&=~0x2; //?
175      if (input_port_read_indexed(machine, 3)&8) data&=~0x4; //?
176176#endif
177      if (readinputportbytag("EXTRA")&4) data&=~0x8; // Enter
178      if (readinputportbytag("EXTRA")&2) data&=~0x10; // Clear
177      if (input_port_read(Machine, "EXTRA")&4) data&=~0x8; // Enter
178      if (input_port_read(Machine, "EXTRA")&2) data&=~0x10; // Clear
179179      if (help&0x80) data&=~0x20; // H
180180      if (help&0x40) data&=~0x40; // G
181181      break;
src/mess/drivers/osi.c
r2340r2341
7979{
8080   UINT8 key_column_data = 0xff;
8181
82   if (!(key_row_latch & 0x01)) key_column_data &= readinputportbytag("ROW0");
83   if (!(key_row_latch & 0x02)) key_column_data &= readinputportbytag("ROW1");
84   if (!(key_row_latch & 0x04)) key_column_data &= readinputportbytag("ROW2");
85   if (!(key_row_latch & 0x08)) key_column_data &= readinputportbytag("ROW3");
86   if (!(key_row_latch & 0x10)) key_column_data &= readinputportbytag("ROW4");
87   if (!(key_row_latch & 0x20)) key_column_data &= readinputportbytag("ROW5");
88   if (!(key_row_latch & 0x40)) key_column_data &= readinputportbytag("ROW6");
89   if (!(key_row_latch & 0x80)) key_column_data &= readinputportbytag("ROW7");
82   if (!(key_row_latch & 0x01)) key_column_data &= input_port_read(machine, "ROW0");
83   if (!(key_row_latch & 0x02)) key_column_data &= input_port_read(machine, "ROW1");
84   if (!(key_row_latch & 0x04)) key_column_data &= input_port_read(machine, "ROW2");
85   if (!(key_row_latch & 0x08)) key_column_data &= input_port_read(machine, "ROW3");
86   if (!(key_row_latch & 0x10)) key_column_data &= input_port_read(machine, "ROW4");
87   if (!(key_row_latch & 0x20)) key_column_data &= input_port_read(machine, "ROW5");
88   if (!(key_row_latch & 0x40)) key_column_data &= input_port_read(machine, "ROW6");
89   if (!(key_row_latch & 0x80)) key_column_data &= input_port_read(machine, "ROW7");
9090
9191   return key_column_data;
9292}
src/mess/drivers/bw2.c
r2340r2341
166166   if (device_load_serial_device(image) == INIT_PASS)
167167   {
168168      /* setup transmit parameters */
169      serial_device_setup(image, 9600 >> readinputportbytag("BAUD"), 8, 1, SERIAL_PARITY_NONE);
169      serial_device_setup(image, 9600 >> input_port_read(image->machine, "BAUD"), 8, 1, SERIAL_PARITY_NONE);
170170
171171      /* connect serial chip to serial device */
172172      msm8251_connect_to_serial_device(image);
r2340r2341
332332   if (row <= 9)
333333   {
334334      sprintf(port, "ROW%d", row);
335      return readinputportbytag(port);
335      return input_port_read(machine, port);
336336   }
337337
338338   return 0xff;
src/mess/drivers/enterp.c
r2340r2341
130130
131131      /* read keyboard line */
132132      sprintf(port, "LINE%d", Enterprise_KeyboardLine);
133      Dave_setreg(machine, 0x015, readinputportbytag(port));
133      Dave_setreg(machine, 0x015, input_port_read(machine, port));
134134      }
135135      break;
136136
137137   case 0x016:
138138   {
139139      int ExternalJoystickInputs;
140      int ExternalJoystickPortInput = readinputportbytag("JOY1");
140      int ExternalJoystickPortInput = input_port_read(machine, "JOY1");
141141
142142      if (Enterprise_KeyboardLine<=4)
143143      {
src/mess/drivers/coleco.c
r2340r2341
191191
192192static TIMER_CALLBACK(paddle_callback)
193193{
194    int port7 = readinputportbytag("IN7");
195    int port8 = readinputportbytag("IN8");
194    int port7 = input_port_read(machine, "IN7");
195    int port8 = input_port_read(machine, "IN8");
196196
197197    if (port7 == 0)
198198      JoyStat[0] = 0;
src/mess/drivers/apf.c
r2340r2341
5454
5555  UINT8 data=~0;
5656  if (!(pad_data & 0x08))
57    data &= readinputportbytag("joy3");
57    data &= input_port_read(machine, "joy3");
5858  if (!(pad_data & 0x04))
59    data &= readinputportbytag("joy2");
59    data &= input_port_read(machine, "joy2");
6060  if (!(pad_data & 0x02))
61    data &= readinputportbytag("joy1");
61    data &= input_port_read(machine, "joy1");
6262  if (!(pad_data & 0x01))
63    data &= readinputportbytag("joy0");
63    data &= input_port_read(machine, "joy0");
6464
6565   return data;
6666}
r2340r2341
254254   keyboard_line = data & 0x07;
255255
256256   sprintf(port, "key%d", keyboard_line);
257   keyboard_data = readinputportbytag(port);
257   keyboard_data = input_port_read(machine, port);
258258
259259   /* bit 4: cassette motor control */
260260   cassette_change_state(image_from_devtype_and_index(IO_CASSETTE, 0),
src/mess/drivers/saturn.c
r2340r2341
475475   }
476476
477477   sprintf(port, "JOY%d", intback_stage-1);   // intback_stage will be 2 or 3, 2 = player 1, 3 = player 2
478   pad = readinputportbytag(port);
478   pad = input_port_read(Machine, port);
479479
480480//  if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2);
481481   smpc_ram[33] = 0xf1;   // no tap, direct connect
r2340r2341
505505      return_data = smpcSR;
506506
507507   if (offset == 0x75)//PDR1 read
508      return_data = 0xff; //readinputportbytag("PDR1");
508      return_data = 0xff; //input_port_read(machine, "PDR1");
509509
510510   if (offset == 0x77)//PDR2 read
511511      return_data=  0xff; // | EEPROM_read_bit());
r2340r2341
20862086    smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
20872087    smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
20882088    smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
2089//  smpc_ram[0x33] = readinputport(7);
2089//  smpc_ram[0x33] = input_port_read_indexed(machine, 7);
20902090    smpc_ram[0x5f] = 0x10;
20912091}
20922092
src/mess/drivers/ql.c
r2340r2341
562562
563563    */
564564
565   if (BIT(ipc.keylatch, 0)) return readinputportbytag("ROW0") | readinputportbytag("JOY0");
566   if (BIT(ipc.keylatch, 1)) return readinputportbytag("ROW1") | readinputportbytag("JOY1");
567   if (BIT(ipc.keylatch, 2)) return readinputportbytag("ROW2");
568   if (BIT(ipc.keylatch, 3)) return readinputportbytag("ROW3");
569   if (BIT(ipc.keylatch, 4)) return readinputportbytag("ROW4");
570   if (BIT(ipc.keylatch, 5)) return readinputportbytag("ROW5");
571   if (BIT(ipc.keylatch, 6)) return readinputportbytag("ROW6");
572   if (BIT(ipc.keylatch, 7)) return readinputportbytag("ROW7");
565   if (BIT(ipc.keylatch, 0)) return input_port_read(machine, "ROW0") | input_port_read(machine, "JOY0");
566   if (BIT(ipc.keylatch, 1)) return input_port_read(machine, "ROW1") | input_port_read(machine, "JOY1");
567   if (BIT(ipc.keylatch, 2)) return input_port_read(machine, "ROW2");
568   if (BIT(ipc.keylatch, 3)) return input_port_read(machine, "ROW3");
569   if (BIT(ipc.keylatch, 4)) return input_port_read(machine, "ROW4");
570   if (BIT(ipc.keylatch, 5)) return input_port_read(machine, "ROW5");
571   if (BIT(ipc.keylatch, 6)) return input_port_read(machine, "ROW6");
572   if (BIT(ipc.keylatch, 7)) return input_port_read(machine, "ROW7");
573573
574574   return 0;
575575}
src/mess/drivers/amiga.c
r2340r2341
1818
1919/* Core includes */
2020#include "driver.h"
21#include "deprecat.h"
2122#include "includes/amiga.h"
2223
2324/* Components */
r2340r2341
265266
266267static UINT8 amiga_cia_0_portA_r( void )
267268{
268   UINT8 ret = readinputportbytag("CIA0PORTA") & 0xc0;   /* Gameport 1 and 0 buttons */
269   UINT8 ret = input_port_read(Machine, "CIA0PORTA") & 0xc0;   /* Gameport 1 and 0 buttons */
269270   ret |= amiga_fdc_status_r();
270271   return ret;
271272}
r2340r2341
298299
299300static UINT16 amiga_read_joy0dat(void)
300301{
301   if ( readinputportbytag("input") & 0x20 ) {
302   if ( input_port_read(Machine, "input") & 0x20 ) {
302303      /* Joystick */
303      return readinputportbytag_safe("JOY0DAT", 0xffff);
304      return input_port_read_safe(Machine, "JOY0DAT", 0xffff);
304305   } else {
305306      /* Mouse */
306307      int input;
307      input  = ( readinputportbytag("P0MOUSEX") & 0xff );
308      input |= ( readinputportbytag("P0MOUSEY") & 0xff ) << 8;
308      input  = ( input_port_read(Machine, "P0MOUSEX") & 0xff );
309      input |= ( input_port_read(Machine, "P0MOUSEY") & 0xff ) << 8;
309310      return input;
310311   }
311312}
312313
313314static UINT16 amiga_read_joy1dat(void)
314315{
315   if ( readinputportbytag("input") & 0x10 ) {
316   if ( input_port_read(Machine, "input") & 0x10 ) {
316317      /* Joystick */
317      return readinputportbytag_safe("JOY1DAT", 0xffff);
318      return input_port_read_safe(Machine, "JOY1DAT", 0xffff);
318319   } else {
319320      /* Mouse */
320321      int input;
321      input  = ( readinputportbytag("P1MOUSEX") & 0xff );
322      input |= ( readinputportbytag("P1MOUSEY") & 0xff ) << 8;
322      input  = ( input_port_read(Machine, "P1MOUSEX") & 0xff );
323      input |= ( input_port_read(Machine, "P1MOUSEY") & 0xff ) << 8;
323324      return input;
324325   }
325326}
r2340r2341
339340
340341static void amiga_reset(void)
341342{
342   if (readinputportbytag("hardware") & 0x08)
343   if (input_port_read(Machine, "hardware") & 0x08)
343344   {
344345      /* Install RTC */
345346      memory_install_readwrite16_handler(0, ADDRESS_SPACE_PROGRAM, 0xdc0000, 0xdc003f, 0, 0, amiga_clock_r, amiga_clock_w);
src/mess/drivers/channelf.c
r2340r2341
4747
4848static  READ8_HANDLER( channelf_port_0_r )
4949{
50   return port_read_with_latch(readinputportbytag("PANEL"),latch[0]);
50   return port_read_with_latch(input_port_read(machine, "PANEL"),latch[0]);
5151}
5252
5353static  READ8_HANDLER( channelf_port_1_r )
r2340r2341
5656
5757   if ((latch[0] & 0x40) == 0)
5858   {
59      ext_value = readinputportbytag("RIGHT_C");
59      ext_value = input_port_read(machine, "RIGHT_C");
6060   }
6161   else
6262   {
63      ext_value = 0xc0 | readinputportbytag("RIGHT_C");
63      ext_value = 0xc0 | input_port_read(machine, "RIGHT_C");
6464   }
6565   return port_read_with_latch(ext_value,latch[1]);
6666}
r2340r2341
7171
7272   if ((latch[0] & 0x40) == 0)
7373   {
74      ext_value = readinputportbytag("LEFT_C");
74      ext_value = input_port_read(machine, "LEFT_C");
7575   }
7676   else
7777   {
src/mess/drivers/abc80x.c
r2340r2341
276276   char port[4];
277277   sprintf(port, "X%d", abc77_keylatch);
278278
279   return readinputportbytag(port);
279   return input_port_read(machine, port);
280280}
281281
282282static WRITE8_HANDLER( abc77_data_w )
r2340r2341
301301
302302static READ8_HANDLER( abc77_ea_r )
303303{
304   return readinputportbytag("DSW") & 0x01;
304   return input_port_read(machine, "DSW") & 0x01;
305305}
306306
307307/* Memory Maps */
r2340r2341
10481048   if (device_load_serial_device(image)==INIT_PASS)
10491049   {
10501050      /* setup transmit parameters */
1051      serial_device_setup(image, 9600 >> readinputportbytag("BAUD"), 8, 1, SERIAL_PARITY_NONE);
1051      serial_device_setup(image, 9600 >> input_port_read(image->machine, "BAUD"), 8, 1, SERIAL_PARITY_NONE);
10521052
10531053      serial_device_set_protocol(image, SERIAL_PROTOCOL_NONE);
10541054
src/mess/drivers/tmc2000e.c
r2340r2341
11#include "driver.h"
2#include "deprecat.h"
23#include "cpu/cdp1802/cdp1802.h"
34#include "devices/printer.h"
45#include "devices/basicdsk.h"
r2340r2341
9596
9697static UINT8 tmc2000e_mode_r(void)
9798{
98   if (readinputportbytag("RUN") & 0x01)
99   if (input_port_read(Machine, "RUN") & 0x01)
99100   {
100101      return CDP1802_MODE_RUN;
101102   }
r2340r2341
119120
120121   // keyboard
121122   sprintf(port, "IN%d", keylatch / 8);
122   if (~readinputportbytag(port) & (1 << (keylatch % 8))) flags -= EF3;
123   if (~input_port_read(Machine, port) & (1 << (keylatch % 8))) flags -= EF3;
123124
124125   return flags;
125126}
src/mess/drivers/crvision.c
r2340r2341
250250   for (i = 0; i < 8; i++)
251251   {
252252      sprintf(portname, "PA%u-%u", pa, i);
253      value = readinputportbytag(portname);
253      value = input_port_read(Machine, portname);
254254
255255      if (value != 0xff)
256256      {
src/mess/drivers/tmc1800.c
r2340r2341
8686*/
8787
8888#include "driver.h"
89#include "deprecat.h"
8990#include "cpu/cdp1802/cdp1802.h"
9091#include "video/cdp1864.h"
9192#include "devices/cassette.h"
r2340r2341
170171
171172static UINT8 tmc1800_mode_r(void)
172173{
173   if (readinputportbytag("RUN") & 0x01)
174   if (input_port_read(Machine, "RUN") & 0x01)
174175   {
175176      return CDP1802_MODE_RUN;
176177   }
r2340r2341
194195
195196   // keyboard
196197   sprintf(port, "IN%d", keylatch / 8);
197   if (~readinputportbytag(port) & (1 << (keylatch % 8))) flags -= EF2;
198   if (~input_port_read(Machine, port) & (1 << (keylatch % 8))) flags -= EF2;
198199
199200   return flags;
200201}
r2340r2341
229230
230231   // keyboard
231232   sprintf(port, "IN%d", keylatch / 8);
232   if (~readinputportbytag(port) & (1 << (keylatch % 8))) flags -= EF2;
233   if (~input_port_read(Machine, port) & (1 << (keylatch % 8))) flags -= EF2;
233234
234235   return flags;
235236}
src/mess/drivers/gmaster.c
r2340r2341
106106    UINT8 data=0xff;
107107    switch (offset) {
108108    case UPD7810_PORTA:
109   data=readinputportbytag("JOY");
109   data=input_port_read(machine, "JOY");
110110   break;
111111    default:
112112      logerror("%.4x port %d read %.2x\n",(int)activecpu_get_reg(CPUINFO_INT_PC),offset,data);
src/mess/drivers/acrnsys1.c
r2340r2341
2727   char port[11];
2828   UINT8 data;
2929   sprintf(port, "keyboard_%d", key_digit);
30   data = readinputportbytag(port);
30   data = input_port_read(device->machine, port);
3131   logerror("Reading %02x from row %d\n", data, key_digit);
3232   return data;
3333}
src/mess/drivers/einstein.c
r2340r2341
344344      if ((einstein_keyboard_line & (1<<i))==0)
345345      {
346346         sprintf(port, "LINE%d", i);
347         data &= readinputportbytag(port);
347         data &= input_port_read(Machine, port);
348348      }
349349   }
350350
r2340r2341
377377   einstein_scan_keyboard();
378378
379379   /* if /fire1 or /fire2 is 0, then trigger a fire interrupt if the interrupt is enabled */
380   if ((readinputportbytag("BUTTONS") & 0x03)!=0)
380   if ((input_port_read(machine, "BUTTONS") & 0x03)!=0)
381381   {
382382      einstein_int |= EINSTEIN_FIRE_INT;
383383   }
r2340r2341
872872   /* bit 2: 1=printer busy */
873873   /* bit 1: fire 1 */
874874   /* bit 0: fire 0 */
875   data = ((readinputportbytag("EXTRA") & 0x07)<<5) | (readinputportbytag("BUTTONS") & 0x03) | 0x01c;
875   data = ((input_port_read(machine, "EXTRA") & 0x07)<<5) | (input_port_read(machine, "BUTTONS") & 0x03) | 0x01c;
876876
877877   /* error? */
878878   if (centronics_handshake & CENTRONICS_NO_ERROR)
src/mess/drivers/ti99_2.c
r2340r2341
257257   char port[6];
258258
259259   sprintf(port, "LINE%d", KeyRow);
260   return readinputportbytag(port);
260   return input_port_read(machine, port);
261261}
262262
263263static  READ8_HANDLER ( ti99_2_read_misc_cru )
src/mess/drivers/mephisto.c
r2340r2341
8585  else
8686   sprintf(port, "KEY2_%d", offset);
8787
88  data=readinputportbytag(port);
88  data=input_port_read(machine, port);
8989
9090  logerror("Keyboard Port = %s Data = %d\n  ",port,data);
9191  return data| 0x7f;
src/mess/drivers/ssystem3.c
r2340r2341
3434*/
3535
3636#include "driver.h"
37#include "deprecat.h"
3738
3839#include "includes/ssystem3.h"
3940#include "machine/6522via.h"
r2340r2341
7980{
8081  memset(&playfield, 0, sizeof(playfield));
8182  playfield.signal=FALSE;
82  //  playfield.on=TRUE; //readinputportbytag("Configuration")&1;
83  //  playfield.on=TRUE; //input_port_read(machine, "Configuration")&1;
8384}
8485
8586static void ssystem3_playfield_write(int reset, int signal)
r2340r2341
129130
130131static void ssystem3_playfield_read(int *on, int *ready)
131132{
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;
135137}
136138
137139void ssystem3_via_write_a(ATTR_UNUSED running_machine *machine, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT8 data)
r2340r2341
144146{
145147  UINT8 data=0xff;
146148#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;
151153#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;
156158#endif
157159  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;
162164  }
163165  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;
168170  }
169171  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;
174176  }
175177  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;
180182  }
181183  //  logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data);
182184  return data;
src/mess/drivers/vtech1.c
r2340r2341
405405
406406static QUICKLOAD_LOAD( vtech1 )
407407{
408   UINT8 sw = readinputportbytag("CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
408   UINT8 sw = input_port_read(machine, "CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
409409   UINT16 exec_addr, start_addr, end_addr;
410410
411411   if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL)
src/mess/drivers/amstrad.c
r2340r2341
817817      // Analogue ports
818818      if(offset == 0x0808)
819819      {
820         return (readinputportbytag("analog1") & 0x3f);
820         return (input_port_read(machine, "analog1") & 0x3f);
821821      }
822822      if(offset == 0x0809)
823823      {
824         return (readinputportbytag("analog2") & 0x3f);
824         return (input_port_read(machine, "analog2") & 0x3f);
825825      }
826826      if(offset == 0x080a)
827827      {
828         return (readinputportbytag("analog3") & 0x3f);
828         return (input_port_read(machine, "analog3") & 0x3f);
829829      }
830830      if(offset == 0x080b)
831831      {
832         return (readinputportbytag("analog4") & 0x3f);
832         return (input_port_read(machine, "analog4") & 0x3f);
833833      }
834834      if(offset == 0x080c || offset == 0x080e)
835835      {
r2340r2341
12421242   m6845_personality_t crtc_type;
12431243   int page;
12441244
1245   crtc_type = readinputportbytag_safe("crtc", 0);
1245   crtc_type = input_port_read_safe(machine, "crtc", 0);
12461246   m6845_set_personality(crtc_type);
12471247
12481248   if(aleste_mode & 0x04)
r2340r2341
16031603{
16041604      if (multiface_ram!=NULL)
16051605      {
1606            if ((readinputportbytag("multiface") & 0x01)!=0)
1606            if ((input_port_read(Machine, "multiface") & 0x01)!=0)
16071607            {
16081608                  return 1;
16091609            }
r2340r2341
18261826
18271827static VIDEO_EOF( amstrad )
18281828{
1829   if (readinputportbytag_safe("multiface", 0) & 0x02)
1829   if (input_port_read_safe(machine, "multiface", 0) & 0x02)
18301830   {
18311831      multiface_stop(machine);
18321832   }
r2340r2341
18441844   amstrad_GateArray_write(machine, 0x0c0);
18451845
18461846  // Get manufacturer name and TV refresh rate from PCB link (dipswitch for mess emulation)
1847   ppi_port_inputs[amstrad_ppi_PortB] = (((readinputportbytag("solder_links")&MANUFACTURER_NAME)<<1) | (readinputportbytag("solder_links")&TV_REFRESH_RATE));
1847   ppi_port_inputs[amstrad_ppi_PortB] = (((input_port_read(machine, "solder_links")&MANUFACTURER_NAME)<<1) | (input_port_read(machine, "solder_links")&TV_REFRESH_RATE));
18481848
18491849   if(amstrad_system_type != SYSTEM_CPC)
18501850      memset(amstrad_plus_asic_ram,0,16384);  // clear ASIC RAM
r2340r2341
22832283
22842284      sprintf(port, "keyboard_row_%d", amstrad_read_keyboard_line);
22852285
2286      return (readinputportbytag(port) & 0xFF);
2286      return (input_port_read(machine, port) & 0xFF);
22872287   }
22882288}
22892289
src/mess/drivers/avigo.c
r2340r2341
184184   for (i=0; i<4; i++)
185185   {
186186      sprintf(port, "LINE%d", i);
187      current_input_port_data[i] = readinputportbytag(port);
187      current_input_port_data[i] = input_port_read(machine, port);
188188   }
189189
190190   changed = current_input_port_data[3]^previous_input_port_data[3];
r2340r2341
222222      previous_input_port_data[i] = current_input_port_data[i];
223223   }
224224
225   nx = readinputportbytag("POSX");
225   nx = input_port_read(machine, "POSX");
226226   if (nx>=0x800) nx-=0x1000;
227227   else if (nx<=-0x800) nx+=0x1000;
228228
229229   dx = nx - ox;
230230   ox = nx;
231231
232   ny = readinputportbytag("POSY");
232   ny = input_port_read(machine, "POSY");
233233   if (ny>=0x800) ny-=0x1000;
234234   else if (ny<=-0x800) ny+=0x1000;
235235
r2340r2341
424424   for (i=0; i<4; i++)
425425   {
426426      sprintf(port, "LINE%d", i);
427      previous_input_port_data[i] = readinputportbytag(port);
427      previous_input_port_data[i] = input_port_read(machine, port);
428428   }
429429
430430   avigo_irq = 0;
r2340r2341
480480
481481   if (avigo_key_line & 0x01)
482482   {
483      data &= readinputportbytag("LINE0");
483      data &= input_port_read(machine, "LINE0");
484484   }
485485
486486   if (avigo_key_line & 0x02)
487487   {
488      data &= readinputportbytag("LINE1");
488      data &= input_port_read(machine, "LINE1");
489489   }
490490
491491   if (avigo_key_line & 0x04)
492492   {
493      data &= readinputportbytag("LINE2");
493      data &= input_port_read(machine, "LINE2");
494494
495495   }
496496
src/mess/drivers/psx.c
r2340r2341
190190
191191static void psx_pad( int n_port, int n_data )
192192{
193   running_machine *machine = Machine;
193194   int b_sel;
194195   int b_clock;
195196   int b_data;
r2340r2341
283284         if( m_pad[ n_port ].n_byte < PAD_BYTES_STANDARD )
284285         {
285286            sprintf(port, "IN%d", m_pad[ n_port ].n_byte + ( n_port * PAD_BYTES_STANDARD ) );
286            m_pad[ n_port ].n_shiftout = readinputportbytag(port);
287            m_pad[ n_port ].n_shiftout = input_port_read(machine, port);
287288            m_pad[ n_port ].n_byte++;
288289            b_ack = 1;
289290         }
src/mess/drivers/tutor.c
r2340r2341
163163   char port[6];
164164
165165   sprintf(port, "LINE%d", offset);
166   return readinputportbytag(port);
166   return input_port_read(machine, port);
167167}
168168
169169static DEVICE_IMAGE_LOAD( tutor_cart )
src/mess/drivers/trs80.c
r2340r2341
9494
9595static READ8_HANDLER (trs80_wd179x_r)
9696{
97   if (readinputportbytag("CONFIG") & 0x80)
97   if (input_port_read(machine, "CONFIG") & 0x80)
9898   {
9999      return wd17xx_status_r(machine, offset);
100100   }
src/mess/drivers/svision.c
r2340r2341
5151   switch (svision_pet.state)
5252   {
5353      case 0:
54         svision_pet.input = readinputportbytag("JOY2");
54         svision_pet.input = input_port_read(machine, "JOY2");
5555         /* fall through */
5656
5757      case 2: case 4: case 6: case 8:
r2340r2341
9393   switch (offset)
9494   {
9595      case 0x20:
96         data = readinputportbytag("JOY");
96         data = input_port_read(machine, "JOY");
9797         break;
9898      case 0x21:
9999         data &= ~0xf;
src/mess/drivers/vc4000.c
r2340r2341
5555   UINT8 data=0;
5656   switch(offset & 0x0f) {
5757   case 0x08:
58      data = readinputportbytag("KEYPAD1_1");
58      data = input_port_read(machine, "KEYPAD1_1");
5959      break;
6060   case 0x09:
61      data = readinputportbytag("KEYPAD1_2");
61      data = input_port_read(machine, "KEYPAD1_2");
6262      break;
6363   case 0x0a:
64      data = readinputportbytag("KEYPAD1_3");
64      data = input_port_read(machine, "KEYPAD1_3");
6565      break;
6666   case 0x0b:
67      data = readinputportbytag("PANEL");
67      data = input_port_read(machine, "PANEL");
6868      break;
6969   case 0x0c:
70      data = readinputportbytag("KEYPAD2_1");
70      data = input_port_read(machine, "KEYPAD2_1");
7171      break;
7272   case 0x0d:
73      data = readinputportbytag("KEYPAD2_2");
73      data = input_port_read(machine, "KEYPAD2_2");
7474      break;
7575   case 0x0e:
76      data = readinputportbytag("KEYPAD2_3");
76      data = input_port_read(machine, "KEYPAD2_3");
7777      break;
7878   }
7979   return data;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team