home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / DRIVERS / nulman.lzh / NCF.A next >
Text File  |  1993-03-05  |  4KB  |  149 lines

  1.  nam ncf
  2.  ttl Replacement file manager for /Nil
  3. ****************************************************
  4. * Oct 29, 1992 - first version by kevin darling
  5. * public domain, no rights reserved, have fun!
  6. ****************************************************
  7. * To compile:
  8. *    r68 ncf.a -qo=ncf.r
  9. *    l68 ncf.r -o=bootobjs/ncf -l=/dd/lib/sys.l
  10. *
  11. * ModEd /nil descriptor to use NCF instead of SCF
  12. ****************************************************
  13. * Tested with 1000 I$Writes of 1000 bytes to /nil:
  14. *   SCF = 1 minute.  NCF = 1 second.
  15. * Tested with 1000 I$WritLns of 1000 bytes to /nil:
  16. *   SCF = 1 minute.  NCF = 3 seconds.
  17. ****************************************************
  18. * If you really didn't want to emulate this much
  19. *   of SCF, you could skip doing all functions.
  20. * I kept I$WritLn return of amount of data written,
  21. *   and the SetStt Option call, just in case
  22. *   these mattered to some program (doubtful).
  23. ****************************************************
  24.  
  25.  use /dd/defs/oskdefs.d
  26.  
  27. typelang equ (FlMgr<<8)+Objct
  28. attrrev  equ (ReEnt+SupStat)<<8
  29. edition  equ 1
  30.  
  31.  psect  nilman,typelang,attrrev,edition,0,Entry
  32. ****************************************************
  33. Entry:
  34.  dc.w   Create-Entry                            
  35.  dc.w   Open-Entry                              
  36.  dc.w   MakDir-Entry                            
  37.  dc.w   ChgDir-Entry                            
  38.  dc.w   Delete-Entry                            
  39.  dc.w   Seek-Entry                              
  40.  dc.w   Read-Entry                              
  41.  dc.w   Write-Entry                             
  42.  dc.w   ReadLn-Entry                            
  43.  dc.w   WritLn-Entry                            
  44.  dc.w   GetStt-Entry                            
  45.  dc.w   SetStt-Entry                            
  46.  dc.w   Close-Entry                             
  47.  
  48. ****************************************************
  49. *  a1 = path desc
  50. *  a4 = proc desc
  51. *  a5 = user reg stack
  52. *  a6 = system globals
  53. ****************************************************
  54. *
  55. Create:
  56. Open:
  57.  move.l PD_DEV(a1),d0   device table copy for user
  58.  move.l d0,PD_TBL(a1)
  59.  
  60.  move.l R$a0(A5),A0     a0=pathname
  61.  os9    F$PrsNam        parse it
  62.  bcs.s  OpenError       ..quit on error
  63.  tst.b  d0              null end of name?
  64.  beq.s  OpenOkay        ..yes
  65.  cmp.b  #C$CR,d0        or CR?
  66.  beq.s  OpenOkay        ..yes
  67.  cmp.b  #$20,d0         or space?
  68.  bne.s  OpenError       ..no, must be name error!
  69. OpenOkay
  70.  move.l a1,R$a0(a5)     update passed pathname pointer
  71.  moveq  #0,d1
  72.  rts
  73. OpenError
  74.  move.w #E$BPNam,d1     bad pathname
  75.  ori    #Carry,ccr
  76.  rts
  77.  
  78. ****************************************************
  79. MakDir:
  80. ChgDir:
  81. Delete:
  82.  move.w #E$BMode,d1     bad mode
  83.  ori    #Carry,ccr      (chgdir/makdir never come)
  84.  rts
  85.  
  86. ****************************************************
  87. Seek:
  88. Close:
  89.  moveq  #0,d1           ignore these
  90.  rts
  91.  
  92. ****************************************************
  93. GetStt:
  94.  cmpi.w #SS_Opt,d0      option call is universal
  95.  bne.s  BadCall         IOMan copies them for us
  96.  rts                    exit with carry clear
  97.  
  98. SetStt:
  99.  cmpi.w #SS_Opt,d0      option call is universal
  100.  bne.s  BadCall
  101.  move.l R$a0(a5),a0     point to user packet
  102.  lea    PD_OPT(a1),a2   and path desc options
  103.  moveq  #OPTCNT-1,d0    SCF option count
  104. SetOpt
  105.  move.b (a0)+,(a2)+     copy in case user wants later
  106.  dbra   d0,SetOpt
  107.  moveq  #0,d1
  108.  rts
  109.  
  110. BadCall
  111.  move.w #E$UnkSvc,d1    unknown service calls
  112.  ori    #Carry,ccr
  113.  rts
  114.  
  115. ****************************************************
  116. Read:
  117. ReadLn:
  118.  move.w #E$EOF,d1       always end of file on reads
  119.  ori    #Carry,ccr
  120.  rts
  121.  
  122. ****************************************************
  123. Write:
  124.  moveq  #0,d1           dump everything written
  125.  rts
  126.  
  127. ****************************************************
  128. * For more speed, use Write routine above instead.
  129. * It should work for almost all programs.
  130.  
  131. WritLn:
  132.  move.l R$a0(a5),a0     point to data
  133.  move.l R$d1(a5),d1     get max amt to output
  134.  beq.s  WritEnd
  135.  move.b PD_EOR(a1),d0   end-of-record char
  136. WritLoop
  137.  subq.l #1,d1
  138.  beq.s  WritEnd
  139.  cmp.b  (a0)+,d0        end of cooked write?
  140.  bne.s  WritLoop
  141. WritEnd
  142.  sub.l  d1,R$d1(a5)     return amount "written"
  143.  moveq  #0,d1           (desired minus "done")
  144.  rts
  145.  
  146.  ends
  147.  
  148. * end of file
  149.