changeset 2385:cd29118ee172

Fixed SCF to allow it to return if SS.Open errored out.
author boisy
date Sun, 24 Jan 2010 00:40:46 +0000
parents 67b11fbf5253
children e454c42a134b
files level1/modules/scdwn.asm level1/modules/scf.asm level2/modules/scf.asm
diffstat 3 files changed, 31 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/scdwn.asm	Sat Jan 23 22:49:02 2010 +0000
+++ b/level1/modules/scdwn.asm	Sun Jan 24 00:40:46 2010 +0000
@@ -462,18 +462,18 @@
 *
 SetStat                  
                cmpa      #SS.Open
-               bne       isitclose
+               bne       isitcomst
                bsr       open
+               bcs       ssbye
                ldd       #SS.Open*256+OP_SERSETSTAT
                bra       SendStat
-               
-isitclose
+isitcomst                              
                ldb       #OP_SERSETSTAT
                bsr       SendStat
+               cmpa      #SS.ComSt
+               beq       comst
                cmpa      #SS.Close
                beq       ex
-               cmpa      #SS.ComSt
-               beq       comst
                cmpa      #SS.SSig
                beq       ssig
                cmpa      #SS.Relea
@@ -505,18 +505,20 @@
                endc      
                jsr       6,u
                clrb      
-               rts       
+ssbye          rts       
 
 * SS.Open processor
 * Entry: X=Register stack pointer
 *        U=Static memory pointer
 *        Y=Path descriptor pointer
 open     pshs  u,y        preserve registers
-         tst   <V.PORT+1,u         check if this is $FF00 (wildcard)
+         tst   <V.PORT+1,u         check if this is $FFFF (wildcard)
          lbpl  L0BCD
          ldx   PD.DEV,y   get pointer to device table entry
          ldx   V$DESC,x   get pointer to /N descriptor
          pshs  x          save device descriptor pointer
+* start at /N1
+         ldb       #1      
 L0B58    equ   *
          ifgt      Level-1
          ldx       <D.DWStat
@@ -525,18 +527,15 @@
          endc      
 ; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
 ;		leax      DW.StatTbl,x
-* start at /N1
-         ldb       #1      
-         leax      1,x
-next     tst       ,x+
+next     cmpb      #DW.StatCnt-1
+         bge       opexer
+         tst       b,x
          beq       found
          incb      
-         cmpb      #DW.StatCnt-1
-         blt       next
-         puls  u,y,x      purge stack
-         comb             set carry
+         bra       next
+opexer   comb             set carry
          ldb   #E$MNF     get module not found error
-         rts              return
+         puls  x,y,u,pc      purge stack and return
          
 * Found a free spot
 found    pshs  b          save # of free entry
@@ -571,12 +570,15 @@
          lda   #Devic+Objct get module type
          os9   F$Link     try & link it
          IFGT  Level-1
+         pshs  cc
          lbsr  L0244      switch back to current process
+         puls  cc
          ENDC
          leas  7,s        purge stack
          bcc   L0BAB      it's linked, skip ahead
-L0BA7    leas  1,s        purge netdev #
-         bra   L0B58      go look for another one
+L0BA7    puls  b          get original number
+         incb
+         bra   L0B58      go find another free space
 
          IFGT  Level-1
 * Switch to system process descriptor
--- a/level1/modules/scf.asm	Sat Jan 23 22:49:02 2010 +0000
+++ b/level1/modules/scf.asm	Sun Jan 24 00:40:46 2010 +0000
@@ -167,9 +167,11 @@
 L00E9    lda   #SS.Open                internal open call
          pshs  a                       save it on the stack
          inc   2,s                     bump counter of good paths up by 1
-         lbsr  L01BD                   do the SS.Open call to th driver
+         lbsr  L01BD                   do the SS.Open call to the driver
          lda   2,s                     get counter of good paths
          leas  3,s                     clean up stack
+* NEW: return with error if SS.Open return error
+         bcs   L00FD                   +++BGP+++
          deca                          bump down good path count
          bne   L00FC                   if more still open, exit without error
          lbra  L01B2                   set parity/baud & return
--- a/level2/modules/scf.asm	Sat Jan 23 22:49:02 2010 +0000
+++ b/level2/modules/scf.asm	Sun Jan 24 00:40:46 2010 +0000
@@ -186,6 +186,11 @@
 * the open path list, and if ITS mode byte has the SHARE. bit set, we exit
 * with E$DevBsy too.  The idea is that if the SHARE. bit is set on the newly
 * opened path or an existing path, then there can "be only one."
+*
+*  17r1    2010/01/23  Boisy G. Pitre
+* SCF now returns on carry set after calling SS.Open.  Prior to this
+* change, SS.ComSt would be called right after SS.Open even if SS.Open
+* failed. This caused misery with the scdwn driver wildcard feature.
 
          nam   SCF
          ttl   NitrOS-9 Level 2 Sequential Character File Manager
@@ -197,7 +202,7 @@
 
 tylg     set   FlMgr+Objct
 atrv     set   ReEnt+rev
-rev      set   0
+rev      set   1
 edition  equ   17
 
          mod   eom,SCFName,tylg,atrv,SCFEnt,0
@@ -370,6 +375,8 @@
          lbsr  L025B        Do the SS.Open call to the driver
          lda   2,s          Get counter of good paths
          leas  3,s          Eat stack
+* NEW: return with error if SS.Open return error
+         bcs   L010F        +++BGP+++
          deca               Bump down good path count
          bne   L0129        If more still open, exit without error
          blo   L010F        If negative, something went wrong