home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff292.lzh / Devstat / Devstat.s < prev    next >
Text File  |  1989-12-10  |  8KB  |  329 lines

  1. ****************************************************************************
  2. *  DevStat                by    Fabrice LIENHARDT        *
  3. *  written in October 1989            7, rue de Leicester        *
  4. *                        67000 Strasbourg (France)  *
  5. *                                       *
  6. *  Written 100 % in assembler with Hisoft's Devpac Assembler V2.12       *
  7. ****************************************************************************
  8.  
  9.     opt d+                :Option debugging 
  10.  
  11.     incdir ":include/"
  12.     include exec/exec_lib.i
  13.     include libraries/dos_lib.i
  14.     include libraries/dos.i
  15.     include libraries/filehandler.i
  16.     include libraries/dosextens.i
  17.  
  18.     move.l    #dosname,a1
  19.     moveq #0,d0
  20.     CALLEXEC OpenLibrary        :Open DOSlibrary
  21.     tst.l d0
  22.     beq devquitfast
  23.     move.l d0,_DOSBase        :save DOSBase
  24.  
  25.     CALLDOS Output
  26.     move.l d0,devwindhd        :windowhandle
  27.  
  28.     move.l _DOSBase,a0        :Search pointer of DeviceNodes------
  29.     move.l dl_Root(a0),a1        :search dl_Root    
  30.     move.l rn_Info(a1),d0        :search rn_Info (BPTR)
  31.     asl.l #2,d0            :(convert BPTR in APTR)
  32.     move.l d0,a0            :
  33.     move.l di_DevInfo(a0),d0    :search di_DevInfo (BPTR)
  34.     asl.l #2,d0            :
  35.     move.l d0,devsavea5        :save pointer of Devicenodes
  36.     move.l d0,a5            :Result = a5
  37.  
  38. * List of all DLT_DEVICE ---------------------------------------------------
  39.  
  40.     move.l devwindhd,d1
  41.     move.l #devclrscr,d2
  42.     move.l #1,d3
  43.     CALLDOS Write            :clear screen
  44.  
  45.     move.l #0,a3            :counter of line=0 (to stop screen
  46.                     *scrolling)
  47.     move.l #devintrotxt,a0        
  48.     bsr devafftxt            :print "Printdevs by F.Lienhardt ..."
  49.     bsr devlfcr
  50.     bsr devlfcr            : 2 * line feed, carriage return
  51.  
  52.     move.l #devdevt1,a0
  53.     bsr devafftxt            :print "List of all hardware devices"
  54.  
  55.       move.l #devdevtext,d6        :prepare text (Name, Type, Unit...) 
  56.  
  57. devDLT_DEVICE:
  58.     cmp.l #DLT_DEVICE,dn_Type(a5)    :is it a harware device?
  59.     bne devdevcont    
  60.  
  61.     bsr devlfcr            :if yes, line feed
  62.  
  63.     bsr devdevtxt            :print "Name :"
  64.     move.l dn_Name(a5),d0
  65.     asl.l #2,d0
  66.     move.l d0,a0
  67.     bsr devafftxt            :and print the name of device
  68.  
  69.     bsr devdevtxt
  70.     move.l dn_Type(a5),d0        :print the type
  71.     bsr devaffnum
  72.  
  73.     move.l a5,a4            :save the pointer for Next DeviceNode
  74.  
  75.     move.l dn_Startup(a5),d0    :is there a startup pointer
  76.     cmp.l #10000,d0            :to go to FileSysStartupMsg ?
  77.     bcs devdevcont 
  78.     asl.l #2,d0            :if yes, put the pointer in a5
  79.     move.l d0,a5
  80.     
  81.     bsr devdevtxt            :and print all other parameters
  82.     move.l fssm_Unit(a5),d0        :fssm_Unit
  83.     bsr devaffnum
  84.  
  85.     bsr devdevtxt
  86.     move.l fssm_Device(a5),d0    :fssm_Device
  87.     asl.l #2,d0
  88.     move.l d0,a0
  89.     bsr devafftxt
  90.  
  91.     bsr devdevtxt
  92.     move.l fssm_Flags(a5),d0    :fssm_Flags
  93.     bsr devaffnum
  94.  
  95.     move.l fssm_Environ(a5),d0
  96.     asl.l #2,d0
  97.     move.l d0,a5            :search pointer of Environ parameters
  98.  
  99.     moveq #13,d5
  100. devbcle:
  101.     bsr devdevtxt
  102.     move.l (a5)+,d0
  103.     bsr devaffnum            :and print all his values
  104.     subq #1,d5
  105.     bne devbcle            :(13 values in DosEnvec)
  106.     bsr devlfcr
  107.  
  108.     move.l a4,a5            :Get the pointer of DeviceNode
  109.  
  110. devdevcont:
  111.     move.l dn_Next(a5),d7        :Search the next pointer
  112.     tst.l d7
  113.     beq devDLT_VOLUME        :if no more, then list all dev.names
  114.     asl.l #2,d7
  115.     move.l d7,a5
  116.     move.l #devdevtext,d6
  117.     bra devDLT_DEVICE        :else print the other devices
  118.     
  119. * List of all DLT_VOLUME ---------------------------------------------------
  120.  
  121. devDLT_VOLUME:
  122.     bsr devlfcr
  123.     bsr devlfcr            :line feed, carriage return
  124.  
  125.     move.l #devvol1,a0
  126.     bsr devafftxt            :print "List of all device names"
  127.  
  128.     move.l devsavea5,a5        :Get the original DeviceNode pointer
  129.  
  130.     move.l #devdevtext,d6        :and prepare text "Name, type..."
  131.  
  132. devDLT_VOLUME2:
  133.     cmp.l #DLT_VOLUME,dn_Type(a5)    :is it a device name?
  134.     bne devvolcont
  135.  
  136.     bsr devlfcr            :if yes, line feed
  137.  
  138.     bsr devdevtxt            :print "Name"
  139.     move.l dn_Name(a5),d0
  140.     asl.l #2,d0
  141.     move.l d0,a0
  142.     bsr devafftxt            :the name
  143.  
  144.     bsr devdevtxt
  145.     move.l dn_Type(a5),d0        :and the type
  146.     bsr devaffnum
  147.  
  148. devvolcont:
  149.     move.l dn_Next(a5),d7        :Search the next pointer
  150.     tst.l d7
  151.     beq devDLT_DIRECTORY        :if no more, search all logical dev.
  152.     asl.l #2,d7
  153.     move.l d7,a5
  154.     move.l #devdevtext,d6
  155.     bra devDLT_VOLUME2        :else print all other names
  156.  
  157. * List of all DLT_DIRECTORY ------------------------------------------------
  158.  
  159. devDLT_DIRECTORY:
  160.     bsr devlfcr
  161.     bsr devlfcr            :line feed
  162.  
  163.     move.l #devdir1,a0
  164.     bsr devafftxt            :print "List of all logical devices"
  165.  
  166.     move.l devsavea5,a5        :Get the original pointer
  167.  
  168.     move.l #devdevtext,d6        :prepare the text (Name, type...)
  169.  
  170. devDLT_DIRECTORY2:
  171.     cmp.l #DLT_DIRECTORY,dn_Type(a5)    :is it a logical device?
  172.     bne devdircont
  173.  
  174.     bsr devlfcr            :if yes, line feed
  175.  
  176.     bsr devdevtxt            :print "Name  :"
  177.     move.l dn_Name(a5),d0
  178.     asl.l #2,d0
  179.     move.l d0,a0
  180.     bsr devafftxt            :the name
  181.  
  182.     bsr devdevtxt
  183.     move.l dn_Type(a5),d0        :and the type
  184.     bsr devaffnum
  185.  
  186. devdircont:
  187.     move.l dn_Next(a5),d7        :search the next device
  188.     tst.l d7
  189.     beq devquit            :no more? then quit
  190.     asl.l #2,d7
  191.     move.l d7,a5
  192.     move.l #devdevtext,d6
  193.     bra devDLT_DIRECTORY2        :if not print all other devices
  194.  
  195. devquit:
  196.     bsr devlfcr
  197.     bsr devlfcr            :line feed
  198.  
  199.     move.l _DOSBase,a1
  200.     CALLEXEC CloseLibrary        :Close the DOS Library
  201. devquitfast:
  202.     rts                :The End
  203.  
  204. *** Routines ---------------------------------------------------------
  205.  
  206. devdevtxt:
  207.     bsr devlfcr            :line feed, carriage return
  208.     move.l d6,a0
  209.     bsr devafftxt            :print text before values
  210.     add.l #21,d6            :and prepare next text
  211.     rts
  212.  
  213. devlfcr:
  214.     move.l devwindhd,d1        :Routine to make a line feed and
  215.     move.l #devlr,d2        :a carriage return, stop the screen 
  216.     move.l #2,d3            :scrolling and wait of mouse click
  217.     CALLDOS Write
  218.     addq #1,a3
  219.     cmp.l #22,a3            :are there 22 lines printed ?
  220.     bne devnomouse            :if not, return 
  221.     move.l #0,a3
  222.     move.l devwindhd,d1
  223.     move.l #devmouse,d2
  224.     move.l #38,d3
  225.     CALLDOS Write            :else write"<<< Click Mouse..."
  226. devwaitclick:
  227.     and.b #64,$bfe001
  228.     bne devwaitclick        :and wait mouse click
  229.     move.l devwindhd,d1
  230.     move.l #devcr,d2
  231.     move.l #1,d3
  232.     CALLDOS Write
  233.     move.l devwindhd,d1
  234.     move.l #devdelete,d2
  235.     move.l #50,d3
  236.     CALLDOS Write            :delete the line
  237.     move.l devwindhd,d1
  238.     move.l #devcr,d2
  239.     move.l #1,d3
  240.     CALLDOS Write
  241. devnomouse:
  242.     rts                :and return to the programm
  243.  
  244. devafftxt:
  245.     move.l devwindhd,d1        :Routine to write text on screen    
  246.     move.b (a0)+,d3
  247.     move.l a0,d2            :adress of text with pointer = a0
  248.     CALLDOS Write    
  249.     rts
  250.  
  251. devaffnum:
  252.     move.l #10000,d1        :convert numbers in ASCII
  253.     move.l #devnumber,a1        :input = d0
  254.     bsr devcalc            :max = 100 000 decimal
  255.     move.l #1000,d1
  256.     bsr devcalc            :and print the number
  257.     move.l #100,d1
  258.     bsr devcalc
  259.     move.l #10,d1
  260.     bsr devcalc
  261.     add.b #$30,d0
  262.     move.b d0,(a1)+
  263.     move.l devwindhd,d1
  264.     move.l #devnumber,d2
  265.     move.l #6,d3
  266.     CALLDOS Write            :write the result
  267.     rts
  268. devcalc:
  269.     divu d1,d0
  270.     cmp.b #0,d0
  271.     beq devcalczero            :result = 0? 
  272.     add.b #$30,d0            :if not, convert it in ASCII
  273.     bra devcalc2
  274. devcalczero:
  275.     move.b #32,d0            :else write nothing (space)
  276. devcalc2:
  277.     move.b d0,(a1)+
  278.     move.w #0,d0
  279.     swap d0
  280.     rts
  281.  
  282. *** Variables --------------------------------------------------------
  283.  
  284. _DOSBase    dc.l 0
  285. dosname        DOSNAME            :'dos.library'
  286.         even
  287.  
  288. devcr        dc.w $0d00        :carriage return
  289. devlr        dc.w $0a0d        :line feed, carriage return
  290. devclrscr    dc.w $0c00
  291.  
  292. devmouse    dc.b "<<< Click mouse button to continue >>>"
  293.         even
  294. devdelete    dc.b "                                                  "
  295.         even
  296. devwindhd    dc.l 0            :windowhandle
  297.  
  298. devnumber    ds.b 6            :number in ASCII
  299. devsavea5    dc.l 0
  300.  
  301. devdevtext    dc.b 20," Name             : "
  302.         dc.b 20," Type             : "
  303.         dc.b 20," Unit             : "
  304.         dc.b 20," Device           : "
  305.         dc.b 20," Flags            : "
  306.         dc.b 20," TableSize        : "
  307.         dc.b 20," SizeBlock        : "
  308.         dc.b 20," SecOrg           : "
  309.         dc.b 20," Surfaces         : "
  310.         dc.b 20," SectorPerBlock   : "
  311.         dc.b 20," SectorPerTrack   : "
  312.         dc.b 20," Reserved         : "
  313.         dc.b 20," PreAlloc         : "
  314.         dc.b 20," Interleave       : "
  315.         dc.b 20," LowCyl           : "
  316.         dc.b 20," HighCyl          : "
  317.         dc.b 20," NumBuffers       : "
  318.         dc.b 20," BufMemType       : "
  319.         even
  320. devdevt1    dc.b 28,"List of all hardware devices"
  321.         even
  322. devintrotxt    dc.b 38,"DevStat by F.Lienhardt    October 1989"
  323.         even
  324. devvol1        dc.b 24,"List of all volume names"
  325.         even
  326. devdir1        dc.b 27,"List of all logical devices"
  327.         even
  328.  
  329.