AmigaShell script to add RAD device from ArpalHands

User can provide a COUNT parameter to add a bunch of RAD devices in a single ScripT execution. Omitting this parameter lead to add only one RAD device.

During RAD devices creation process, script will look for available unit number without exceeding a value of 99 which is the maximum allowed by WorkBench OS.

.key COUNT
 
.bra {
.ket }
 
FAILAT 21
 
ECHO >ENV:ADDRADCOUNT {COUNT}
ECHO >ENV:ADDRADUNIT  0
 
IF VAL $ADDRADCOUNT EQ 0
  ECHO >ENV:ADDRADCOUNT 1
ENDIF
 
IF "$ADDRADCOUNT" EQ ""
  ECHO >ENV:ADDRADCOUNT 1
ENDIF
 
LAB start
IF VAL $ADDRADCOUNT GT 0
  ECHO "RAD$ADDRADUNIT:"                        > T:ADDRAD.MountList
  ECHO "  Activate         =  1"               >> T:ADDRAD.MountList
  ECHO "  Buffers          =  5"               >> T:ADDRAD.MountList
  ECHO "  BufMemType       =  1"               >> T:ADDRAD.MountList
  ECHO "  Device           =  ramdrive.device" >> T:ADDRAD.MountList
  ECHO "  Flags            =  0"               >> T:ADDRAD.MountList
  ECHO "  HighCyl          =  79"              >> T:ADDRAD.MountList
  ECHO "  Interleave       =  0"               >> T:ADDRAD.MountList
  ECHO "  LowCyl           =  0"               >> T:ADDRAD.MountList
  ECHO "  Reserved         =  2"               >> T:ADDRAD.MountList
  ECHO "  SectorSize       =  512"             >> T:ADDRAD.MountList
  ECHO "  SectorsPerTrack  =  11"              >> T:ADDRAD.MountList
  ECHO "  Surfaces         =  2"               >> T:ADDRAD.MountList
  ECHO "  Unit             =  $ADDRADUNIT"     >> T:ADDRAD.MountList
  ECHO "#"                                     >> T:ADDRAD.MountList
  MOUNT RAD$ADDRADUNIT: FROM T:ADDRAD.MountList
  IF VAL $RC NOT EQ 0
    EVAL <ENV:ADDRADUNIT >NIL: TO=ENV:ADDRADUNIT2 VALUE2=1 OP=+ ?
    TYPE >ENV:ADDRADUNIT ENV:ADDRADUNIT2
    IF VAL $ADDRADUNIT GE 100
      SKIP end
    ENDIF
    SKIP start BACK
  ENDIF
  ECHO "RAD$ADDRADUNIT successfully added"
  EVAL <ENV:ADDRADUNIT >NIL: TO=ENV:ADDRADUNIT2 VALUE2=1 OP=+ ?
  TYPE >ENV:ADDRADUNIT ENV:ADDRADUNIT2
ELSE
  SKIP end
ENDIF
 
EVAL <ENV:ADDRADCOUNT >NIL: TO=ENV:ADDRADCOUNT2 VALUE2=1 OP=- ?
TYPE >ENV:ADDRADCOUNT ENV:ADDRADCOUNT2
 
SKIP start BACK
 
LAB end
DELETE ENV:ADDRADCOUNT#? T:ADDRAD.MountList QUIET
 
ECHO "End of program"

MORE

amigados.txt · Last modified: 2020/10/07 20:46 by rzr
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki