Hello, * On Mon, Aug 20, 2012 at 02:08:25PM +0200 Oliver Schmidt wrote: > Hi, > > Just for the records - here's again the code snipet and my questions - > which the answer below refers to... > > lda <device> > jsr $ffb1 ; listen > lda #$00 > sta $90 ; necessary ? > lda #$ff ; or rather #$6f ? Yep, $6F. $FF is the secondary address that is used for OPEN. Having said this, I am not sure if this really makes a difference, as the floppy (154x/157x) masks out unused bits at $E8B8: E8B8 AND #$60 E8BA CMP #$60 E8BC BNE $E8FD Only $E0 (secondary address for CLOSE) seems to be handled differently ($E8C7-). However, I fail to see how this code can even execute, as the sequence above should already handle this. Or I am just too tired to read the code correctly. ;) I have not followed the rest of the code in the floppy, though. So there might be some difference because of the high-nibble of the secondary address that I am not aware of. It has been some years since I last looked at this code in detail. > jsr $ff93 ; lstnsa > ldy $90 > jsr $ffae ; unlstn > tya > bpl <present> > <not present> > However I have several questions: > - Is it really necessary to initialize $90 Yep. In most cases, the status ($90) is cleared at $F30F in the C64 ROM: That is, it is cleared whenever the KERNAL searches for a logical file number. (OPEN 1,x,y or PRINT#1 or INPUT#1 or so). This only happens in "high-level" accesses to the IEC, though. It is also cleared at F3DF (opening a file on IEC), $F4A9 (LOAD), $F841 (tape routine), FE1E (general "set status" routine). Thus, as you are using direct ("low-level") IEC routines, nothing will reset $90 for you, so you have to do it yourself. > - What is the right high nibble for "opening" the cmd channel here $F or $6 ? $6F. > - Is it correct to assume that unlstn doesn't trash Y ? Yep, neither X nor Y is affected, only A (by contract): http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_5/page_271.html http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/Chapter_5/page_304.html > - Is it correct that $90 must be saved before calling unlstn ? No, not really Obviously, this routine only wants to make sure that an error that might occur is not because of the UNLISTEN, but because of the LISTEN. That's right if one thinks that the LISTEN might succeed ("I am here" from the device), but the UNLISTEN might fail. I have problems to see how this could occur, though, as long as other devices do not interfere. Furthermore, if UNLISTEN fails, we have a communication problem, so all bets are off anyway. Regards, Spiro. -- Spiro R. Trikaliotis http://www.trikaliotis.net/ ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Wed Aug 22 20:58:03 2012
This archive was generated by hypermail 2.1.8 : 2012-08-22 20:58:06 CEST