Zoinkity

VRU Commands

Aug 29th, 2016
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.53 KB | None | 0 0
  1. read 0x25 bytes of data from VRU addy
  2. 03.25.09xxxx.ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddcc
  3. send:
  4. x combination of value and address checksum
  5. FFE0 address
  6. 001F checksum
  7. recieve:
  8. d data (0x24)
  9. data is 16bit byteswapped
  10. c data checksum for d
  11. set to 0xFF on send
  12.  
  13. data breakdown:
  14. 0 4 unknown; J VRU always seems to report 80000F00
  15. 4 2 error flags
  16. 6 2 # valid results (?)
  17. 8 2 voice level from mic
  18. A 2 relative voice level
  19. C 2 voice length (prob. milliseconds)
  20. E 2 hit 1: index or 0x7FFF
  21. 10 2 hit 1: deviance value
  22. 12 2 hit 2: index or 0x7FFF
  23. 14 2 hit 2: deviance value
  24. 16 2 hit 3: index or 0x7FFF
  25. 18 2 hit 3: deviance value
  26. 1A 2 hit 4: index or 0x7FFF
  27. 1C 2 hit 4: deviance value
  28. 1E 2 hit 5: index or 0x7FFF
  29. 20 2 hit 5: deviance value
  30. 22 2 mode + status flags
  31. 23 1 data checksum
  32.  
  33. error flags appear to be (byteswapped):
  34. 0400 voice too low; any voice level below 0x96(?) appears to trigger this
  35. 0800 voice too high; any voice level over 0xDAC(?) appears to trigger this
  36. 4000 no valid matches; I think this means the deviation for all results is greater than the default 0x640 seen in software, since can report match results anyway.
  37. 8000 too much noise; relative voice level below 0x190(?) appears to trigger this
  38.  
  39. Example results: 03.25.090000.80000F0000000100F3037609600400004B0303000204070079040400C904FF7F2907400098
  40.  
  41. write 0x14 bytes of data to VRU addy
  42. 17.01.0Axxxxdddddddddddddddddddddddddddddddddddddddd.cc
  43. send:
  44. x combination of value and address checksum
  45. FFE0 address
  46. 001F checksum
  47. d data (0x14)
  48. data should be 16bit byteswapped, aligned right (so NULLs to the left but strings reading left->right, byteswapped.)
  49. recieve:
  50. c data checksum for d
  51. set to 0xFF on send
  52.  
  53. J str data pattern is:
  54. ----0300 0000dddd dddddddd dddddddd dddddddd dddddddd dddddddd dddddddd dddddddd ddddff00
  55. Max length to send is 0x20, aligned to right side of buffer (0x26 - len(data)) and preceeded by 3. Data is 16bit LE. Flag indicates status after sending command. There must be a NULL between the 0003 cmd and the string.
  56. Regardless, address always appears to be 0.
  57.  
  58. Except for ー only Katakana and Hiragana may be used.
  59. Invalid as first char: ーんっゎンッヮヵヶ
  60. ぁ can only follow ふフヴ
  61. ァ can only follow ふフヴ
  62. ぃ can only follow うてでふウテデフヴ
  63. ィ can only follow うてでふウテデフヴ
  64. ぅ can only follow とどふトドフヴ
  65. ゥ can only follow とどふトドフヴ
  66. ぇ can only follow うしえちぢつふウシジチヂツフヴ
  67. ェ can only follow うしえちぢつふウシジチヂツフヴ
  68. ぉ can only follow うふウフヴ
  69. ォ can only follow うふウフヴ
  70. ゃ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  71. ゅ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  72. ょ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  73. ャ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  74. ュ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  75. ョ can only follow きしちにひみりぎじぢびぴキシチニヒミリギジヂビピヴ
  76. ー cannot follow きっンッ
  77. ん and ン cannot repeat (んん or ンン)
  78. っ can only follow ーあいうえおなにぬねのまみむめもやゆよらりるれろわゐゑをんぁぃぅぇぉゃゅょっゎアイウエオナニヌネノマミムメモヤユヨラリルレロワヰヱヲンァィゥェォャュョッヮ
  79. ッ can only follow ーあいうえおなにぬねのまみむめもやゆよらりるれろわゐゑをんぁぃぅぇぉゃゅょっゎアイウエオナニヌネノマミムメモヤユヨラリルレロワヰヱヲンァィゥェォャュョッヮ
  80. Example: 17.01.0A00000000000000000000000003000000E482AB820000.08
  81.  
  82. Also used to send the string mask patterns. Data is right-aligned and padded with zeroes to an even length, followed with command 0004. Set bits allow strings, unset ignores.
  83. Example sending 0x66: 17.01.0A00000000000000000000000000000000000004006600.31
  84.  
  85. read 2 bytes from VRU addy: read mode and status
  86. 03.03.0Bxxxx.ddddcc
  87. send:
  88. x combination of value and address checksum
  89. FFE0 address
  90. 001F checksum
  91. recieve:
  92. d VRU status & mode
  93. FF00 ???; returns error 5 when set
  94. 0200 ???; returns error 0xE or 5 when set (same error as bad wchar)
  95. 0100 ???; returns error 0xD or 5 when set
  96. 0040 ???; returns error 0xF when set
  97. 0007 mode
  98. c data checksum for d
  99. set to 0xFF on send
  100.  
  101. write 4 bytes to VRU addy: send mode, status, and argument
  102. 07.01.0Cxxxxdddddddd.cc
  103. send:
  104. x combination of value and address checksum
  105. FFE0 address
  106. 001F checksum
  107. d mode & argument (4 bytes, byteswapped)
  108. 0007 0000 mode
  109. 0000 FFFF argument
  110. recieve:
  111. c data checksum for d
  112. set to 0xFF on send
  113.  
  114. Address always appears to be 0.
  115.  
  116. Initialize VRU hardware at address
  117. 03.01.0Dxxxx.ff
  118. send:
  119. x combination of value and address checksum
  120. FFE0 address
  121. 001F checksum
  122. recieve:
  123. f error flags
  124. set to 0 on send
  125.  
  126. Note they use a table of address: (0xF0, 0x370, 0x40, 0x2B0, 0x18); saved internally as (1E, 6E, 08, 56, 03) to avoid bitshifting.
  127. Each is sent in-sequence, assuming nothing goes wrong.
  128.  
  129. Device type reports 0100. Controller pak Inserted/Not Present appear to be set by the device at various points.
  130.  
  131. Step 1: detect if a VRU is attached
  132. send SI Status commands. Device type is 0x100.
  133. reinit software flags
  134. On initial connect:
  135. check status
  136. send SI Status cmd
  137. return Err 1 after four retests if Not Present flag
  138. return Err 0xB after four retests if not a VRU (device type != 0x100)
  139. return Err 4 if IO Error flag
  140. return Err 4 if addy crc error
  141. send SI cmd 0xFD to channel
  142. return Err 4 on failure
  143. send SI cmd 0xD: 0F0
  144. if flag (cmd[5]) & 1, retest up to four times
  145. return Err 1 if Not Present, IO Error, or error retesting device status
  146. return Err 4 after four retests if flag & 1
  147. send SI cmd 0xD: 370
  148. ditto
  149. send SI cmd 0xD: 040
  150. ditto
  151. send SI cmd 0xD: 2B0
  152. ditto
  153. send SI cmd 0xD: 018
  154. ditto
  155. check status
  156. ditto
  157. return 0xF if Slot Empty flag
  158. send SI cmd 0xC: 000 00000100
  159. return Err 1 if Not Present, IO Error, or error retesting device status
  160. return Err 4 if data crc mismatch after four retests
  161. read VRU state
  162. check status
  163. ditto
  164. return Err 0xF if Slot Filled flag
  165. state = send SI cmd 0xB: 000
  166. return Err 1 if Not Present or IO Error
  167. return Err 4 if data crc mismatch after four retests
  168. return Err 0xF if state & 0x40
  169. return Err 5 if state & 0xFF00
  170. Otherwise you're good to go!
  171.  
  172. USA initialization slightly different.
  173. After sending 0xFD commands, wait until Count advances 0x23C346.
  174. check status
  175. state = send SI cmd 0xB: 000
  176. save status read by 0xB command to a register for comparison later. Looks like 0100 flag indicates USA.
  177. continue as normal
  178.  
  179. Step 2: send strings (J)
  180. if state in (1, 3, 5):
  181. check status
  182. ditto
  183. return Err 0xF if Slot Empty flag
  184. return 5 if mode == 0
  185. send SI cmd 0xC: 000 00000700
  186. ditto
  187. [presumes no error; if one occurs loads uninitialized value off stack]
  188. retest 20 times
  189. read VRU state
  190. ditto
  191. mode = 0 if state & 0xFF00
  192. mode = 0, return 0 if (state & 7) == 0
  193. return Err 5 if (state & 7) == 7
  194. return Err state if state != 0xF
  195. return Err 0x10 if all retests fail
  196. check status
  197. ditto
  198. return Err 0xF if Slot Empty flag
  199. send SI cmd 0xC: 000 0200##00 # number of strings
  200. ditto
  201. read VRU state
  202. ditto
  203. return Err 5 state & 0xFF00
  204. for i in strings:
  205. return Err 0xE if string unusable
  206. check status
  207. ditto
  208. return Err 0xF if Slot Empty flag
  209. byteswap i
  210. buf[0:0x26 - len(i)] = repeat(0, 0x26 - len(i))
  211. buf[0x26-len(i):] = i
  212. buf[0x22-len(i)] = 3
  213. if len(i) > 0xE:
  214. send SI cmd 0xA: 000 buf[:0x14]
  215. return Err 1 if Not Present or IO Error
  216. return Err 4 if data crc mismatch after four retests
  217. send SI cmd 0xA: 000 buf[0x14:0x28]
  218. ditto
  219. read VRU state
  220. ditto
  221. return Err 0xD if state & 0x100
  222. return Err 0xE if state & 0x200
  223. return Err 5 if state & 0xFF00
  224. check status
  225. ditto
  226. return Err 0xF if Slot Empty flag
  227. l = len(data) + (len(data) & 1)
  228. if len(data) & 1:
  229. data.append(0)
  230. byteswap data
  231. buf[0x12 - l] = 4
  232. buf[0x14-l:] = data
  233. send SI cmd 0xA: 000 buf[:0x14]
  234. ditto
  235. return Err 5 if state & 0xFF00
  236.  
  237. Step 3: fetching results
  238. uh...
  239. ???
  240. profit!
Advertisement
Add Comment
Please, Sign In to add comment