X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fanajoy.cpp;h=adab2c4ae32a85c1223232d1fdc234af6cdc9f43;hb=0031c06df2f7f099ca5ecf1632f46b92f6b0dd79;hp=9210817cb20a5025b95eecb88592905b816883b8;hpb=86bd0f2592c3cd674239532247276bd2d579a857;p=virtualjaguar diff --git a/src/anajoy.cpp b/src/anajoy.cpp index 9210817..adab2c4 100644 --- a/src/anajoy.cpp +++ b/src/anajoy.cpp @@ -1,73 +1,45 @@ +// +// Analog joystick handler +// +// by cal2 +// GCC/SDL port by Niels Wagenaar (Linux/WIN32) and Caz (BeOS) +// Cleanups by James L. Hammons +// + #include "jaguar.h" static uint8 anajoy_ram[2]; static uint8 analog_x, analog_y; -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + void anajoy_init(void) { anajoy_reset(); } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + void anajoy_reset(void) { memset(anajoy_ram,0x00,2); analog_x=128; analog_y=128; } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + void anajoy_done(void) { } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + void anajoy_byte_write(uint32 offset, uint8 data) { anajoy_ram[offset&0x01]=data; } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + void anajoy_word_write(uint32 offset, uint16 data) { offset&=0x01; anajoy_ram[offset+0]=(data>>8)&0xff; anajoy_ram[offset+1]=data&0xff; } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + uint8 anajoy_byte_read(uint32 offset) { if (anajoy_ram[1]&0x01) @@ -75,13 +47,7 @@ uint8 anajoy_byte_read(uint32 offset) else return(analog_x); } -////////////////////////////////////////////////////////////////////////////// -// -////////////////////////////////////////////////////////////////////////////// -// -// -// -////////////////////////////////////////////////////////////////////////////// + uint16 anajoy_word_read(uint32 offset) { uint16 data=anajoy_byte_read((offset+0)&0x01);