Good work & very interesting! But... you haven't examined the existing power glove games yet? When looking at how they are accessing the glove, some details can be figured out easily - and some things are getting ways more complicated.
---- TRANSMIT (INIT/CONFIG) ----
Transmission is started by outputting a long high level.
The chart at
http://i49.tinypic.com/ff1hd0.jpg does have it preceeded by a short high-level & four clk pulses - I can't see the existing games doing that, so I think that that part is total nonsense... Can you try accessing the glove with that part removed?
After that long high level, the first transferred byte indicates the number of following bytes. In your example, that would be 06h, and then followed by 6 other bytes. But in other packets, the length value can (at least) range from 05h to 32h.
In Super Glove Ball, the packet transfer function is at DC94h, with incoming packet number (00h or 01h) in lower 7bit of A register. The corresponding packets defined in ROM are:
Code:
super_glove_ball_tx_packet_00h:
db 06,C1,08,00,02,FF,01
super_glove_ball_tx_packet_01h:
db 2E,49,01,38,01,3C,01,A1,01,7D,20,08,10,0C,01,83
db 01,07,01,3E,1A,19,81,82,70,23,84,14,83,70,27,58
db 98,28,82,70,81,70,21,81,12,82,15,A7,16,88,87
Normally, the game seems to be using packet 00h only. I haven't spotted a place where it sends packet 01h, maybe it doesn't ever use it at all.
In Bad Street Brawler, the transfer function is at E696h, with packet number (00h..0Ch) in X register. The corresponding packets defined in ROM are:
Code:
brawler_tx_packet_00h:
db 2D,49,01,38,01,3C,01,A1,01,7D,20,08,08,0C,02,83
db 02,07,01,3E,19,19,81,82,73,23,84,14,83,77,27,58
db 98,28,82,C1,76,21,81,12,82,15,A7,16,88,87
brawler_tx_packet_01h:
db 13,64,48,0E,50,08,44,0C,20,0C,09,11,84,72,22,82
db 13,81,14,83
brawler_tx_packet_02h:
db 19,64,10,0C,20,0C,02,94,41,3A,0F,14,B0,13,87,10
db 21,52,88,84,60,70,21,88,12,84
brawler_tx_packet_03h:
db 25,67,60,0C,01,28,01,2C,1D,18,00,00,08,0C,10,0C
db 15,11,2E,82,C1,72,22,44,91,2E,89,FE,33,45,92,2E
db BE,66,16,98,17,A7
brawler_tx_packet_04h:
db 12,64,02,B7,02,71,10,03,41,3A,08,11,82,12,81,13
db A7,14,88
brawler_tx_packet_05h:
db 23,67,01,34,01,30,01,31,01,35,20,0C,10,0C,44,0C
db 13,15,98,16,A7,11,52,53,54,21,81,12,82,13,83,14
db 84,67,77,80
brawler_tx_packet_06h:
db 32,69,04,0C,01,28,01,2C,1D,18,00,00,01,41,01,45
db 20,0C,42,84,98,B0,19,87,16,84,17,83,11,20,88,2F
db 82,C1,BF,62,70,22,44,81,33,45,82,18,98,00,00,00
db 00,57,57
brawler_tx_packet_07h:
db 14,65,01,B1,01,B5,01,B4,01,B0,50,0C,08,15,84,8B
db 11,52,54,53,88
brawler_tx_packet_08h:
db 21,68,10,0E,02,60,02,48,01,80,01,84,01,26,01,22
db 64,18,0F,18,70,24,81,15,82,16,84,17,83,11,23,97
db 12,98
brawler_tx_packet_09h:
db 23,67,01,34,01,30,01,31,01,35,20,0C,10,0C,44,0C
db 13,15,98,16,A7,11,52,53,54,21,82,12,81,13,84,14
db 83,67,77,80
brawler_tx_packet_0Ah:
db 1A,66,01,26,10,0C,01,25,20,0C,02,71,02,06,0C,11
db 87,12,84,13,83,14,88,15,81,16,82
brawler_tx_packet_0Bh:
db 16,65,20,0C,10,0C,08,0E,04,0C,01,1E,0A,11,93,12
db 92,13,94,14,91,15,88
brawler_tx_packet_0Ch:
db 05,41,20,0F,01,89
When played via joypad, the game supports two actions via joypad A and B buttons per level. Something like PUNCH and KICK in one level, and whatever... SEX and ROCK'n'ROLL in another level.
So, one guess: maybe the above packets are defining different gestures for that actions.
EDIT: After reading the power glove manual:
The glove BIOS has 14 built-in "programs", numbered 1-14 (for games like Bubble Bobble and Castlevania). The Bad Street Bawler game cartridge has 9 extra "programs", named A-I (for games like Gyruss and Gunsmoke). So, nine of the above 13 packets are apparently used for that purpose.
---- RECEIVE ----
I haven't discovered a "read packet" procedure in Bad Street Brawler yet. It does have a read-byte function at D836h, and it's calling that function in several places. But it's hard to tell if those calls are intended to read glove data or joypad data.
If the game is actually using "gestures handled inside of the glove" then it might simply receive data in form of "gesture flags" (rather than receiving lower-level position and rotation info).
Super Glove Ball is having a very straight read packet function at DCDCh, works like so:
Read 1 byte from glove in EVERY frame. This bytes indicates if the glove is ready to send data. 5Fh (or A0h, if you've XORed it by FFh) indicates ready. If so, the function reads 9 further bytes.
The details about variable conversion time are interesting (and good to know about them!), but with that "ready" byte, one fortunately doesn't need to care about them too much in practice.
Counting the ready-byte plus following 9 data bytes... then... one would read 10 bytes in total. Well. Obviously.
So far, I've no idea where that "12 byte" idea came from. No, stop! I got it. Look at the
http://i49.tinypic.com/ff1hd0.jpg chart:
Code:
The headline says 12 bytes, for now, trust that.
The actual diagram shows only 10 bytes, that's a bug.
To fix that: Assume two extra bytes after "byte 8".
Now you have 10 continous bytes. Plus, two final bytes (both preceeded by a long delays) - that are the "not-ready" bytes for the NEXT packet.
So, actually, the 2 ending FFh bytes in 12-byte packets aren't part of that packets, they are only 10-byte long.
And the ready and not-ready values are...
Code:
5Fh (or A0h, when XORed by FFh) --> ready
00h? (or FFh?, when XORed by FFh) --> not ready
Is that correct? Or is it vice-versa for "not ready"?
Ie. FFh (or 00h, when XORed)?
---- GENERAL STUFF/QUESTIONS ----
Now, are there 3 or 4 flex sensors? Does somebody else have a glove, and could run the ROM-image from LoneKiltedNinja's test program on a NES?
That way it should be very easy to see if the thing does react to flexing a fourth finger, or if it doesn't.
Did somebody ever disassemble the glove hardware? I haven't found any schematics, nor photos of the various PCBs anywhere.
Well, except for a few pics of modded gloves... but they aren't showing the complete PCBs, and for the visible parts... it's hard to say how the PCB originally looked like before modding.
Photos & component list would be interesting. The BIOS is probably contained in some on-chip ROM in the CPU. But you never now, maybe it's on a separate EPROM with a "dump-me" sticker on top of it.
From your readme.rtf at
http://www.psychsoftware.org/portfolio/ ... html#Other :
> rotation (clock-hour position minus 1; 0-11)
Ah, but elsewhere you've said that 0 is up? With the "minus one", 0 would mean turned by 30 degrees? Is that correct? Or did you mean something like "modulo 12" instead of "minus 1"?
And, it isn't clear to me where the rotation occurs - around which axis?
Probably difficult to get that clearly described... by assigning a a X,Y,Z coordinate system to the hand... or, probably better: to the TV-set.
For the power glove's rotation part... wikipedia is linking to a page that shows yaw, pitch, and roll of an airplane as an example. But, I am almost sure that only the speakers & microphones are involved... not airplanes!
NB. where exactly are those 2 speakers located in the glove?