Geekboy

Untitled

Feb 12th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;#######################################################################;
  2. ;       ___      ___   ___  __    ______   .___  ___.     ______.       ;
  3. ;      /   \     \  \ /  / |  |  /  __  \  |   \/   |    /      |       ;
  4. ;     /  ^  \     \  '  /  |  | |  |  |  | |  \  /  |   |   (---`       ;
  5. ;    /  /_\  \     >   <   |  | |  |  |  | |  |\/|  |    \   \          ;
  6. ;   /  _____  \   /  .  \  |  | |  `--'  | |  |  |  | .---)   |         ;
  7. ;  /__/     \__\ /__/ \__\ |__|  \______/  |__|  |__| |______/          ;
  8. ;                                                                       ;
  9. ;                The Assembly SDK for Axe programmers                   ;
  10. ;                         By Kevin Horowitz                             ;
  11. ;                       Last revision:  1.1.2                           ;
  12. ;                                                                       ;
  13. ;  This template will make it easy to implement real assembly commands  ;
  14. ;into Axe Parser so that they can be used just like the native commands ;
  15. ;that come with the App.                                                ;
  16. ;                                                                       ;
  17. ;#######################################################################;
  18.  
  19. ;###################
  20. ;#  Library header #
  21. ;###################
  22.  
  23. ;You should include "Axe.inc" in your axiom because it contains a lot of useful
  24. ;definitions to aid in Axiom development.  If you're using token replacements,
  25. ;you should also include "TokenHook.inc".
  26. #include "ti83plus.inc"
  27. #include "Axe.inc"
  28. #include "TokenHook.inc"
  29.  
  30. #define  Cn2_Setup         $4209
  31. #define  Cn2_Clear_SendBuf  $420C
  32. #define  Cn2_Clear_RecBuf   $420F
  33. #define Cn2_Setdown        $4212
  34. #define Cn2_GetK           $4221
  35.  
  36. ;All Axioms must start with $DE,$C0:
  37. .dw $C0DE
  38.  
  39. ;1 CnOn is init calcnet and returns the pointer to your calc id
  40.  
  41. .dw initend          ;lable to thinger that states its the end
  42. .db %00001000
  43. .db t2ByteTok, tNormalPDF  ;tok
  44. .db %00000000
  45. .db 0       ;arguments
  46.  
  47.  
  48. .org $0000
  49.  call Cn2_Setup
  50.  ld hl,$86EE
  51. initend:
  52. ;2
  53.  
  54. ;1 CnOff takes it down
  55. .dw teardown          ;lable to thinger that states its the end
  56. .db %00001000
  57. .db t2ByteTok, tDNormal  ;tok
  58. .db %00000000        
  59. .db 0       ;arguments
  60. .org $0000
  61.  call cn2_setdown
  62. teardown:
  63. ;2
  64.  
  65. ;1 CnONr sets it up and moves stuff around in memory
  66. .dw moveitlikeaboss          ;lable to thinger that states its the end
  67. .db %00001000
  68. .db t2ByteTok, tNormalPDF  ;tok
  69. .db %00000010         ; uses r
  70. .db 0       ;arguments
  71. .org $0000
  72.  ld hl,$86EE
  73. moveitlikeaboss:
  74. ;2
  75.  
  76. ;========== General purpose commands
  77. ;1 RecvF(0/1) sets recieve buffer flag to 0/1
  78. .dw recvframeprocessed          ;lable to thinger that states its the end
  79. .db %00001000
  80. .db t2ByteTok, tInvNorm ;tok
  81. .db %00000000        
  82. .db 1       ;arguments
  83. .org $0000
  84.  ld de,($86f8) ; load de with sizeword thinger
  85.  bit 0,l     ;
  86.  jp nz,_      ; set it else
  87.  res 7,d     ; reset msb
  88.  jp ++_
  89. _:
  90.  set 7,d
  91. _:
  92.  ld ($86f8),de
  93. recvframeprocessed:
  94. ;2
  95.  
  96. ;1 RecvFR          returns the size of the recived frame
  97. .dw recvframesize         ;lable to thinger that states its the end
  98. .db %00001000
  99. .db t2ByteTok, tInvNorm  ;tok
  100. .db %00000010         ; uses r
  101. .db 0
  102. .org 0
  103.  ld hl,($86f8)
  104.  ld h,0
  105. recvframesize:
  106. ;2
  107.  
  108. ;1 RecvFRR         returns a pointer to the adress of the id
  109. .dw recvframeid         ;lable to thinger that states its the end
  110. .db %00001000
  111. .db t2ByteTok, tInvNorm  ;tok
  112. .db %00000100         ; uses rr
  113. .db 0
  114. .org 0
  115.  ld hl,$86f3
  116. recvframeid:
  117. ;2
  118.  
  119. ;1 SendF(0/1)            ;sets the send buffer flag to 0/1
  120. .dw sendframeprocessed          ;lable to thinger that states its the end
  121. .db %00001000
  122. .db t2ByteTok, $12  ;tok
  123. .db %00000000        
  124. .db 1       ;arguments
  125. .org $0000
  126.  ld de,($87ff) ; load de with sizeword thinger
  127.  bit 0,l     ; if it is two
  128.  jp nz,_      ; set it else
  129.  res 7,d     ; reset msb
  130.  jp ++_
  131. _:
  132.  set 7,d
  133. _:
  134. ld ($87ff),de
  135. sendframeprocessed:
  136. ;2
  137.  
  138. ;1 SendF(lengthof data)r       sets the length of the data to be sent
  139.  
  140. .dw sizesend          ;lable to thinger that states its the end
  141. .db %00001000
  142. .db t2ByteTok, $12  ;tok
  143. .db %00000010         ; uses r
  144. .db 1       ;arguments
  145. .org $0000
  146.  ld h,$80
  147.  ld ($87FF),hl
  148. sizesend:
  149. ;2
  150.  
  151. ;1 SendF(ptr2ID)RR
  152. .dw sendframeid         ;lable to thinger that states its the end
  153. .db %00001000
  154. .db t2ByteTok, $12 ;tok
  155. .db %00000100         ; uses rr
  156. .db 1
  157. .org 0
  158.  ld de,$87fa
  159.  ld bc,5
  160.  ldir
  161. sendframeid:
  162. ;2
  163.  
  164. ;1 RBuff     returns a pointer to the recieve buffer
  165. .dw recvbufff         ;lable to thinger that states its the end
  166. .db %00001000
  167. .db t2ByteTok, tTPDF  ;tok
  168. .db %00000000
  169. .db 0
  170. .org 0
  171.  ld hl,$86f8
  172. recvbufff:
  173.  
  174. ;2
  175.  
  176. ;1 RbuffR   returns current value in the size word
  177. .dw Rbuffs         ;lable to thinger that states its the end
  178. .db %00001000
  179. .db $BB,$1D  ;tok
  180. .db %00000010    ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
  181. .db 0
  182. .org 0
  183.  ld hl,($87ff)
  184.  ld h,0
  185. Rbuffs:
  186.  
  187. ;2
  188.  
  189. ;1 RBuffRR     clears the recive buffer
  190. .dw clearrbuff         ;lable to thinger that states its the end
  191. .db %00001001
  192. .db t2ByteTok,tTPDF  ;tok
  193. .db %00000100        ; uses rR
  194. .db 0
  195. .org 0
  196.  ld de,$86fb
  197.  ld hl,$86fa
  198.  ld (hl),0
  199.  ld bc,255
  200.  ldir
  201. clearrbuff:
  202. ;2
  203.  
  204. ;1 SBuff    returns a pointer to the send buffer
  205. .dw sendbufff         ;lable to thinger that states its the end
  206. .db %00001000
  207. .db $BB,$1D  ;tok
  208. .db %00000000
  209. .db 0
  210. .org 0
  211.  ld hl,$8801
  212. sendbufff:
  213. ;2
  214.  
  215. ;1 SbuffR   returns current value in the size word
  216. .dw sbuffs         ;lable to thinger that states its the end
  217. .db %00001000
  218. .db $BB,$1D  ;tok
  219. .db %00000010    ; need r
  220. .db 0
  221. .org 0
  222.  ld hl,($86f8)
  223.  ld h,0
  224. sbuffs:
  225.  
  226. ;2
  227. ;1 SBuffRR   clears the send buffer
  228. .dw clearsbuff         ;lable to thinger that states its the end
  229. .db %00001001
  230. .db $BB,$1D  ;tok
  231. .db %00000100    ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
  232. .db 0
  233. .org 0
  234.  ld de,$8802
  235.  ld hl,$8801
  236.  ld (hl),0
  237.  ld bc,255
  238.  ldir
  239. clearsbuff:
  240. ;2
  241.  
  242. ;1 CheckF(0/1)
  243. .dw Fpros          ;lable to thinger that states its the end
  244. .db %00001000
  245. .db t2ByteTok, tChiPDF ;tok
  246. .db %00000000        
  247. .db 1       ;arguments
  248. .org $0000
  249.  bit 0,l
  250.  jr z,_
  251.  ld de,($86f8)
  252.  jr ++_
  253. _:
  254.  ld de,($87ff)
  255. _:
  256.  ld l,d
  257.  rlc d
  258. Fpros:
  259.  
  260.  
  261.  
  262. ;=============== Key Routine need this cause well axe uses getcsc which is a nono with calcnet ==========
  263. ;============================ already debounces will add smooth input later =============================
  264.  
  265. ;1
  266. .dw keyquit         ;lable to thinger that states its the end
  267. .db %00001001
  268. .db $BB, tChI  ;tok
  269. .db %00000000  
  270. .db 0
  271. .org 0
  272. p_GetKey:
  273.     CALL cn2_GetK
  274.     ld  h,0
  275.     ld  l,a
  276. keyquit:
  277. ;2
  278. .dw $0000
  279.  
  280. ;1 TokenHooks
  281. .dw hNormalPDF
  282. .db 4
  283. .db "CnOn"
  284.  
  285. .dw hDNormal
  286. .db 5
  287. .db "CnOff"
  288.  
  289. .dw hInvNorm
  290. .db 5
  291. .db "RecvF"
  292.  
  293.  
  294. .dw hInvT
  295. .db 7
  296. .db "TheGame"
  297.  
  298.  
  299. .dw hTPDF
  300. .db 5
  301. .db "RBuff"
  302.  
  303. .dw hDT
  304. .db 5
  305. .db "SendF"
  306.  
  307. .dw hChiPDF
  308. .db 6
  309. .db "CheckF"
  310.  
  311. .dw hChI
  312. .db 5
  313. .db "CnKey"
  314.  
  315.  
  316. ;2
Advertisement
Add Comment
Please, Sign In to add comment