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


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

Registered: Jun 2002
Posts: 2038
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: 502
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: 11523
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: 3098
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: 2038
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
Mason/Unicess
Didi/Laxity
RetroGL
ΛΛdZ
theK/ATL
Guests online: 433
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Performers  (9.3)
4 Oxyron  (9.3)
5 Censor Design  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Stormbringer  (9.7)
3 Fungus  (9.6)
4 Booze  (9.5)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.04 sec.