Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;#######################################################################;
- ; ___ ___ ___ __ ______ .___ ___. ______. ;
- ; / \ \ \ / / | | / __ \ | \/ | / | ;
- ; / ^ \ \ ' / | | | | | | | \ / | | (---` ;
- ; / /_\ \ > < | | | | | | | |\/| | \ \ ;
- ; / _____ \ / . \ | | | `--' | | | | | .---) | ;
- ; /__/ \__\ /__/ \__\ |__| \______/ |__| |__| |______/ ;
- ; ;
- ; The Assembly SDK for Axe programmers ;
- ; By Kevin Horowitz ;
- ; Last revision: 1.1.2 ;
- ; ;
- ; This template will make it easy to implement real assembly commands ;
- ;into Axe Parser so that they can be used just like the native commands ;
- ;that come with the App. ;
- ; ;
- ;#######################################################################;
- ;###################
- ;# Library header #
- ;###################
- ;You should include "Axe.inc" in your axiom because it contains a lot of useful
- ;definitions to aid in Axiom development. If you're using token replacements,
- ;you should also include "TokenHook.inc".
- #include "ti83plus.inc"
- #include "Axe.inc"
- #include "TokenHook.inc"
- #define Cn2_Setup $4209
- #define Cn2_Clear_SendBuf $420C
- #define Cn2_Clear_RecBuf $420F
- #define Cn2_Setdown $4212
- #define Cn2_GetK $4221
- ;All Axioms must start with $DE,$C0:
- .dw $C0DE
- ;1 CnOn is init calcnet and returns the pointer to your calc id
- .dw initend ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tNormalPDF ;tok
- .db %00000000
- .db 0 ;arguments
- .org $0000
- call Cn2_Setup
- ld hl,$86EE
- initend:
- ;2
- ;1 CnOff takes it down
- .dw teardown ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tDNormal ;tok
- .db %00000000
- .db 0 ;arguments
- .org $0000
- call cn2_setdown
- teardown:
- ;2
- ;1 CnONr sets it up and moves stuff around in memory
- .dw moveitlikeaboss ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tNormalPDF ;tok
- .db %00000010 ; uses r
- .db 0 ;arguments
- .org $0000
- ld hl,$86EE
- moveitlikeaboss:
- ;2
- ;========== General purpose commands
- ;1 RecvF(0/1) sets recieve buffer flag to 0/1
- .dw recvframeprocessed ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tInvNorm ;tok
- .db %00000000
- .db 1 ;arguments
- .org $0000
- ld de,($86f8) ; load de with sizeword thinger
- bit 0,l ;
- jp nz,_ ; set it else
- res 7,d ; reset msb
- jp ++_
- _:
- set 7,d
- _:
- ld ($86f8),de
- recvframeprocessed:
- ;2
- ;1 RecvFR returns the size of the recived frame
- .dw recvframesize ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tInvNorm ;tok
- .db %00000010 ; uses r
- .db 0
- .org 0
- ld hl,($86f8)
- ld h,0
- recvframesize:
- ;2
- ;1 RecvFRR returns a pointer to the adress of the id
- .dw recvframeid ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tInvNorm ;tok
- .db %00000100 ; uses rr
- .db 0
- .org 0
- ld hl,$86f3
- recvframeid:
- ;2
- ;1 SendF(0/1) ;sets the send buffer flag to 0/1
- .dw sendframeprocessed ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $12 ;tok
- .db %00000000
- .db 1 ;arguments
- .org $0000
- ld de,($87ff) ; load de with sizeword thinger
- bit 0,l ; if it is two
- jp nz,_ ; set it else
- res 7,d ; reset msb
- jp ++_
- _:
- set 7,d
- _:
- ld ($87ff),de
- sendframeprocessed:
- ;2
- ;1 SendF(lengthof data)r sets the length of the data to be sent
- .dw sizesend ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $12 ;tok
- .db %00000010 ; uses r
- .db 1 ;arguments
- .org $0000
- ld h,$80
- ld ($87FF),hl
- sizesend:
- ;2
- ;1 SendF(ptr2ID)RR
- .dw sendframeid ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $12 ;tok
- .db %00000100 ; uses rr
- .db 1
- .org 0
- ld de,$87fa
- ld bc,5
- ldir
- sendframeid:
- ;2
- ;1 RBuff returns a pointer to the recieve buffer
- .dw recvbufff ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tTPDF ;tok
- .db %00000000
- .db 0
- .org 0
- ld hl,$86f8
- recvbufff:
- ;2
- ;1 RbuffR returns current value in the size word
- .dw Rbuffs ;lable to thinger that states its the end
- .db %00001000
- .db $BB,$1D ;tok
- .db %00000010 ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
- .db 0
- .org 0
- ld hl,($87ff)
- ld h,0
- Rbuffs:
- ;2
- ;1 RBuffRR clears the recive buffer
- .dw clearrbuff ;lable to thinger that states its the end
- .db %00001001
- .db t2ByteTok,tTPDF ;tok
- .db %00000100 ; uses rR
- .db 0
- .org 0
- ld de,$86fb
- ld hl,$86fa
- ld (hl),0
- ld bc,255
- ldir
- clearrbuff:
- ;2
- ;1 SBuff returns a pointer to the send buffer
- .dw sendbufff ;lable to thinger that states its the end
- .db %00001000
- .db $BB,$1D ;tok
- .db %00000000
- .db 0
- .org 0
- ld hl,$8801
- sendbufff:
- ;2
- ;1 SbuffR returns current value in the size word
- .dw sbuffs ;lable to thinger that states its the end
- .db %00001000
- .db $BB,$1D ;tok
- .db %00000010 ; need r
- .db 0
- .org 0
- ld hl,($86f8)
- ld h,0
- sbuffs:
- ;2
- ;1 SBuffRR clears the send buffer
- .dw clearsbuff ;lable to thinger that states its the end
- .db %00001001
- .db $BB,$1D ;tok
- .db %00000100 ; YAR HAR HAR FIDDLE DEEE DEE WE HAZ A RR
- .db 0
- .org 0
- ld de,$8802
- ld hl,$8801
- ld (hl),0
- ld bc,255
- ldir
- clearsbuff:
- ;2
- ;1 CheckF(0/1)
- .dw Fpros ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tChiPDF ;tok
- .db %00000000
- .db 1 ;arguments
- .org $0000
- bit 0,l
- jr z,_
- ld de,($86f8)
- jr ++_
- _:
- ld de,($87ff)
- _:
- ld l,d
- rlc d
- Fpros:
- ;=============== Key Routine need this cause well axe uses getcsc which is a nono with calcnet ==========
- ;============================ already debounces will add smooth input later =============================
- ;1
- .dw keyquit ;lable to thinger that states its the end
- .db %00001001
- .db $BB, tChI ;tok
- .db %00000000
- .db 0
- .org 0
- p_GetKey:
- CALL cn2_GetK
- ld h,0
- ld l,a
- keyquit:
- ;2
- .dw $0000
- ;1 TokenHooks
- .dw hNormalPDF
- .db 4
- .db "CnOn"
- .dw hDNormal
- .db 5
- .db "CnOff"
- .dw hInvNorm
- .db 5
- .db "RecvF"
- .dw hInvT
- .db 7
- .db "TheGame"
- .dw hTPDF
- .db 5
- .db "RBuff"
- .dw hDT
- .db 5
- .db "SendF"
- .dw hChiPDF
- .db 6
- .db "CheckF"
- .dw hChI
- .db 5
- .db "CnKey"
- ;2
Advertisement
Add Comment
Please, Sign In to add comment