Routines to handle Commodore 1541 drive

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
Atlantis
Posts: 122
Joined: 19 Jun 2018

Routines to handle Commodore 1541 drive

Post by Atlantis »

In my 6502 based computer im implemented commodore bus port, thinking of future support of 1541 drive or its modern SD card based equivalent. It isn't direct copy of commodore circuit because I replaced PIA chip with Intel 8255 parallel port, so I am aware that I will have to rewrite low level I/O routines.
Now I am looking for some 6502 assembly code implementation of communication protocol. If there is some easy way to add 1541 support to my computer assuming that I have working bus? As far I know most of the heavy lifting (reading/writing sectors, file system support) is done by the drive itself, so what code I need to implement on my computer?
BillG
Posts: 710
Joined: 12 Mar 2020
Location: North Tejas

Re: Routines to handle Commodore 1541 drive

Post by BillG »

Try to find books about the 1541 disk drive or Commodore DOS. If I recall, they were quite detailed.

There were also projects you can find on the Internet about interfacing the drive to other computer systems like a PC.
teamtempest
Posts: 443
Joined: 08 Nov 2009
Location: Minnesota
Contact:

Re: Routines to handle Commodore 1541 drive

Post by teamtempest »

A free PDF detailing how to control the 1541 at a low level:

https://www.pagetable.com/?p=630

Not free, but "Anatomy of the 1541" includes a ROM listing:

https://www.ebay.com/p/1200433?iid=154552079476

That one is from Abacus. https://www.lemon64.com/ has a free copy of a book by the same name from Data Becker.
User avatar
cjs
Posts: 759
Joined: 01 Dec 2018
Location: Tokyo, Japan
Contact:

Re: Routines to handle Commodore 1541 drive

Post by cjs »

I have written up a summary of the bus hardware and protocol, which is the initial bit you need to be able to send and receive packets, talk to devices, open and close channels, and so on. That lower layer is device-independent, so you can use it to talk to printers and the like as well as diskette drives. There are also plenty of links there to more detailed documentation that you will almost certainly need both to completely understand the summary and to implement the protocol. (The summary aims to be a reminder of how it works, not a detailed specification.)

Some of the links also give information on the higher-level protocol run on top of this to talk to the disk drives. Inside Commodore DOS is probably the best of these, though if you're using the CBM DOS and file system you won't actually need too much of that book.
Curt J. Sampson - github.com/0cjs
Post Reply