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: 2014
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: 490
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: 11386
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: 2980
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: 2014
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
Brush/Elysium
Acidchild/Padua
Shogoon/Elysium/MSL
rexbeng
Knight Rider/TREX
lotus_skylight
Quetzal/Chrome
Guests online: 88
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

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