home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.cbm
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!access.usask.ca!ccu.umanitoba.ca!shad04
- From: shad04@ccu.umanitoba.ca (Dan Fandrich)
- Subject: Re: serial bus
- Message-ID: <1992Aug15.062851.21910@ccu.umanitoba.ca>
- Organization: University of Manitoba, Winnipeg, Manitoba, Canada
- References: <1992Aug6.101701.5868@etek.chalmers.se> <1992Aug12.211643.23084@ccu.umanitoba.ca>
- Date: Sat, 15 Aug 1992 06:28:51 GMT
- Lines: 200
-
- In article <1992Aug6.101701.5868@etek.chalmers.se> mcl@etek.chalmers.se (Mathias Luthi) writes:
- > I am looking for a good description (better than the one found in the
- > programmer's guide) of the serial bus protocol. Does anyone have such
- > a thing ?
-
- Since my last post, I found an article stashed away on my hard disk that,
- in combination with Jim Butterfield's magazine writeup, would probably be all
- you need to implement the protocol yourself. Here's it is:
-
- ---------
- Article 1524 of comp.sys.cbm:
- Path: ccu.umanitoba.ca!clyde.concordia.ca!mcgill-vision!snorkelwacker!paperboy!husc6!rutgers!news-server.csri.toronto.edu!white.toronto.edu!ghfeil
- From: ghfeil@white.toronto.edu (Georg Feil)
- Newsgroups: comp.sys.cbm
- Subject: Re: C-64 serial bus info
- Message-ID: <1990Aug23.184800.2387@jarvis.csri.toronto.edu>
- Date: 23 Aug 90 22:48:00 GMT
- References: <4280001@hpindda.cup.hp.com>
- Organization: CSRI, University of Toronto
- Lines: 174
-
-
- The C-64 serial bus is a serialized version of the parallel IEEE-488 (GPIB)
- bus used on Commodore PETs. The electrical characteristics are quite
- different but the data transferred is the same, right down to the primary
- and secondary addresses and other control information used by GPIB. Any good
- book on the IEE-488 will tell you what you need to know about the bus in
- general.
-
- Commodore uses the addresses and secondary addresses on the serial bus
- in a certain way to talk between the C-64 and disks & printers.
- I once decoded this (by looking at the kernel ROMS) and wrote a brief
- report. Here it is, slightly edited.
-
- Georg.
-
- ======================================================================
-
- COMMUNICATION WITH A COMMODORE DISK DRIVE THROUGH THE HP-IB BUS
- ---------------------------------------------------------------
-
- Background on Commodore Disk Drives:
-
- A Commodore disk drive receives all commands and transmits
- all data through an HP-IB type bus. Being an intelligent drive, it performs
- operations such as file organization (opening & closing, updating the
- directory) and input/output buffering internally. Most housekeeping and
- utility operations such as disk formatting or file copying are also handled
- internally, so they require only a single data exchange of the appropriate
- disk command to initiate them.
-
- Communication with the disk drive is organized into 16 possible different
- "channels", numbered from 0 to 15. Channel 15 is reserved as the command
- channel, through which the disk accepts commands and outputs its status.
- Whenever disk files are accessed, it is through one of the other 15 channels.
- Channels 0 and 1 are used when reading and writing memory image files. The
- rest are for use in general purpose file handling.
-
- Channel selection is accomplished by a method very much like HPIB secondary
- addressing. Every time the 8250 is addressed to talk or listen, it awaits
- an additional address (ie. another byte transmitted with ATN true).
- The four least-significant bits of this byte contain the channel number,
- while the other four specify what is to be done with the file associated
- with that channel. The following table describes the function of the
- secondary address byte.
-
-
- BINARY VALUE FUNCTION FUNCTION OF ENSUING DATA
- ------------ -------- ------------------------
- -bit: 76543210
-
- 1111XXXX Open disk file Name of file to be opened
- 0110XXXX Read/Write data Contents read from/written into file
- 1110XXXX Close disk file <no data follows>
-
-
- Note that the sense of the second function listed above (read or write)
- depends on whether a "talk" or "listen" primary address preceded it. The
- other two functions should only be used with a "listen" address.
-
- Here is an example communications exchange with the disk to create a
- new file called SAMPLE. For this example, the disk has a primary address
- of 8. Channel number 2 is used. The codes in the second column are octal.
-
-
- ASCII OR
- ATN | OCTAL CODE | MEANING | FUNCTION
- -----|------------|-----------|----------------------------------------------
- true | 0 7 7 | UNL | Unaddress current listeners
- true | 1 0 0 | TLK 0 | Address controller (HP/1000) as talker
- true | 0 5 0 | LSN 8 | Tell 8250 to listen; it expects sec address
- true | 3 6 2 |sec address| Function: open a file using channel 2
- false|"0:SAMPLE,W"| filename | Name for file (write file on drive 0)
- true | 0 7 7 | UNL | Unaddress 8250
- true | 0 5 0 | LSN 8 | Readdress 8250
- true | 1 4 2 |sec address| Function: write to file through channel 2
- false|(ascii data)| contents | Data to be written in file SAMPLE
- true | 0 7 7 | UNL | Unaddress 8250
- true | 0 5 0 | LSN 8 | Readdress 8250
- true | 3 4 2 |sec address| Function: close file assoc. with channel 2
- -----|------------|-----------|----------------------------------------------
-
-
- In the example, a single file is opened, written to, and closed. This might
- correspond to the Basic command 'OPEN 4,8,2,"0:SAMPLE,W"'. It is
- possible to have more than one file open at the same time as long as each
- uses a different channel number. Note that only the lowest level of
- communications is shown.
-
- When opening files, the filename gives additional information such as the
- file type and whether it is a "read" or "write" file. The complete format
- is as follows:
-
- [@]drive:name,type,mode
- / / | \ \
- / / | \ \
- / drive# | \ access mode (READ or WRITE)
- / name of \
- optional '@' file file type:
- symbol to replace SEQ -sequential
- an existing file. PRG -program
- USR -user defined
- REL -relative
-
- Eg/ 1:NUMBERS,SEQ,READ -read sequential file NUMBERS
- from drive 1.
- 1:NUMBERS,S,R -same as above (can abbreviate
- using first letter)
- 1:NUMBERS -same as above (SEQ & READ are
- the default values)
- 0:NEW,USR,W -create user file called NEW
- on drive 0
- @1:TEST,P,W -replace existing program TEST
- on drive 1
-
-
- As mentioned earlier, channel 15 is the command channel. It does not need
- to be opened or closed since it is permanently designated, although it may
- be (if you choose to open it, the filename in the open procedure
- is taken as the first disk command). Any data written to channel
- 15 is interpreted as a command. Here is a brief list of some of the
- most commonly used commands. Refer to the disk drive user's manual for
- a complete descripion.
-
-
- Ndrive:diskname,id -Format a new diskette with
- given name and id.
- Eg/ N0:DEMO DISK,99
-
- Sdrive:filename -Scratch files matching
- given filename.
- Eg/ S1:TEMP
-
- Cdriveb=drivea -Copy all files on drivea
- to driveb.
- Eg/ C1=0
-
- Cdriveb:filenameb=drivea:filenamea -Copy file filenamea to same or
- other drive & call it filenameb.
- Eg/ C1:COPY=0:ORIGINAL
-
- Bdriveb=drivea -Backup disk in drivea to driveb.
- Old driveb contents are lost.
- Eg/ B0=1
-
- Vdrive -Validate disk in given drive. This
- is something like PK in FMGR.
- Eg/ V0
-
- UJ -Reset disk drive. This triggers
- a software cold start.
-
-
- When the command channel is accessed in a read operation, the data received
- is a status message from the drive. This is an ascii string separated by
- commas into 5 fields, as follows:
-
- nn, xxxxxx ,nn,nn,n
- / | \ / \
- / | | \
- / | | drive last accessed (0 or 1)
- error# error track &
- message sector of location
-
-
- Eg/ 21, READ ERROR,18,02,0
-
- See the disk drive user's guide for descriptions of the various errors.
-
- --
- Georg Feil Internet: ghfeil@white.toronto.edu
- -or- : georg@sgl.ists.ca
- ..if all else fails, try:
- {uunet,pyramid,watmath,utzoo}!utcsri!white!ghfeil (UUCP)
- ghfeil%white.toronto.edu@relay.cs.net (ARPA)
- ------------
-
- >>> Dan
- --
- Internet: shad04@ccu.umanitoba.ca Compu$erve: 72365,306
-