; TachyonLink Send routine
;
; note: disables interrupts
;
;
TachyonLink_Send:
	di
	ld e,a		;Byte to send
	ld a,1
	out (0),a	;clock line low
TachyonLink_Send_Wait:
	in a,(0)
	and 2
	jr nz,TachyonLink_Send_Wait
	;Both lines have gone low
	xor a
	out (0),a		;set both high
TachyonLink_Send_Wait2:
	in a,(0)
	and 2
	jr z,TachyonLink_Send_Wait2
	;Start the sending loop
	call TachyonLink_Pause
	ld b,4
TachyonLink_Send_Loop:
	;Now put a bit on the data line, clock low
	xor a
	rr e
	ccf
	rla
	sl1 a
	out (0),a
	;now pause
	call TachyonLink_Pause
	;clock high with a bit
	xor a
	rr e
	ccf
	rla
	add a,a
	out (0),a
	call TachyonLink_Pause
	djnz TachyonLink_Send_Loop
	xor a
	out (0),a
	ret
TachyonLink_Pause:
	ex (sp),hl
	ex (sp),hl
	push bc
	pop bc
	ret
.end

