2 // Analog joystick handler
5 // GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS)
6 // Cleanups by James L. Hammons
8 // Is it even necessary anymore to have this? According to the JTRM, these ports
9 // aren't even wired up in later models and I can't think of one game that used
10 // them. Maybe it's time to retire this?
14 static uint8 anajoy_ram[2];
15 static uint8 analog_x, analog_y;
18 void anajoy_init(void)
23 void anajoy_reset(void)
25 memset(anajoy_ram,0x00,2);
30 void anajoy_done(void)
34 void anajoy_byte_write(uint32 offset, uint8 data)
36 anajoy_ram[offset&0x01]=data;
39 void anajoy_word_write(uint32 offset, uint16 data)
42 anajoy_ram[offset+0]=(data>>8)&0xff;
43 anajoy_ram[offset+1]=data&0xff;
46 uint8 anajoy_byte_read(uint32 offset)
48 if (anajoy_ram[1]&0x01)
54 uint16 anajoy_word_read(uint32 offset)
56 uint16 data=anajoy_byte_read((offset+0)&0x01);
58 data|=anajoy_byte_read((offset+1)&0x01);