linkport.txt 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. TI89 AMS203
  2. $5C58 : (0088) circular byte buffer (used for link transmit buffer)
  3. +0000.W : buffer tail (insert byte at [buffer+tail])
  4. +0002.W : buffer head (read byte from [buffer+head])
  5. +0004.W : size of buffer (default: 0080)
  6. +0006.W : number of bytes currently stored in buffer
  7. +0008 : circular buffer
  8. $5CE0 : (0088) circular byte buffer (used for link receive buffer)
  9. +0000.W : buffer tail (insert byte at [buffer+tail])
  10. +0002.W : buffer head (read byte from [buffer+head])
  11. +0004.W : size of buffer (default: 0080)
  12. +0006.W : number of bytes currently stored in buffer
  13. +0008 : circular buffer
  14. $5D68 : set to FF when link buffers are flushed ?? link reset'ed ?
  15. $5D69 : set to FF upon entering link ISR, set to 00 upon exiting (re-entrancy flag, link activity ?)
  16. $5D6A : buffer full and char lost ?
  17. $5D6B :
  18. $5D6C :
  19. $5D6D :
  20. $5D6E : used to save the int mask between trap 1 calls
  21. $7A00 : MID = Machine ID (packet structure ?)
  22. $7A01 : CID = Command ID
  23. 22245A: used to allow only irq > 5
  24. 222466: used to restore intmask
  25. 1°) AI4 handler
  26. @IA4_handler
  27. 222180: ; save context
  28. 222184: ; $ff when entering ISR
  29. 222188: ; ctrl reg -> A1
  30. 22218e: ; rx/tx reg -> A2
  31. 222194: ; a0 = &rx buf
  32. 22219a: ; if(#bytes < buffer size)
  33. 22219e: ;
  34. 2221a2: ; then process
  35. 2221a4: ; else, 1 -> $5d6a
  36. 2221aa: ; goto ISR end
  37. @lbl001 ; check for irq cause
  38. 2221ae: ; read ctrl reg
  39. 2221b0: ; if SA=1 (autostart)
  40. 2221b4: ; then goto end
  41. 2221b8: ; if SLE=1 (error)
  42. 2221bc: ; then reset linkport
  43. 2221c0: ; if SRX=0 (rx reg full)
  44. 2221c4: ; then goto tx routine
  45. ; RX routine
  46. 2221c6: ; else get char from rx reg
  47. 2221c8: ; #bytes++
  48. 2221cc: ; rxbuf[tail] = char
  49. 2221ce: ;
  50. 2221d2: ; tail++
  51. 2221d4: ; if(tail < bufsize)
  52. 2221d8: ; then jump
  53. 2221da: ; else, roll-up tail to 0
  54. @lbl002
  55. 2221dc: ; and store it
  56. 2221de: ; goto end
  57. @lbl003 ;TX routine
  58. 2221e2: ; if TXIE=0
  59. 2221e6: ; then goto end (no char to transmit)
  60. 2221ea: ; else a0 = &tx_buf
  61. @lbl004
  62. 2221f0: ; if no (more) char in tx_buf ?
  63. 2221f4: ; then exit
  64. 2221f6: ; else, read ctrl reg
  65. 2221f8: ; if STX=0
  66. 2221fc: ; then exit (last char)
  67. 2221fe: ; else char = txbuf[head]
  68. 222202: ;
  69. @lbl005 ; wait for char transmission
  70. 222206: ; read ctrl reg
  71. 222208: ; if SLE=1 (link error)
  72. 22220c: ; then reset link
  73. 22220e: ; if STX=0 (tx empty)
  74. 222212: ; then loop (wait for char to be transmitted)
  75. 222214: ; write char into tx reg
  76. 222216: ; #bytes--
  77. 22221a: ; head++
  78. 22221c: ; if head >= buf size
  79. 222220: ;
  80. 222222: ; then roll-up head to 0
  81. 222224: ; and store
  82. 222228: ; re-loop for next byte
  83. 222228: ; ????
  84. @lbl006
  85. 22222a: ; disable TX interrupt (no more bytes to send)
  86. @lbl007 ; end of ISR
  87. 222232: ; $00 when exiting ISR
  88. 222236: ; restore context
  89. 22223a: ; exit ISR
  90. @lbl008 ; reset link port
  91. 22223c: ; reset link port (AE,LD,LTO=1)
  92. 222244: ; AE,CLE,CAIE,CRW=1
  93. 22224c: ; $ff
  94. 222250: ; exit
  95. 2°) void OSLinkReset(void)
  96. @OSLinkReset:
  97. 222252: ; wait for 20 ms
  98. 222256: ;
  99. 22225a: ; disable ints
  100. 22225e: ; read ctrl reg
  101. 222264: ; disable ints and link
  102. 22226c: ; red/white wire = 0
  103. 222274: ;
  104. 22227c: ; wait for 100 us
  105. 222280: ;
  106. 222284: ; D1/tip/red = 1
  107. 22228c: ; D1/ring/white = 1
  108. 222294: ; wait for 100 us
  109. 222298: ;
  110. 22229c: ; clear MID
  111. 2222a0: ; ??
  112. 3°) void OSLinkOpen(void);
  113. @OSLinkOpen
  114. 2c1360: ; jump to ??
  115. @lbl013
  116. 2c1362: ; if OsTimer #2 not expired
  117. 2c1366: ;
  118. 2c136c: ;
  119. 2c136e: ;
  120. 2c1370: ; then skip
  121. 2c1372: ; else calc off
  122. 2c1378: ;
  123. 2c137c: ;and restart timer
  124. 2c1382: ;
  125. @lbl012
  126. 2c1384: ; get bytes in tx buf
  127. 2c138a: ; if #bytes=0
  128. 2c138c: ; then
  129. 2c138e: ; else if link flushed ??
  130. 2c1392: ; then ??
  131. 2c1394: ; else ig ??
  132. 2c1398: ; then ??
  133. @lbl013
  134. 2c139a: ;
  135. 2c139e: ; release timer for what ?
  136. 2c13a4: ;
  137. 2c13a4: ;
  138. 2c13a6: ; clear buffers
  139. 2c13ac: ; end
  140. 4°) void OSLinkClose (void);
  141. @OSLinkClose
  142. 2222a2: ; a0 = &tx_buf
  143. 2222a8: ; if nbytes=0
  144. 2222ac: ; then ??
  145. 2222ae: ; if =1 (link port reset'ed due to error)
  146. 2222b2: ; then ??
  147. 2222b4: ; if =0
  148. 2222b8: ; then loop
  149. @lbl009
  150. 2222ba: ; ?
  151. 2222be: ; ?
  152. 2222c2: ;
  153. 2222c4: ; disable ints
  154. 2222c8: ; $ff
  155. @lbl010
  156. 2222cc: ;
  157. 2222ce: ; clear some vars
  158. 2222d2: ;
  159. 2222d2: ;
  160. 2222d6: ;
  161. 2222da: ;
  162. 2222de: ; a0 = &tx_buf
  163. 2222e4: ; clear tx_buf
  164. 2222e8: ; a0 = &rx_buf
  165. 2222ee: ; clear rx_buf
  166. 2222f2: ; init ctrl reg
  167. 2222fa: ; restore ints
  168. 2222fe: ;
  169. 2222f2: ; init ctrl reg
  170. 2222fa: ; restore ints
  171. 2222fe: ;
  172. 222300: ;
  173. 222302: ; end
  174. @lbl0011 ;clear buffer
  175. 222304: ; tail = 0
  176. 222306: ; head = 0
  177. 222308: ; buf size = 128
  178. 22230c: ; nbytes = 0
  179. 22230e: ;
  180. 5°) unsigned short OSLinkTxQueueInquire (void);
  181. @OSLinkTxQueueInquire
  182. 222310: ; disable ints
  183. 222314: ; a0 = @tx_buf
  184. 22231a: ; get # of free bytes in buffer
  185. 22231e: ;
  186. 222322: ; return it on stack frame
  187. 222324: ; restore ints
  188. 222328: ;
  189. 22232a: ; end
  190. @OSLinkTxQueueInq2
  191. 22232c: ; disable ints
  192. 22232c: ; disable ints
  193. 222330: ; a0 = @tx_buf
  194. 222336: ; return #bytes in buffer
  195. 22233a: ; restore ints
  196. 22233e: ; d0 = #bytes
  197. 222340: ;
  198. 6°) short OSLinkTxQueueActive (void);
  199. @OSLinkTxQueueActive
  200. 222342: ; disable ints
  201. 222346: ; return 0
  202. 222348: ; if CTX=0 (no transmission is in progress)
  203. 222350: ; then return FALSE
  204. 222350: ;
  205. 222354: ; else return TRUE
  206. 222356: ;
  207. 222358: ; restore ints
  208. 22235c: ;
  209. 22235e: ; end
  210. 9°) short OSWriteLinkBlock (const char *buffer, unsigned short num);
  211. @OSWriteLinkBlock
  212. 222360: ; disable ints
  213. 222364: ; get vars from stack frame (a0 = buffer, d0 = num)
  214. 222368: ;
  215. 22236c: ;
  216. 222370: ;
  217. 222372: ;
  218. 222374: ; return -1
  219. 222376: ; check there are no more than 128 bytes
  220. 22237a: ; return -1
  221. 22237c: ; a1 = #bytes in tx buf
  222. 22237c: ;
  223. 222382: ;
  224. 222386: ; #bytes += num
  225. 222388: ;
  226. 22238c: ; return -1
  227. 22238e: ; if CTX=1 (TX IE)
  228. 222396: ; then do nothing
  229. 222398: ; else enable TX interrupt (is this raises interrupt ?)
  230. 2223a0: ; copy bytes into tx buffer
  231. 2223a2: ;
  232. 2223a4: ;
  233. 2223a8: ;
  234. 2223ac: ;
  235. 2223ae: ;
  236. 2223b2: ;
  237. 2223b4: ;
  238. 2223b6: ; loop to copy num bytes
  239. 2223ba: ;
  240. 2223bc: ; restore ints
  241. 2223bc: ;
  242. 2223c0: ; return 0
  243. 2223c2: ;
  244. 2223c6: ; end
  245. 2223c8: ;
  246. 2223ca: ;
  247. 2223cc: ;
  248. 2223ce: ;
  249. 2223d0: ;
  250. 2223d2: ;
  251. 2223d6: ; return -1
  252. 2223d8: ;
  253. 2223d8: ;
  254. @OSReadLinkBlock
  255. 2223da: ;
  256. 2223de: ;
  257. 2223e2: ;
  258. 2223e6: ;
  259. 2223ea: ;
  260. 2223ec: ;
  261. 2223f2: ;
  262. 2223f6: ;
  263. 2223f8: ;
  264. 2223fc: ;
  265. 222400: ;
  266. 222402: ;
  267. 222404: ;
  268. 222408: ;
  269. 22240a: ;
  270. 22240c: ;
  271. 222410: ;
  272. 222412: ;
  273. 222412: ;
  274. 222416: ;
  275. 222418: ;
  276. 22241c: ;
  277. 222422: ; if SA=1 (autostart)
  278. 222426: ; then ...
  279. 222428: ; if SLE=0 (error)
  280. 22242c: ; then
  281. 22242e: ; else reset linkport
  282. 222436: ;
  283. 222436: ;
  284. 22243e: ;
  285. 222442: ;
  286. 222446: ;
  287. 222448: ;
  288. 22244a: ;
  289. 22244e: ;
  290. 222452: ;
  291. 222454: ;
  292. 222458: ;
  293. 7°) short OSCheckSilentLink (void);
  294. @OSCheckSilentLink
  295. 2bf314: ;
  296. 2bf316: ;
  297. 2bf318: ; check var
  298. 2bf31c: ; return ?
  299. 2bf320: ; check var
  300. 2bf324: ;
  301. 2bf326: ; return ?
  302. @
  303. 2bf32a: ; check var ?
  304. 2bf32e: ;
  305. 2bf330: ; close link
  306. 2bf330: ; ??
  307. 2bf336: ;
  308. 2bf338: ; clear MID
  309. @
  310. 2bf33c: ;
  311. 2bf33e: ; D3 contains the Command ID
  312. 2bf342: ;
  313. 2bf344: ;
  314. 2bf348: ; TI92_PC
  315. 2bf34e: ;
  316. 2bf350: ; TI92p_PC
  317. 2bf350: ; V200_PC
  318. 2bf356: ;
  319. 2bf358: ; TI89_PC, TI89t_PC
  320. 2bf35e: ;
  321. 2bf360: ; PC_TI89, PC_TI89t, PC_TI92p, PC_V200
  322. 2bf366: ;
  323. 2bf368: ; PC_TI92
  324. 2bf36e: ;
  325. 2bf370: ; CMD_FLSH (flash os/app)
  326. 2bf374: ;
  327. 2bf374: ;
  328. 2bf376: ; CMD_RDY (ready)
  329. 2bf37a: ;
  330. 2bf37c: ;
  331. 2bf37e: ;
  332. 2bf380: ; ??
  333. 2bf386: ;
  334. 2bf388: ; ??
  335. 2bf38e: ;
  336. 2bf390: ; CMD_SCR (screenshot)
  337. 2bf390: ;
  338. 2bf394: ;
  339. 2bf396: ;
  340. 2bf398: ; CMD_FLSH
  341. 2bf39c: ;
  342. 2bf39e: ;
  343. 2bf3a0: ; CMD_VAR (variable header)
  344. 2bf3a4: ;
  345. 2bf3a6: ;
  346. 2bf3a8: ; CMD_RDY
  347. 2bf3a8: ; CMD_RDY
  348. 2bf3ac: ;
  349. 2bf3ae: ;
  350. 2bf3b0: ; CMD_REQ (requets variable)
  351. 2bf3b4: ;
  352. 2bf3b6: ;
  353. 2bf3b8: ; CMD_KEY (remote control)
  354. 2bf3bc: ;
  355. 2bf3be: ;
  356. 2bf3c0: ; CMD_IND (var index)
  357. 2bf3c0: ;
  358. 2bf3c4: ;
  359. 2bf3c6: ;
  360. 2bf3c8: ; CMD_RTS (requets to send)
  361. 2bf3cc: ;
  362. 2bf3ce: ;
  363. 2bf3d0: ;
  364. 2bf3d2: ;
  365. 2bf3d4: ;
  366. 2bf3d6: ;
  367. 2bf3d6: ;
  368. 2bf3d8: ;
  369. 2bf3da: ;
  370. 2bf3dc: ;
  371. 2bf3e2: ;
  372. 2bf3e4: ;
  373. 2bf3e6: ;
  374. 2bf3ea: ; return ?
  375. 2bf3ec: ;
  376. 2bf3ee: ;
  377. 2bf3ee: ;
  378. 2bf3f0: ;
  379. 2bf3f2: ;
  380. 2bf3f4: ;
  381. 2bf3f8: ;
  382. 2bf3fc: ;
  383. 2bf3fe: ;
  384. 2bf400: ;
  385. 2bf404: ;
  386. 2bf40a: ;
  387. 2bf40a: ;
  388. 2bf40c: ;
  389. @
  390. 2bf40e: ; return 0
  391. 2bf410: ;
  392. 2bf412: ;
  393. 2bf414: ; end
  394. 8°) void OSLinkCmd (short NormalState);
  395. @OSLinkCmd
  396. 2bf416: ;
  397. 2bf41a: ;
  398. 2bf420: ;
  399. 2bf424: ;