From: Steve Judd (sjudd_at_ffd2.com)
Date: 2006-04-09 22:31:51
Yo, I haven't had problems reading the error channel before, but I have had problems with e.g. loading a file that isn't there. That is, things like LOAD and OPEN are supposed to use the carry flag to return an error, but it seems like it only works some of the time. I'm sure I just missed something simple, but I was never motivated enough to figure it out. Anyways, here is the routine I use to read the error channel (available in the Fridge, in one of the diskio.*.s files): LDA #13 JSR CHROUT * * This method is a bit faster on output to screen. * LDA #$0F LDX $BA LDY #$0F JSR SETLFS LDA #00 JSR SETNAM JSR OPEN BCS :ERROR LDX #$0F JSR CHKIN :LOOP JSR CHRIN CMP #$0D BEQ :EXIT JSR CHROUT BNE :LOOP :EXIT JSR CHROUT JSR CHROUT ;One more to look nice LDA #15 JSR CLOSE JMP CLRCHN :ERROR PHA ... and here is another one that was on the Merlin 128 disk, which is compact but slower: LDA $BA JSR TALK ;Command device to talk LDA #$6F ;Channel 15 STA SA ;Current secondary address JSR TKSA LDA #$0D ;Set for initial CR :LOOP JSR CHROUT JSR ACPTR CMP #$0D BNE :LOOP JSR CHROUT ;Do CR JMP UNTLK ;... and exit As to using CLOSE vs. CLALL: dang, I know I had something about these... I'm thinking that maybe CLOSE actually sends the command to the disk drive to close out the file, whereas CLALL simply clears the table entry at $02xx. Yeah, that's it: all CLALL does is set $98 to zero, and falls into CLRCHN to reset input/output devices to normal. This means that using CLALL you can leave the disk drive with files open (red light on), if not careful. I think my basic rule has been to use CLOSE, followed by CLALL when finished. For what it's worth... -Steve On Sun, 9 Apr 2006 silverdr@inet.com.pl wrote: > I vaguely recall having some problems with this and even resolving > them many years ago. Now I of course don' t remember that and have > some problems again. the question: does opening the #15 secadd > channel in ML require some kind of special attention? It seems that > it is somehow connected with $b7 (FNLEN). When $b7 is equal to zero > (like e.g. after loading from tape) I get some strange behaviour. > OTOH I get differently strange results when not setting $b7 to zero - > in other places. Furthermore, another question - when should and when > shouldn't one CLOSE() / CLALL() after using the channel? > > What I need to do should be so simple (checking if the file exists): > > SETLFS(file0, dev0) > SETNAM(file0, dev0) > OPEN(file0, dev0) > SETLFS(statuschannel, dev0) > OPEN(statuschannel, dev0) > CHKIN(statuschannel, dev0) > CHRIN(statuschannel, dev0) UNTIL $0d > CLRCHN > CLOSE(statuschannel, dev0) > CLOSE(file0, dev0) > CLALL > > Yet it seems that I get different results, depending on the content > of $b7 and the position of CLOSE/CLRCHN/CLALL even in combinations I > would expect to make no difference. > > Any clues? > > -- > A valiant man's look is more than a coward's sword. > > > Message was sent through the cbm-hackers mailing list > Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.