Re: ATN questions on the serial bus

From: Marko Mäkelä (marko.makela_at_hut.fi)
Date: 2003-06-07 09:36:34

Hello Ruud,

> > 1. Can multiple bytes be sent with ATN asserted?
> 
> Yes. The actual cammandcodes are sent with ATN = (L).

I spent some hours last night, disassembling and commenting the serial
bus routines of the VIC-20 KERNAL ROM.  It looks like there can be one
or two bytes sent under ATN: the UNTALK ($5f) or UNLISTEN ($3f) codes,
or the device number 0..30 ORed with a command code (TALK=$40, LISTEN=$20),
and the optional secondary address, optionally ORed with $f0 (for open)
or $e0 (for close).

If the secondary address specified with the SETLFS call is above 128, no
secondary address will be sent.  This was new to me; I only knew that file
numbers above 128 are treated specially by CHROUT (it'll convert CR to CR+LF).

> > 2. Can the talker and listener change roles when ATN is 
> > initially deasserted?
> 
> No.

The VIC-20 firmware agrees with you: the routine at $eed3, which changes
from a talker to a listener, is entered after the TALK command (which can
be one or two bytes).

Also, it looks like that the only place where the VIC-20 generates EOI
handshake is when sending the second byte under ATN.  I'm not fully sure
about this, and I haven't looked into drive firmware yet, to see if it
tolerates EOI handshaking when receiving non-ATN bytes.

> Quite simple if two drives are concerned:
> - you tell the TALKER what file to send        [1]
> - you tell the LISTENER what file to receive   [1][2]
> - you tell the LISTENER to start to LISTEN
> - you tell the TALKER to start to talk         [3]

Thanks, this makes sense.

I analysed how the higher-level routines access the serial bus:

open:
  - if secondary address is omitted (above 128), do nothing
  - otherwise,
    - send LISTEN, SECOND or $f0 under ATN
    - send filename with CIOUT calls
    - send UNLISTEN under ATN
close:
  - if secondary address is omitted (above 128), do nothing
  - otherwise,
    - send LISTEN, SECOND or $e0 under ATN
chkout:
  - send LISTEN and optionally SECOND under ATN
chrout:
  - send the character with CIOUT
chkin:
  - send TALK and optionally the secondary address under ATN
  - become listener
chrin:
  - receive a character with ACPTR
save:
  - open the file (cf. "open"):
    - send LISTEN, secondary address or $f0 under ATN
    - send the filename with CIOUT calls
    - send UNLISTEN under ATN
  - write the file (cf. "chkout", "chrout"):
    - send LISTEN, secondary address under ATN
    - send the data with CIOUT calls
    - send UNLISTEN under ATN
  - close the file (cf. "close"):
    - send LISTEN, secondary address or $e0 under ATN
    - send UNLISTEN under ATN
load:
  - open the file (see "save")
  - read the file (cf. "chkin", "chrin"):
    - send TALK, secondary address under ATN, become listener
    - get the data with ACPTR calls
    - send UNTALK under ATN
  - close the file (see "save")

	Marko

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.