;ACL data packet send/receive routines include "settings.inc" include "ti83plus.inc" include "equates.inc" include "usb8x.inc" include "bluetooth.inc" SEGMENT Main GLOBALS ON EXTERN DispHexHL ACL_SendData: ;Sends a block of ACL data. ;Inputs: ; IX points to connection handle structure ; HL points to data to send ; BC is the number of bytes to send ; D is the RAM/Flash page to read from (or 0 if from RAM pages 81h/80h) ;Outputs: ; Data sent to remote device specified by connection handle ; Returns carry flag set if problems push hl ld e,(ix+0) ld a,(ix+1) and 00001111b or 20h ;only "first fragment" packets for now ld d,a ld hl,appData ld (hl),e inc hl ld (hl),d inc hl ld (hl),c inc hl ld (hl),b inc hl ex de,hl pop hl push bc ldir pop bc ld b,c inc b inc b inc b inc b ld hl,appData ld a,(dataOutPipe) ld c,a U_CALL SendData ret c xor a ret ACL_RequestData: ;Requests incoming ACL data. ;Inputs: ; HL points to buffer to receive data ; D is the RAM page to write to (or 0 if to RAM pages 81h/80h) ld (ptrACLBuffer),hl ld (ptrACLStart),hl ld a,d ld (RAMPage),a ld a,(dataInPipe) ld b,a U_CALL ReqData xor a ret ACL_IsDataAvailable: ;Returns whether a complete ACL data packet has been received. ;Outputs: ; Returns NZ if complete ACL packet has been received to buffer (from ACL_RequestData) ld ix,responseFlag bit ACLDataReceived,(ix+0) res ACLDataReceived,(ix+0) ret