Geekboy

Untitled

Feb 11th, 2012
226
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.  #define 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. moveitlikeaboss:
  73. ;2
  74.  
  75. ;========== General purpose commands
  76. ;1 RecvF(0/1) sets recieve buffer flag to 0/1
  77. .dw recvframeprocessed          ;lable to thinger that states its the end
  78. .db %00001000
  79. .db t2ByteTok, tInvNorm ;tok
  80. .db %00000000        
  81. .db 1       ;arguments
  82. .org $0000
  83.  ld de,($86f8) ; load de with sizeword thinger
  84.  bit 0,l     ;
  85.  jp nz,_      ; set it else
  86.  res 7,d     ; reset msb
  87.  jp ++_
  88. _:
  89.  set 7,d
  90. _:
  91.  ld ($86f8),de
  92. recvframeprocessed:
  93. ;2
  94.  
  95. ;1 RecvFR          returns the size of the recived frame
  96. .dw recvframesize         ;lable to thinger that states its the end
  97. .db %00001000
  98. .db t2ByteTok, tInvNorm  ;tok
  99. .db %00000010         ; uses r
  100. .db 0
  101. .org 0
  102.  ld hl,($86f8)
  103.  ld h,0
  104. recvframesize:
  105. ;2
  106.  
  107. ;1 RecvFRR         returns a pointer to the adress of the id
  108. .dw recvframeid         ;lable to thinger that states its the end
  109. .db %00001000
  110. .db t2ByteTok, tInvNorm  ;tok
  111. .db %00000100         ; uses rr
  112. .db 0
  113. .org 0
  114.  ld hl,$86f3
  115. recvframeid:
  116. ;2
  117.  
  118. ;1 SendF(0/1)            ;sets the send buffer flag to 0/1
  119. .dw sendframeprocessed          ;lable to thinger that states its the end
  120. .db %00001000
  121. .db t2ByteTok, $12  ;tok
  122. .db %00000000        
  123. .db 1       ;arguments
  124. .org $0000
  125.  ld de,($87ff) ; load de with sizeword thinger
  126.  bit 0,l     ; if it is two
  127.  jp nz,_      ; set it else
  128.  res 7,d     ; reset msb
  129.  jp ++_
  130. _:
  131.  set 7,d
  132. _:
  133. ld ($87ff),de
  134. sendframeprocessed:
  135. ;2
  136.  
  137. ;1 SendF(lengthof data)r       sets the length of the data to be sent
  138.  
  139. .dw sizesend          ;lable to thinger that states its the end
  140. .db %00001000
  141. .db t2ByteTok, $12  ;tok
  142. .db %00000010         ; uses r
  143. .db 1       ;arguments
  144. .org $0000
  145.  ld h,$80
  146.  ld ($87FF),hl
  147. sizesend:
  148. ;2
  149.  
  150. ;1 SendF(ptr2ID)RR
  151. .dw sendframeid         ;lable to thinger that states its the end
  152. .db %00001000
  153. .db t2ByteTok, $12 ;tok
  154. .db %00000100         ; uses rr
  155. .db 1
  156. .org 0
  157.  ld de,$87fa
  158.  ld bc,5
  159.  ldir
  160. sendframeid:
  161. ;2
  162.  
  163. ;1 RBuff     returns a pointer to the recieve buffer
  164. .dw recvbufff         ;lable to thinger that states its the end
  165. .db %00001000
  166. .db t2ByteTok, tTPDF  ;tok
  167. .db %00000000
  168. .db 0
  169. .org 0
  170.  ld hl,$86f8
  171. recvbufff:
  172.  
  173. ;2
  174.  
  175. ;1 RbuffR   returns current value in the size word
  176. .dw Rbuffs         ;lable to thinger that states its the end
  177. .db %00001000
  178. .db $BB,$1D  ;tok
  179. .db %00000010    ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
  180. .db 0
  181. .org 0
  182.  ld hl,($87ff)
  183.  ld h,0
  184. Rbuffs:
  185.  
  186. ;2
  187.  
  188. ;1 RBuffRR     clears the recive buffer
  189. .dw clearrbuff         ;lable to thinger that states its the end
  190. .db %00001001
  191. .db t2ByteTok,tTPDF  ;tok
  192. .db %00000100        ; uses rR
  193. .db 0
  194. .org 0
  195.  ld de,$86fb
  196.  ld hl,$86fa
  197.  ld (hl),0
  198.  ld bc,255
  199.  ldir
  200. clearrbuff:
  201. ;2
  202.  
  203. ;1 SBuff    returns a pointer to the send buffer
  204. .dw sendbufff         ;lable to thinger that states its the end
  205. .db %00001000
  206. .db $BB,$1D  ;tok
  207. .db %00000000
  208. .db 0
  209. .org 0
  210.  ld hl,$8801
  211. sendbufff:
  212. ;2
  213.  
  214. ;1 SbuffR   returns current value in the size word
  215. .dw sbuffs         ;lable to thinger that states its the end
  216. .db %00001000
  217. .db $BB,$1D  ;tok
  218. .db %00000010    ; need r
  219. .db 0
  220. .org 0
  221.  ld hl,($86f8)
  222.  ld h,0
  223. sbuffs:
  224.  
  225. ;2
  226. ;1 SBuffRR   clears the send buffer
  227. .dw clearsbuff         ;lable to thinger that states its the end
  228. .db %00001001
  229. .db $BB,$1D  ;tok
  230. .db %00000100    ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
  231. .db 0
  232. .org 0
  233.  ld de,$8802
  234.  ld hl,$8801
  235.  ld (hl),0
  236.  ld bc,255
  237.  ldir
  238. clearsbuff:
  239. ;2
  240.  
  241.  
  242.  
  243.  
  244.  
  245. ;=============== Key Routine need this cause well axe uses getcsc which is a nono with calcnet ==========
  246. ;============================ already debounces will add smooth input later =============================
  247.  
  248. ;1
  249. .dw keyquit         ;lable to thinger that states its the end
  250. .db %00001001
  251. .db $BB, tChI  ;tok
  252. .db %00000000  
  253. .db 0
  254. .org 0
  255. p_GetKey:
  256.     CALL cn2_GetK
  257.     ld  h,0
  258.     ld  l,a
  259. keyquit:
  260. ;2
  261. .dw $0000
  262.  
  263. ;1 TokenHooks
  264. .dw hNormalPDF
  265. .db 4
  266. .db "CnOn"
  267.  
  268. .dw hDNormal
  269. .db 4
  270. .db "CnOn"
  271.  
  272. .dw hInvNorm
  273. .db 5
  274. .db "RecvF"
  275.  
  276.  
  277. .dw hInvT
  278. .db 7
  279. .db "TheGame"
  280.  
  281.  
  282. .dw hTPDF
  283. .db 5
  284. .db "RBuff"
  285.  
  286. .dw hDT
  287. .db 5
  288. .db "SendF"
  289.  
  290. .dw "hChI"
  291. .db 5
  292. .db "CnKey"
  293.  
  294.  
  295. ;2
Advertisement
Add Comment
Please, Sign In to add comment