Re: Questions about 8250 and 1541

From: Rhialto <rhialto_at_falu.nl>
Date: Wed, 9 Jun 2010 23:04:55 +0200
Message-ID: <20100609210455.GA20300@falu.nl>
On Wed 09 Jun 2010 at 13:10:36 +0200, Baltissen, GJPAA (Ruud) wrote:
> The 1541 has this part which always had made me wonder:
> 
> ;**  TALK
> B_E680
> 		jsr	OpenChan4Read	; open channel for reading
> 		nop				
> 		nop
> 		nop

I have a disassembly (I think it is from 1541 Intern) which has, instead
of the above 3 NOPs

		jsr	$ea4e		; accept byte

(but Inside Commodore DOS claims that the $ea4e routine resets the port
and jumps to the idle loop, so that the next bne is never reached)

> 		bne	J_E68E
> 
> ;**  LISTEN
> B_E688
> 		jsr	OpenChan4Write	; open channel for writing
> 		nop				
> 		nop
> 		nop
> J_E68E
> 		jsr	CheckREL		; verify file type
> 		cmp	#$04			; file type REL or
> Direct access?
> 		bcs	B_E698		; yes, ->
> 
> 
> The 8250 equivalent:
> 
> ;**  TALK
> B_F0E9					;
> [F0E9]
> 		jsr	OpenChan4Read	;
> [D83B]
> 
> 		lda	PAD2
> 		ora	#$10			; clear DAV
> 		sta	PAD2
> 		bne	J_F103		; always ->
>   
> ;**  LISTEN
> B_F0F6					;
> [F0F6]
> 		jsr	OpenChan4Write	;
> [D856]
> 
> 		lda	#$04			; clear NRFD 
> 		ora	PAD2
> 		and	#$FE			; set ATN ???
> 		sta	PAD2
> J_F103					;
> [F103]
> 		jsr	Check4REL		;
> [D873]
> 		cmp	#$04			; REL or Direct access
> file?
> 		bcs	B_F10D		; yes, ->
>  
> 
> The interesting part is the line 'bne J_E68E' in the 1541 part. In the
> 8250 the equivalent branch will always happen due to the 'ora #$10'
> instruction. But this is missing in the 1541 and that caused my to study
> the 'Open a channel for writing' subroutine. The last part of the
> 'OpenChan4Write' subroutine:

OpenChan4Read

> already allocated
> 		lda	LINTAB,X		; already in use?
> 		bmi	B_D106		; no, ->
> 
> 		and	#$0F
> 		sta	CURCHN
> 
> 		tax
> 		clc				; flag for ok
> B_D106
> 		rts
> 

The OpenChan4Read ($d0eb) seems to usually return non-zero anyway.
It returns a value from LINTAB and the possible values that Inside
Commodore DOS gives for that are FF, 81, 41, or 01, so never 00.

> Question: what will happen if the channel is zero ???

(the word channel is used with so many meanings, in my book I have
replaced it with LINDX in this context)

I must say that this whole LINDX stuff always confused me a lot. It is
quite likely that the actual values are always > 0, LINDX 0 being
reserved for something or other... (guessing)

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.

       Message was sent through the cbm-hackers mailing list
Received on 2010-06-09 22:00:08

Archive generated by hypermail 2.2.0.