IECHost sector read with faster transfer completed

Before bed time I managed to finally finish the drive code that reads a requested sector from the disk and sends it back to IEChost using a fast 2-bit protocol. I even managed to include error and current status handling šŸ™‚

Here’s my drive code:

chkr	cmp #'r'		; read sector command
	bne mloop

	jsr readbyte		; read track number
	sta $0c
	jsr readbyte		; read sector number
	sta $0d

	lda #$03		; use buffer #3 ($0600-$06ff)
	sta $f9

	cli
	jsr $d586		; read sector into buffer
	sei

	lda $03			; send error code to IECHost
	jsr sendbyte

	lda $03
	cmp #$01		; if the job completed successfully
	bne mloop

	lda #$00
	sta srclow

sndsec
srclow=*+1
	lda $0600		; send buffer contents to IECHost
	jsr sendbyte
	inc srclow
	bne sndsec

And here’s the corresponding code running on IECHost:

	fastaccess_send_byte('r');
	fastaccess_send_byte(track);
	fastaccess_send_byte(sector);

	b = fastaccess_receive_byte();

	switch (b) {
	case 0x01: /* Job completed successfully */
		fastaccess_read(buffer, 256);
		break;
	...

As the actual sector read is done usingĀ the DOS API (through the call to $d586), theĀ jobĀ takes quite some time, but I’ve already got a speed gain over the data transfer from the 1541 to IECHost.

Another task on my list bites the dust!

In future I will look into getting some custom sector readĀ code into the drive as part of the server program in an attempt to reduce sector read times: stay tuned!

This entry was posted in Retrocomputing, Technical and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s