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
- #define SWord $87FF
- #define Rword $86F8
- #define Sdat $8801
- #define Rdat $86FA
- ;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 GetS returns the send buffer flag
- .dw sflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tInvNorm ; invnorm
- .db %00000000
- .db 0 ;arguments
- .org $0000
- ld a,(SWord) ;put msb in l
- rlca ; rotate to bit one
- ld l,a ; load into l
- ld h,0 ; clear h
- sflag:
- ;2
- ;======= for future use when kerm makes cn2.3+ ======
- ;== ld a,(sizeword) \ cp $80 \ sbc hl,hl \ inc hl ==
- ;=============== does the same as ^v ================
- ;1 GetR
- .dw rflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, tTPDF ; tpdf
- .db %00000000
- .db 0
- .org 0
- ld a,(RWord) ;put msb in l
- rlca ; rotate to bit one
- ld l,a ; load into l
- ld h,0 ; clear h
- rflag:
- ;2
- ;1 SetS Sets the ok to send flag
- .dw ssflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $12 ; tCDF
- .db %00000000
- .db 0 ;arguments
- .org $0000
- ld hl,(SWord)
- set 7,(hl)
- ssflag:
- ;2
- ;1 ResS Resets the ok to send flag note i see no applicable use other than to change data if the data in the buffer was not sent in a reasonable time
- .dw rsflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $1d ;x2pdf
- .db %00000000
- .db 0
- .org 0
- ld hl,(SWord)
- res 7,(hl)
- rsflag:
- ;2
- ;1 SetR Sets the "you got data" flag, only applicable use is to block incoming messages
- .dw srflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $13 ; x2cdf
- .db %00000000
- .db 0 ;arguments
- .org $0000
- ld hl,(RWord)
- set 7,(hl)
- srflag:
- ;2
- ;1 ResR Resets the "You got data flag" Allows more data to come in
- .dw rrflag ;lable to thinger that states its the end
- .db %00001000
- .db t2ByteTok, $1E ;fpdf
- .db %00000000
- .db 0
- .org 0
- ld hl,(RWord)
- res 7,(hl)
- rrflag:
- ;2
- ;=============== 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 %00001000
- .db $BB, tDF ;tok
- .db %00000010
- .db 0
- .org 0
- p_GetKey:
- CALL cn2_GetK
- ld h,0
- ld l,a
- keyquit:
- ;2
- ;1
- .dw keyquit1 ;lable to thinger that states its the end
- .db %00001000
- .db $BB, tDF ;tok
- .db %00000000
- .db 0
- .org 0
- Cn2GetK_Sub:
- ld a,$ff ;
- out (1),a ;reset keyport
- ld e,$fe ;frist group
- ld c,$01 ;key port
- ld l,0 ;l holds key pressed
- cscloop:
- out (c),e ;set keygroup
- ld b,8 ;loop, Delay needed when work with key driver
- nop \ nop
- in a,(c) ;read key
- cscbit:
- inc l ;inc to get key pressed
- rra ; if key pressed done
- jr nc,donecsc
- djnz cscbit ;loop 8
- rlc e ;next key group
- jp m,cscloop ;if bit 7 set loop
- ld l,0 ;if no key pressed 0
- donecsc:
- ld a,l
- or a
- ld l,a
- ld h,0
- ret
- keyquit1:
- ;2
- .dw $0000
- ;1 TokenHooks
- .dw hNormalPDF
- .db 4
- .db "CnOn"
- .dw hDNormal
- .db 5
- .db "CnOff"
- .dw hInvNorm
- .db 4
- .db "GetR"
- .dw hInvT
- .db 7
- .db "TheGame"
- .dw hTPDF
- .db 4
- .db "GetS"
- .dw hDT ;tcdf
- .db 4
- .db "SetS"
- .dw hChiPDF
- .db 4
- .db "ResS"
- .dw hChI
- .db 4
- .db "SetR"
- .dw hFPDF
- .db 4
- .db "ResR"
- .dw HDF
- .db 5
- .db "CnKey"
- ;2
Advertisement
Add Comment
Please, Sign In to add comment