home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / GXY-INF.LHA / infos / trackcheck.s < prev    next >
Encoding:
Text File  |  1996-03-09  |  10.2 KB  |  543 lines

  1.                 include "dh0:code/include/exec/exec_lib.i"
  2. last    =    2*20        * letzter Block (11*79*2)
  3.  
  4.  
  5.  
  6. _LVOOutput     equ    -60        ;DOS: Output-Handle holen
  7. _LVOWrite     equ    -48        ;     Ausgabe
  8.  
  9. x:        move.l    a0,clineadd    * cli-command  addr
  10.         move.l    d0,clinelen    * cli-command  lenght
  11.  
  12.  
  13. _main        move.l    #dosname,a1        ;Name der DOS-Lib 
  14.         moveq    #0,d0            ;Version egal
  15.         move.l  _SysBase,a6        ;Basis Exec
  16.            jsr     _LVOOpenLibrary(a6)    ;DOS-Lib oeffnen
  17.         tst.l    d0            ;Fehler?
  18.         beq    fini            ;wenn Fehler, Ende
  19.         move.l    d0,DOSBase        ;Zeiger merken
  20.  
  21.         move.l    #text1,tsource
  22.         move.l    #(text1e-text1),tlaenge
  23.         bsr    print
  24.         
  25.         bra    clicommand
  26. cli_return:        
  27.  
  28.  
  29.                 move.l    #0,a1
  30.                 CALLEXEC FindTask               * Task suchen
  31.                 move.l  d0,ReplyPort+16            * MsgPort
  32.                 lea     ReplyPort,a1            * initialisieren und
  33.                 CALLEXEC AddPort                * einfügen
  34.  
  35.  
  36.                 lea     DiskIO,a1               * IOTrackDisk laden
  37.                 move.l  drive,d0                    * Laufwerk  dfx (0)
  38.                 moveq   #0,d1                   * keine Spezial-Flags
  39.                 lea     DevName,a0              * Name des Devices
  40.                 CALLEXEC OpenDevice             * Device öffnen
  41.         tst.l   d0                      * hat's geklappt?
  42.                 beq    starttest       
  43.  
  44.         move.l    #noDrive,tsource
  45.         move.l    #(noDrivee-nodrive),tlaenge
  46.         bsr    print
  47.         bra    Abort          
  48.  
  49.  
  50. ******************************************************************************
  51. starttest:
  52.         move.l    #search,tsource
  53.         move.l    #(searche-search),tlaenge
  54.         bsr    print
  55. newline:    
  56.         cmp.b    #"f",parameter        : free  (no output)
  57.         beq    nosturctur1
  58.         bsr    enter
  59.         bsr    trackprint
  60. nosturctur1:    move    #5,trackcount
  61. newtrack:    bsr    loadblock
  62.         bsr    fillbuffer
  63.         bsr    compare0
  64.         bsr    comparedos
  65.         bsr    comparexcopy
  66.         cmp.b    #"f",parameter        : free  (no output)
  67.         beq    nosturctur
  68.         cmp.b    #"a",parameter        : all  (symboles)
  69.         beq    all
  70.         bsr    normmode
  71. all:        move.l    #printbuffer,tsource
  72.         move.l    #12,tlaenge
  73.         bsr    print
  74. nosturctur:
  75.         add    #11,curblock        
  76.         move    lasblock,d0
  77.         move    curblock,d1
  78.         add    #1,d0
  79.         cmp    d1,d0
  80.         bmi    endoftest
  81.         sub    #1,trackcount
  82.         bmi    newline
  83.         bra    newtrack
  84.  
  85.  
  86.         
  87.  
  88.  
  89. ****************************************************************************** 
  90. endoftest:    bsr    enter
  91.         bsr    printfree
  92.  
  93. ende:        lea     DiskIO,a1
  94.                 CALLEXEC CloseDevice            * Device schließen
  95.  
  96.  
  97.  
  98. Abort:        lea     ReplyPort,a1
  99.         CALLEXEC RemPort                * Port entfernen
  100.  
  101.  
  102.  
  103.  
  104.         move.l    DOSBase,a1        ;Basis der Lib
  105.         move.l  _SysBase,a6        ;Basis Exec
  106.             jsr     _LVOCloseLibrary(a6)    ;Funktion "Schliessen"
  107.  
  108.  
  109.  
  110. fini:        move.l    #0,d0
  111.         rts                ;Return zum CLI
  112.  
  113.  
  114.  
  115.  
  116. ******************* S U B R O U T I N E S *******************************
  117. compare0:
  118.         lea    buffer,a0
  119.         lea    printbuffer,a1
  120.         move.l    a0,a2
  121.         move    #11-1,d6        
  122. cp0_0:
  123.         cmp.b    #"1",(a1)
  124.         bne    cp0_e
  125.         move.l    a2,a0
  126.         move    #512-1,d7
  127. cp0_1:        cmp.b    #0,(a0)+
  128.         bne    cp0_e
  129.         dbf    d7,cp0_1    
  130.         move.b    #"0",(a1)
  131.         add    #1,emptyblocks
  132. cp0_e:    
  133.         lea    1(a1),a1
  134.         add.l    #512,a2
  135.         dbf    d6,cp0_0
  136.         rts
  137. comparedos:
  138.         lea    buffer,a0
  139.         lea    printbuffer,a1
  140.         move.l    a0,a2
  141.         move    #11-1,d6
  142. cpd_0:
  143.         clr    nibbelcount
  144.         move    #512-1,d7        
  145.         cmp.b    #"1",(a1)
  146.         bne    cpd_e1
  147.         move.l    a2,a0
  148.         move    #512-1,d7
  149. cpd_1:        cmp.b    #"D",(a0)+
  150.         beq    cpd_2
  151.         dbf    d7,cpd_1    
  152.         bra    cpd_e
  153. cpd_2:        cmp.b    #"O",(a0)+
  154.         beq    cpd_3
  155.         dbf    d7,cpd_1    
  156.         bra    cpd_e
  157. cpd_3:
  158. *        cmp.b    #"S",(a0)+
  159. *        beq    cpd_4
  160. *        dbf    d7,cpd_1    
  161. *        bra    cpd_e
  162. cpd_4:
  163.         add    #1,nibbelcount        
  164.         dbf    d7,cpd_1    
  165.         bra    cpd_e
  166.         
  167. cpd_e:    
  168.         cmp    #120,nibbelcount
  169.         bmi    cpd_e1
  170.         add    #1,emptyblocks
  171.         move.b    #"D",(a1)
  172. cpd_e1:        lea    1(a1),a1
  173.         add.l    #512,a2
  174.         dbf    d6,cpd_0
  175.         rts
  176. comparexcopy:
  177.         lea    buffer,a0
  178.         lea    printbuffer,a1
  179.         move.l    a0,a2
  180.         move    #11-1,d6
  181. cpx_0:
  182.         clr    nibbelcount
  183.         move    #512-1,d7        
  184.         cmp.b    #"1",(a1)
  185.         bne    cpx_e1
  186.         move.l    a2,a0
  187.         move    #512-1,d7
  188. cpx_1:        cmp.b    #"X",(a0)+
  189.         beq    cpx_2
  190.         dbf    d7,cpx_1    
  191.         bra    cpx_e
  192. cpx_2:        cmp.b    #"C",(a0)+
  193.         beq    cpx_3
  194.         dbf    d7,cpx_1    
  195.         bra    cpx_e
  196. cpx_3:
  197.         cmp.b    #"O",(a0)+
  198.         beq    cpx_4
  199.         dbf    d7,cpx_1    
  200.         bra    cpx_e
  201. cpx_4:
  202.         cmp.b    #"P",(a0)+
  203.         beq    cpx_5
  204.         dbf    d7,cpx_1    
  205.         bra    cpx_e
  206. cpx_5:
  207.         cmp.b    #"Y",(a0)+
  208.         beq    cpx_6
  209.         dbf    d7,cpx_1    
  210.         bra    cpx_e
  211. cpx_6:
  212.         add    #1,nibbelcount        
  213.         dbf    d7,cpx_1    
  214.         bra    cpx_e
  215.         
  216. cpx_e:    
  217.         cmp    #1,nibbelcount
  218.         bmi    cpx_e1
  219.         add    #1,emptyblocks
  220.         move.b    #"X",(a1)
  221. cpx_e1:        lea    1(a1),a1
  222.         add.l    #512,a2
  223.         dbf    d6,cpx_0
  224.         rts
  225.         
  226. clicommand:
  227.         move.l    clineadd,a0
  228.         move.l    clinelen,d0
  229.  
  230.         beq    cli_end    
  231.         cmp    #"df",(a0)+
  232.         bne    cli_2
  233.         moveq    #0,d0
  234.         move.b    (a0)+,d0
  235.         cmp.b    #$33,d0
  236.         bhi    cli_end
  237.         cmp.b    #$30,d0
  238.         bmi    cli_end
  239.         move.b    d0,dfx
  240.         sub.b    #$30,d0
  241.         move.l    d0,drive
  242.         add.l    #5,clineadd
  243.         sub.l    #5,clinelen
  244.         bra    cli_3
  245. cli_2:
  246.         move.l    clineadd,a0
  247.         cmp.b    #"?",(a0)
  248.         bne    cli_3
  249.         move.l    #help,tsource
  250.         move.l    #(helpe-help),tlaenge
  251.         bsr    print
  252.         bra    fini
  253. cli_3:        
  254.                 
  255.         bsr    ascii2dez
  256.  
  257.         cmp    #179,d3
  258.         bhi    cli_end
  259.         mulu    #11,d3
  260.         move    d3,curblock
  261.  
  262.         sub.l    #1,clinelen
  263.         add.l    #1,clineadd
  264.  
  265.         
  266.         cmp.l    #0,clinelen
  267.         ble    cli_end
  268.         bsr    ascii2dez
  269.         cmp    #179,d3
  270.         bhi    cli_end
  271.         mulu    #11,d3
  272.         cmp    curblock,d3
  273.         bmi    cli_end
  274.         move    d3,lasblock
  275.         
  276.  
  277. cli_end:
  278.         cmp.l    #0,clinelen
  279.         beq    cli_return
  280.             
  281. cli_para:
  282.         move.b    (a0),parameter
  283.         bra    cli_return
  284.  
  285. ascii2dez:
  286.  
  287.         move.l    clineadd,a0
  288.         move.l    clinelen,d7
  289.         sub    #1,d7
  290.  
  291.         moveq    #0,d0
  292.         moveq    #0,d1
  293.         moveq    #0,d2
  294.         moveq    #0,d3
  295.         move.b    (a0)+,d0
  296.         cmp.b    #$30,d0
  297.         bmi    cloop_3
  298.         cmp.b    #$39,d0
  299.         bhi    cloop_3
  300.         sub.b    #$30,d0        
  301.         move.b    d0,d1
  302.  
  303.         dbra    d7,cloop_1
  304.         bra    cli_4
  305. cloop_1:
  306.         sub.l    #1,clinelen
  307.         add.l    #1,clineadd
  308.         move.b    (a0)+,d0
  309.         cmp.b    #$30,d0
  310.         bmi    cli_4
  311.         cmp.b    #$39,d0
  312.         bhi    cli_4
  313.         sub.b    #$30,d0        
  314.         move.b    d0,d2
  315.         mulu    #10,d1
  316.  
  317.         dbra    d7,cloop_2
  318.         bra    cli_4
  319. cloop_2:
  320.  
  321.         sub.l    #1,clinelen
  322.         add.l    #1,clineadd
  323.         move.b    (a0)+,d0
  324.         cmp.b    #$30,d0
  325.         bmi    cli_4
  326.         cmp.b    #$39,d0
  327.         bhi    cli_4
  328.         sub.b    #$30,d0        
  329.         move.b    d0,d3
  330.         mulu    #10,d1
  331.         mulu    #10,d2        
  332.  
  333. cli_4:        add    d2,d3
  334.         add    d1,d3
  335. cloop_3:        rts
  336.  
  337.  
  338.  
  339.  
  340.         
  341. LoadBlock:    
  342.  
  343.  
  344.                 lea     DiskIO,a1                                         
  345.                 move.l  #ReplyPort,14(a1)        * Nachrichten-Port laden
  346.         move.w  #2,28(a1)        * Kommando: lesen         
  347.                 move.l  #512*11,36(a1)        * Länge: 512 Bytes * track
  348.                 move.l  #buffer,40(a1)        * Adresse
  349.         moveq    #0,d0
  350.                 move    curblock,d0
  351.                 asl.l    #8,d0
  352.                 asl.l    #1,d0            
  353.                 move.l    d0,44(a1)        * Byte-Offset startblock    
  354.         movem.l d1-d3/a1-a3,-(SP)               
  355.                 CALLEXEC DoIO            * und 'reinladen!         
  356.         movem.l (SP)+,d1-d3/a1-a3    
  357.         move    d0,error
  358.         beq    return
  359. errors:
  360. *        cmp.w    #29,error
  361. *        bne    error_1
  362.         move.l    #noDisk,tsource
  363.         move.l    #(noDiske-nodisk),tlaenge
  364.         bsr    print
  365.         move.l    (sp)+,a0
  366.         bra    ende
  367. error_1:    
  368.         bra    ende
  369. return:
  370.         rts                
  371.  
  372. normmode:
  373.         lea    printbuffer,a0
  374.         move    #11-1,d7
  375. nrmd_2:        cmp.b    #"1",(a0)
  376.         bne    nrmd_1
  377. nrmd_3:        lea    1(a0),a0
  378.         dbf    d7,nrmd_2
  379.         rts
  380. nrmd_1:        move.b    #".",(a0)
  381.         bra    nrmd_3
  382.         
  383. fillbuffer:
  384.         move.l    #"1111",printbuffer
  385.         move.l    #"1111",printbuffer+4
  386.         move.l    #"111 ",printbuffer+8
  387.         rts
  388. printfree:
  389.         lea    printbuffer,a0
  390.         move.l    #"Bloc",(a0)+
  391.         move.l    #"ks f",(a0)+
  392.         move.l    #"ree ",(a0)+
  393.         move    #": ",(a0)+
  394.  
  395.         move    emptyblocks,d2
  396.         move    emptyblocks,$60000
  397.     
  398.         move    d2,d1
  399.         divu    #1000,d1
  400.         tst    d1
  401.         beq    prfr_1
  402.         move.b    #"1",(a0)+
  403. prfr_1:        mulu    #1000,d1
  404.         sub    d1,d2
  405.         move    d2,d1
  406.         divu    #100,d1
  407.         add.b    #$30,d1
  408.         move.b    d1,(a0)+
  409.         sub.b    #$30,d1        
  410.         mulu    #100,d1
  411. prfr_2:        sub    d1,d2
  412.         move    d2,d1
  413.         divu    #10,d1
  414.         add.b    #$30,d1
  415.         move.b    d1,(a0)+
  416.         sub.b    #$30,d1        
  417.         mulu    #10,d1
  418. prfr_3:        sub    d1,d2
  419.         move    d2,d1
  420.         add.b    #$30,d1
  421.         move.b    d1,(a0)+
  422.  
  423.         
  424.         move.b    #10,(a0)+
  425.         
  426.         move.l    #printbuffer,tsource
  427.         move.l    #19,tlaenge
  428.         bsr    print
  429.         rts
  430.             
  431. trackprint:
  432.         moveq    #0,d0
  433.         move    curblock,d0
  434.         beq    trpri_0
  435. trpri_0:    divu    #11,d0
  436.         lea     printbuffer,a0
  437.         move.b    #"0",(a0)
  438.         cmp    #100,d0
  439.         bmi    trpri_1
  440.         move.b    #"1",(a0)
  441.         sub    #100,d0
  442. trpri_1:    
  443.         lea    1(a0),a0
  444.         move.l    d0,d1
  445.         divu    #10,d0                
  446.         move.b    d0,(a0)
  447.         add.b    #$30,(a0)+
  448.         mulu    #10,d0
  449.         sub    d0,d1
  450.         move.b    d1,(a0)
  451.         add.b    #$30,(a0)+
  452.         move.b    #":",(a0)+
  453.         move.b    #" ",(a0)+
  454.         move.l    #printbuffer,tsource
  455.         move.l    #5,tlaenge
  456.         bsr    print
  457.         rts
  458.  
  459. enter:        move.l    #enterc,tsource
  460.         move.l    #1,tlaenge
  461.         bsr    print
  462.         rts
  463.  
  464. Print:            move.l    DOSBase,a6        ;DOS-Funktion rufen    
  465.         jsr    _LVOOutput(a6)        ;Hole Output-Handle
  466.         move.l    d0,d1            ;und in d1 merken
  467.  
  468.         move.l    tsource,d2        ;Address Text
  469.         move.l    tlaenge,d3            ;Laenge Text
  470.             move.l  DOSBase,a6             ;Basis DOS
  471.         jsr    _LVOWrite(a6)        ;Funktion "Schreiben"
  472.         rts
  473.  
  474. *********************** Datenbereich **********************************
  475. nibbelcount:    dc.w    0        * Zähler für Dos,Xcopy,bla
  476. trackcount:    dc.w    0        * Zähler für tracks in einer zeile
  477. emptyblocks:    dc.w    0        * anzahl leerer blöcke 
  478. curblock:    dc.w    0        * akueller track     
  479. lasblock:    dc.w    1749        * letzer track
  480.  
  481. clineadd:    dc.l    0        * cli-command
  482. clinelen:    dc.l    0        * cli-command
  483. parameter:    dc.w    0        * Cli-parameter
  484.  
  485. error:        dc.w    0        * ErrorStatus
  486. drive:        dc.l    0        * DFx (?)
  487. *********************** Datenbereich **********************************
  488.  
  489. tsource:    dc.l    0
  490. tlaenge:    dc.l    0
  491. DiskIO:         ds.b     80                         * IOStdReq-Record
  492. ReplyPort:      ds.b     34                         * MsgPort-Record
  493. DevName:        dc.b     "trackdisk.device",0
  494.          even
  495.  
  496. Memory:         dc.l    0
  497.  
  498. DOSBase:     dc.l    0
  499. dosname:    dc.b    'dos.library',0
  500.          even
  501.  
  502. help:        
  503.         dc.b    "DYTEC-Intern-Release 07/09/92 ",10
  504.         dc.b    "Searching: zero-blocks        :     0 ",10
  505.         dc.b    "           DOS & DOW -blocks  :     D ",10 
  506.         dc.b    "           XCOPY-blocks       :     X ",10
  507.         dc.b    "           used block         :     1 ",10,10
  508.         dc.b    "Usage: Trackcheck [drive] [starttrack] [endtrack]"
  509.         dc.b    " [parameter]",10,10
  510.         dc.b    "parameter: n - normal mode (default)",10
  511.         dc.b    "           a - all infos about da block",10
  512.         dc.b    "           f - only the blocksfreedisplay",10
  513.         dc.b    10,"Test it, but don`t spread it out of Dytec!",10
  514.         
  515. helpe:        even    
  516.  
  517. text1:        dc.b       $1B,$5B,$31,$6D,"Track-Checker "
  518.         dc.b    $1B,$5B,$3b,$6D,"V1.00 by Grain/Dytec",10
  519. text1e:        even
  520. search        dc.b    "is now searching for empty Blocks in DF"
  521. dfx:        dc.b    "0:",10
  522. searche:        even
  523. noDisk:        dc.b    "No Disk in Drive!",10
  524. noDiske:    even
  525. noDrive:    dc.b    "Drive not found!",10
  526. noDrivee:    even
  527. nul:        dc.b    "0"
  528.         even
  529. one:        dc.b    "1"
  530.         even
  531. next:        dc.b    "."
  532.         even
  533. enterc:        dc.b    10
  534.         even
  535.  
  536.  
  537.                 section sectors,bss_p
  538. printbuffer:    ds.b    100
  539. buffer:        ds.b    512*11            * Trackbuffer
  540. blk0:           ds.b    512          
  541. blk1:           ds.b    512
  542.  
  543.