3 static uint8 anajoy_ram[2];
4 static uint8 analog_x, analog_y;
6 //////////////////////////////////////////////////////////////////////////////
8 //////////////////////////////////////////////////////////////////////////////
12 //////////////////////////////////////////////////////////////////////////////
13 void anajoy_init(void)
17 //////////////////////////////////////////////////////////////////////////////
19 //////////////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////////
24 void anajoy_reset(void)
26 memset(anajoy_ram,0x00,2);
30 //////////////////////////////////////////////////////////////////////////////
32 //////////////////////////////////////////////////////////////////////////////
36 //////////////////////////////////////////////////////////////////////////////
37 void anajoy_done(void)
40 //////////////////////////////////////////////////////////////////////////////
42 //////////////////////////////////////////////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////////
47 void anajoy_byte_write(uint32 offset, uint8 data)
49 anajoy_ram[offset&0x01]=data;
51 //////////////////////////////////////////////////////////////////////////////
53 //////////////////////////////////////////////////////////////////////////////
57 //////////////////////////////////////////////////////////////////////////////
58 void anajoy_word_write(uint32 offset, uint16 data)
61 anajoy_ram[offset+0]=(data>>8)&0xff;
62 anajoy_ram[offset+1]=data&0xff;
64 //////////////////////////////////////////////////////////////////////////////
66 //////////////////////////////////////////////////////////////////////////////
70 //////////////////////////////////////////////////////////////////////////////
71 uint8 anajoy_byte_read(uint32 offset)
73 if (anajoy_ram[1]&0x01)
78 //////////////////////////////////////////////////////////////////////////////
80 //////////////////////////////////////////////////////////////////////////////
84 //////////////////////////////////////////////////////////////////////////////
85 uint16 anajoy_word_read(uint32 offset)
87 uint16 data=anajoy_byte_read((offset+0)&0x01);
89 data|=anajoy_byte_read((offset+1)&0x01);