Given this from your linked page ...
Code:
<A><-------B------> <C->
0000 0000 0000 0000 0000 0000 0000
^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^ ^
|||| |||| |||| |||| |||| | |
|||| |||| |||| |||| |||| | +----- Uses Windows CE
|||| |||| |||| |||| |||| |
|||| |||| |||| |||| |||| +----- VGA box support
|||| |||| |||| |||| ||||
|||| |||| |||| |||| |||+----- Other expansions
|||| |||| |||| |||| ||+----- Puru Puru pack
|||| |||| |||| |||| |+----- Mike device
|||| |||| |||| |||| +----- Memory card
|||| |||| |||| |||+------ Start + A + B + Directions
|||| |||| |||| ||+------ C button
|||| |||| |||| |+------ D button
|||| |||| |||| +------ X button
|||| |||| |||+------- Y button
|||| |||| ||+------- Z button
|||| |||| |+------- Expanded direction buttons
|||| |||| +------- Analog R trigger
|||| |||+-------- Analog L trigger
|||| ||+-------- Analog horizontal controller
|||| |+-------- Analog vertical controller
|||| +-------- Expanded analog horizontal
|||+--------- Expanded analog vertical
||+--------- Gun
|+--------- Keyboard
+--------- Mouse
This is roughage just to give an idea... it is 100% untested...
Code:
typedef union tBits
{ unsigned long Peripherals;
unsigned long Other : 1,
Puru : 1,
Mike : 1,
Card : 1,
SAB : 1,
Cbtn : 1,
Dbtn : 1,
Xbtn : 1,
Ybtn : 1,
Zbtn : 1,
EBtn : 1,
ART : 1,
ALT : 1 ,
AHC : 1,
AVC : 1,
EAH : 1,
EAV : 1,
Gun : 1,
Kbd : 1,
Mse : 1; } BITS, *pBITS;
BITS bs;
BS.Peripherals = Peripherals[0];
If (bs.Kbd)
puts("Well lookie there");
The union should allow you to write in a DWord and read it as bits...