;Demo routines include "settings.inc" include "ti83plus.inc" include "equates.inc" SEGMENT Main GLOBALS ON EXTERN IPutC,PutSApp EXTERN ExitApp,DoDemos,StartApp EXTERN InitializeBluetooth,ACL_SendData,HCI_Disconnect,HCI_CreateConnection,ACL_RequestData,KillBluetooth EXTERN ACL_IsDataAvailable EXTERN ptrConnectionHandle EXTERN DoDeviceSelection EXTERN sGenericError EXTERN sHelloWorld DoChatDemo: B_CALL ClrLCDFull B_CALL HomeUp call InitializeBluetooth jr c,ErrDemo ld ix,saveSScreen+128 ld hl,tempSwapArea call DoDeviceSelection jr c,DoDemos ;DoDeviceSelection throws its own errors cp kQuit jr z,ExitApp ;if they hit [2nd]+[QUIT], get out now or a jr nz,DoDemos ;if they pressed anything else, go back to the demos menu ;IX contains the inquiry result block push ix B_CALL ClrLCDFull B_CALL HomeUp pop ix ld hl,saveSScreen+512 ld (ptrConnectionHandle),hl ld de,0018h call HCI_CreateConnection jr c,ErrDemo ld hl,saveSScreen ld d,0 call ACL_RequestData chatLoop: call ACL_IsDataAvailable jr z,$F ld hl,saveSScreen+4 ld a,(hl) call IPutC ld hl,saveSScreen ld d,0 call ACL_RequestData $$: ei halt B_CALL GetCSC cp sk2nd jr z,chatLoopDone or a jr z,chatLoop cp skMode jr z,$F ld hl,OP3 ld (hl),'A' ld bc,1 jr chatSend $$: ld hl,sHelloWorld ld de,OP3 ld bc,11 push de push bc ldir pop bc pop hl chatSend: ld ix,(ptrConnectionHandle) call ACL_SendData jr c,ErrDemo jr chatLoop chatLoopDone: ld ix,(ptrConnectionHandle) ld b,0 ;disconnect reason...I don't know what this can really be call HCI_Disconnect jr c,ErrDemo call KillBluetooth jr DoDemos DoSendFileDemo: DoReceiveFileDemo: DoKeyboardDemo: DoMouseDemo: jr ExitApp ErrDemo: in a,(4) bit 3,a jr z,ErrDemo ;debounce ON key call KillBluetooth res onInterrupt,(iy+onFlags) xor a ld (kbdKey),a ld (kbdScanCode),a B_CALL ClrLCDFull B_CALL HomeUp ld hl,sGenericError call PutSApp B_CALL GetKey jr DoDemos