TI-H: Final Code Section


[Prev][Next][Index][Thread]

TI-H: Final Code Section




Ignore the clock cycle notes.  They are wrong.  With the proper shift
register routine and a properly set up 8515, these routines can all be used
to make one slow IDE ATA-2 interface.

These send and receive out of the 8515's 512bytes of memory.  They are not
intended to be used like this...  These are just examples of how to use the
other routines I posted...  And I've not tested these on anything other
than a real old WD 80MB drive so they might not work on you 12GB drive...
:)


;6269 clock cycles
;.783625msec
;783.625usec
;783,625nsec
RecSec:	cli				;1
	clr	r28			;1
	clr	r29			;1
	rcall	SendCSH			;3+895
	ldi	ADRa, 0b11101110	;1
	ldi	lowb, $20		;1
	rcall	SendIDE			;3+155
widint:	sbic	PORTD, HDInt		;2
	rjmp	cont			;2
	rjmp	widint			;2
cont:	rcall	ReadIDE			;3+155
	ldi	count, 255		;1
	ldi	ADRa, 0b11100000	;1
	rcall	SendADR1		;3+155	 158
idrd:	sbi	PORTC, DIOR		;2*255	 510
	nop				;1*255	 255
	cbi	PORTC, DIOR		;2*255	 510
	nop				;1*255	 255
	in	highb, PORTA		;1*255	 255
	in	lowb, PORTB		;1*255	 255
	sbi	PORTC, DIOR		;2*255	 510
	cbi	PORTC, DIOR		;2*255	 510
	st	Y+, r26			;2*255	 510
	st	Y+, r27			;2*255	 510
	dec	count			;1*255	 255
	brne	idrd			;2*255-1 509
	ret				;4

;6269 clock cycles
;.783625msec
;783.625usec
;783,625nsec
SenSec: cli				;1
	clr	r28			;1
	clr	r29			;1
	rcall	SendCSH			;895+3
	ldi	ADRa, 0b11101110	;1
	ldi	lowb, $30		;1
	rcall	SendIDE			;173+3
ridint:	sbic	PORTC, HDInt		;2
	rjmp	conta			;2
	rjmp	ridint			;2
conta:	rcall	ReadIDE			;173+3
	ldi	count, 255		;1
	ldi	ADRa, 0b11100000	;1
	rcall	SendADR1		;3+155	 158
idwd:	ld	highb, Y+		;1*255	 255
	ld	lowb, Y+		;1*255	 255
	sbi	PORTC, DIOW		;2*255	 510
	nop				;1*255	 255
	cbi	PORTC, DIOW		;2*255	 510
	nop				;1*255	 255
	out	PORTA, highb		;1*255	 255
	out	PORTB, lowb		;1*255	 255
	sbi	PORTC, DIOW		;2*255	 510
	cbi	PORTC, DIOW		;2*255	 510
	dec	count			;1*255	 255
	brne	idwd			;2*255-1 509
	ret



References: