Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


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

Registered: Jun 2002
Posts: 1472
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: 240
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
Groepaz

Registered: Dec 2001
Posts: 8920
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: 1095
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: 1472
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
Perff/No Name
Stainless Steel/F4CG
Goat
Nith/TRIÉ…D
Guests online: 33
Top Demos
1 Uncensored  (9.7)
2 Comaland 100%  (9.7)
3 Unboxed  (9.7)
4 Edge of Disgrace  (9.7)
5 Coma Light 13  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.6)
9 Old Men in Used Cars  (9.5)
10 C=Bit 18  (9.5)
Top onefile Demos
1 Arok 20 Invitation  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 FMX Music Demo  (9.5)
4 Crystal Gazer  (9.5)
5 Pandemoniac Part 2 o..  (9.5)
6 Rewind  (9.5)
7 Dawnfall V1.1  (9.5)
8 Party Horse  (9.4)
9 Dawnfall  (9.4)
10 In Memoriam BHF  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.3)
5 The Transfer Team  (9.3)
Top Graphicians
1 Razorback  (9.8)
2 Mirage  (9.8)
3 Archmage  (9.7)
4 Veto  (9.7)
5 Facet  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 0.064 sec.