It stands for "dominant position". Both 01 and 11 are handled by the same flow. The bit that is different between them is checked later on:LoneKiltedNinja wrote:01b = position [...]
11b = “D. POSITION” (unknown term)
Code: Select all
SetPosition:
JSR GADB
IFBIT 1,[B] ; Is this a vector dominant gesture ?
JP VDTYPE ; (absolute only) (??)
JP NG6
; Vector dominant position:
; Gesture can only BECOME true if the vector is the largest
; of the three vectors (X, Y, Z), AND the gesture is currently false.
; If vector is NOT dominant, it will not become true.
;
VDTYPE:
LD A,[X] ; Check this gesture's vector (X, Y or Z)
AND A,#03 ; Mask unneeded bits
IFNE A,DOMVEC ; Does the vector type match the dominant one ?
JMP NextGesture ; Do nothing if no match.
NG6:
JMP SetGestureHere's what positive and negative mean:LoneKiltedNinja wrote:positively matched (PTRUE) [...] not yet evaluated (RFALSE) [...] definitively nonmatched (NTRUE)
Code: Select all
forward up
-z +y
_
|\ ^
\|
left <--+--> right
-x |\ +x
v _|
backward
down +z
-yA relative position gesture always takes two gesture positions. This gesture test is always testing both the positive and negative directions of the requested axis. So you always get results for both up AND down, or right AND left, or backward AND forward. (The first position contains the relative gesture definition and returns the "positive" result bit. The second position contains the no-op code and returns the "negative" result bit.) PTRUE means only the positive direction was true. NTRUE means only the negative direction was true. RFALSE means the entire relative gesture was false.
The logic parsing source code is difficult to understand. As an alternative for now, I'm examining what the indented logic steps look like in NGL.EXE to help imply what the logic parsing in the glove does.LoneKiltedNinja wrote:From here (line 2506), things begin to get crazy, appearing (as nocash surmised) to be a whole metalanguage of “logic statements,” “indent states,” truth tables, processes, etc.,
I'm using DOSBox and running NGL.EXE inside of it. Here's a guide to NGL.EXE: ngl.txt
Here are the basic steps to investigate the logic indentation:
Press Alt+L to go to the Logic page.
Press Left or Right to change lines on the right side of the page.
Press Plus or Minus to change logic items.
If a gesture is needed, press Up or Down to highlight it on the left side and Enter to choose it.
If an action is needed, press Enter to cycle through the actions.
Press Page Up to refresh the indentation on the first page or return back to the first page.
Press Page Down to go to the second page or refresh the indentation on the second page.
I looked around the code again. I think the gesture definitions are evaluated the same way in both the "glove" mode and the "joystick" mode. As you say, the $0800 gesture will always return false. (It's checking the middle finger, but with no flex bits set to check, it will always return false.) However, when you start the "glove" mode, it looks like you could send other multiple gestures, and the the 7th and 8th bytes of the return packet will be a bit field of the gesture results.LoneKiltedNinja wrote:The only mystery is whether the single 0x0800 entry present in the gesture block of the “raw mode” packet is anything more significant than a vacuous middle finger.
Here is the place in PG.MAC that defines the addresses sent in the return packet:
Code: Select all
IATABLE: ;(allow space here for 16 values)
.BYTE XABS
.BYTE YABS
.BYTE ZABS
.BYTE ROTATION
.BYTE FLEXMAP
.BYTE SWR0H
.BYTE GSTAT1
.BYTE GSTAT2
.BYTE RVALID
Here are various lines from PGMEM.INC that describe these addresses
Code: Select all
XABS = 00C ; Current horizontal position
YABS = 00E ; Current vertical position
ZABS = 010 ; Distance from screen
ROTATION = 012 ; 0 - 12 (new in LSN, old in MSN)
FLEXMAP = 02C ; 2 Bit flex current positions
SWR0H = 0F6 ; History - last switch code
GSTAT1 = 0F0 ; Gesture status map 16 bits
GSTAT2 = 0F1
RVALID = 05F ; Used only in glove modeFrom PG.MAC:LoneKiltedNinja wrote:Parsing then proceeds to a “Gesture logic” (line 2499) statement parser/processor which begins with a check of bit 7 of (presumably) what we’ve been calling the 8-bit section header, aborting back to the main loop if true (meaning the “extra 6 bytes” nocash observed are doubly confusing…)
Code: Select all
LOGIC:
IFBIT 7,TEMPLATE ; Is this a glove mode program ?
JMP MAINLOOP ; Return from COMPUTE subroutineAbout the "extra 6 bytes"...
When using the glove, there are seperate turbo settings for A and B that you can enable or disable and change the speed for. If the program template you load only needs to send normal button presses, it will be set up to obey any turbo settings you had specified. (The button presses are specified to use turbo, but with no turbo settings defined in the program, it will use whatever you had set up.)nocash's everynes.htm wrote:Finally, "PROGRAM E" has EXTRA SIX BYTES after the 8bit opcode area (indicated in bit7 of the 8bit Area's header). The bytes there are 00h,00h,00h,00h,57h,57h, purpose is unknown.
However, some of the template programs have a repeated button press as one of the outputs. In this case, the template loads its own turbo settings. In these programs, the normal button presses are hard coded as normal button presses, and the repeated button presses use the program-specified turbo settings.
In the templates shown in PGTEMPL.INC or when you export a template in NGL.EXE, the high bit of the logic header indicates two bytes of turbo information will follow the logic. Based on exports from NGL.EXE, the format of each turbo byte is like this:
Code: Select all
-e-rrrrr
e = enabled
rrrrr = rate 0 to 31
Edit: I looked at the code further to make sure I could back up the claim that Program E's "extra 6" should only be an "extra 2" and discovered I may be wrong.
When a template is loaded from ROM, the high bit of the logic header means there are 2 turbo bytes after the logic. The code checks for this and stores the turbo bytes in the proper places. (In PG.MAC, see LoadATemplate: and XTRA:) But when a template is sent from the NES, I couldn't find any code that checks the high bit of the logic header and stores the turbo bytes in the proper places.
It looks like the template is stored in address $30 and can be up to $30 bytes in size. And the turbo bytes are stored right after that in $60 and $61.
Various lines from PGMEM.INC:
Code: Select all
TEMPLATE = 030 ; 48 bytes_________
TEMPSIZE = 030 ; Template size
PUL1RATE = 060 ; pulse rate and mode
PUL2RATE = 061Edit 2: Here are Program E's transmission bytes from nocash's post earlier in this thread:
Code: Select all
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