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: 1458
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: 227
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: 8842
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: 1063
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: 1458
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
Harry Potthead
irata/trsi
bugjam
Matt
Dymo/G★P
Lavazza/Censor Design
Almighty God/L64/Ons..
zscs
Marq/Fit^Lieves!Tuor..
Guests online: 38
Top Demos
1 Uncensored  (9.7)
2 Comaland 100%  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 The Shores of Reflec..  (9.6)
6 Wonderland XII  (9.6)
7 Lunatico  (9.6)
8 We Come in Peace  (9.6)
9 Incoherent Nightmare  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 FMX Music Demo  (9.6)
2 Daah, Those Acid Pil..  (9.6)
3 Arok 20 Invitation  (9.6)
4 Merry Xmas 2017  (9.5)
5 Pandemoniac Part 2 o..  (9.5)
6 Party Horse  (9.4)
7 Dawnfall V1.1  (9.4)
8 In Memoriam BHF  (9.4)
9 Dawnfall  (9.4)
10 Synthesis  (9.4)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Mr Zero Page  (9.9)
4 Mitch  (9.8)
5 Doc  (9.8)

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