Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Secondary address
2018-10-07 15:55
JackAsser

Registered: Jun 2002
Posts: 1987
Secondary address

What is the thing with secondary addresses with I/O in the C64 kernel? Can a filenumber have multiple secondaries etc? What is the purpose? Can I leave it to 0 always instead and not bother with them?
2018-10-07 16:41
oziphantom

Registered: Oct 2014
Posts: 478
Isn't it for Dual Drives on the PET. so you have 8,0 which is device 8 drive 1 and then 8,1 which is then device 8 drive 2. Does the 2nd Tape port map to another device number or do both tapes have number of 1 with different secondary addresses?
2018-10-07 16:49
chatGPZ

Registered: Dec 2001
Posts: 11092
the secondary address is unrelated to the drive number. (and indeed the second tape port is device #2)

generally speaking, the secondary address can be used to tell the device some "extra options". eg for a bunch of printers you can switch how they handle CR/LF by using certain secondary addresses.

as for the 1541 (and probably other drives), sec-addr 0 is for LOAD and 1 is for SAVE. or the other way around, i forgot =D (or perhaps it was 1 and 2? *shrug*). i somehow vaguely recall setting bit 7 in the secondary address also had some special meaning.
2018-10-07 17:09
Krill

Registered: Apr 2002
Posts: 2821
For disk drives, the secondary address also specifies the channel number, which is some kind of drive-side file handle.

Valid values are 0-15, with 0 and 1 having the special meaning Groepaz mentioned, plus 15 being the error/command channel, and 2-14 the generic channel numbers.
The upper 4 bits aren't supposed to be set by the user, they're used to communicate serial bus protocol stuff, like LISTEN and TALK, OPEN and CLOSE and such.

Now, in theory, you can have multiple open files simultaneously and address them via the secondary address = channel number and perform different operations on each open file, but in practice... Not so sure how well that works, on 1541, anyways. :)
2018-10-07 17:11
JackAsser

Registered: Jun 2002
Posts: 1987
Ok, thanks guys.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Acidchild/Padua
mankeli/Extend
Walt/Bonzai
Didi/Laxity
Frostbyte/Artline De..
Tim/Silicon Limited
apprentix
Guests online: 140
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.044 sec.