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

  1.     org    $10f5a6
  2.     load    $10f5a6
  3.  
  4. P    MOVEM.L    d1-a6,-(SP)
  5.     ext.l    d1
  6.     ext.l    d2
  7.     mulu    #$200,d1
  8.     mulu    #$200,d2
  9.     lea    buf(pc),a2
  10.     lea    CurrTrk(pc),a4
  11.     sf    1(a4)
  12.     LEA    $BFD100,A5
  13.     LEA    $DFF000,A6
  14.     addq.w    #3,d0
  15.     move.w    d0,.DRV-CurrTrk(A4)
  16.     MOVE.L    d2,-(a7)
  17.     MOVE.L    A0,-(A7)
  18.     MOVE.L    a1,.Diskbuf-CurrTrk(A4)
  19.     divu    #$200,d1
  20.     moveq    #0,d7
  21.     move.w    d1,d7
  22.     clr.w    d1
  23.     swap    d1
  24.     move.l    d1,-(A7)
  25. .nxt    move.w    #7,(A7)
  26. .t    subq.w    #1,(a7)
  27.     bmi.s    .err
  28.     BSR.B    .loadsector
  29.     tst.w    d0
  30.     bne.s    .t
  31.     lea    $200(a0),a3
  32.     add.w    2(a7),a0
  33.     move.l    4(a7),a1
  34. .t1    move.b    (a0)+,(a1)+
  35.     subq.l    #1,8(a7)
  36.     beq.s    .end
  37.     cmp.l    a3,a0
  38.     blt.s    .t1
  39.     move.l    a1,4(a7)
  40.     clr.w    2(a7)
  41.     addq.l    #1,d7
  42.     bra.s    .nxt
  43. .end    moveq    #0,d0
  44. .exit    move.b    #$ff,(a5)
  45.     and.b    #$87,(a5)
  46.     move.b    #$ff,(A5)
  47.     add.w    #12,a7
  48.     movem.l    (A7)+,d1-a6
  49.     rts
  50. .err    ST    (A4)
  51.     bra.s    .exit
  52.  
  53. .loadsector
  54.     MOVE.L    D7,D0
  55.     DIVU    #11,D0
  56.     tst.b    1(a4)
  57.     beq.s    .wg
  58.     CMP.B    (A4),D0
  59.     BEQ.W    .trkfnd
  60. .wg    st    1(a4)
  61.     move.w    #$4489,a0
  62.     MOVE.W    a0,$7e(A6)
  63.     MOVE.W    #$7F00,$9e(A6)
  64.     MOVE.L    #$55555555,D2
  65. .l0    move.b    #$7D,d1
  66.     MOVE.B    d1,(a5)
  67.     move.w    #0,d3
  68. .DRV    equ    *-2
  69.     bclr    d3,d1
  70.     MOVE.B    d1,(a5)
  71.     move.w    #30,d4
  72. .rr    bsr.w    timeita
  73.     BTST    #5,$F01(A5)
  74.     dbeq    d4,.rr
  75.     tst.w    d4
  76.     bmi.w    error1
  77.     cmp.b    #-1,(A4)
  78.     Bne.S    .notrk0
  79. .l1    BTST    #4,$F01(A5)
  80.     BEQ.S    .trk0
  81.     BSR.W    StepheadBack
  82.     BRA.S    .l1
  83. .trk0    CLR.B    (A4)
  84. .notrk0    MOVE.L    D0,D1
  85.     BCLR    #0,D1
  86.     BCLR    #0,(A4)
  87.     CMP.B    (A4),D1
  88.     BEQ.S    .oktrk
  89.     BCS.S    .l2
  90.     BSR.W    StepHeadFor
  91.     ADDQ.B    #2,(A4)
  92.     BRA.S    .notrk0
  93. .l2    BSR.W    StepheadBack
  94.     SUBQ.B    #2,(A4)
  95.     BRA.S    .notrk0
  96. .oktrk    BTST    #0,D0
  97.     BEQ.S    .Sside0
  98.     ADDQ.B    #1,(A4)
  99.     BCLR    #2,(A5)
  100. .Sside0    MOVEQ    #11,D3
  101.     MOVE.W    #$4000,$24(A6)
  102.     move.l    #0,A3
  103. .Diskbuf    equ    *-4
  104.     MOVE.L    A3,$20(A6)
  105.     CLR.L    $440(A3)
  106.     MOVE.W    #$8210,$96(A6)
  107.     MOVE.L    #$29500,$9c(A6)
  108.     move.w    #$9960,d4
  109.     MOVE.W    d4,$24(A6)
  110.     MOVE.W    d4,$24(A6)
  111. .waitb    TST.L    $440(A3)
  112.     BEQ.S    .waitb
  113. .Nexts    CMP.W    (A3)+,a0
  114.     BEQ.S    .Nexts
  115.     SUBQ.W    #2,A3
  116.     BSR.S    Decode1L
  117.     MOVE.L    D5,D4
  118.     SWAP    D4
  119.     CMP.B    (A4),D4
  120.     BEQ.S    .oksector
  121.     ST     (A4)
  122. .error1    BRA.W    .l0
  123.  
  124. .oksector
  125.     LSR.W    #8,D5
  126.     LSL.W    #2,D5
  127.     MOVE.W    D5,D6
  128.     ADD.W    #$28,A3
  129.     BSR.S    Decode1L
  130.     MOVE.L    A3,(A2,D6.W)
  131.     MOVEQ    #$7F,D4
  132. .decode    MOVE.L    (A3),D1
  133.     MOVE.L    $200(A3),D6
  134.     AND.L    D2,D1
  135.     AND.L    D2,D6
  136.     EOR.L    D1,D5
  137.     EOR.L    D6,D5
  138.     ADD.L    D1,D1
  139.     OR.L    D1,D6
  140.     MOVE.L    D6,(A3)+
  141.     DBF    D4,.decode
  142.     TST.L    D5
  143.     BNE.S    .error1
  144.     SUBQ.B    #1,D3
  145.     BEQ.S    .trkfnd
  146.     add.w    #$200,a3
  147. .w    btst    #1,$1f(a6)
  148.     beq.s    .w
  149. .w2    CMP.W    (A3)+,a0
  150.     BNE.S    .w2
  151.     BRA.S    .Nexts
  152. .trkfnd    SWAP    D0
  153.     LSL.W    #2,D0
  154.     MOVE.L    (A2,d0.w),A0
  155.     moveq    #0,d0
  156.     RTS
  157. error    st    (A4)
  158.     moveq    #-3,d0
  159.     rts
  160. error1    st    (A4)
  161.     moveq    #$1e,d0
  162.     rts
  163. Decode1L
  164.     MOVE.L    (A3)+,D4
  165.     MOVE.L    (A3)+,D5
  166.     AND.L    D2,D4
  167.     AND.L    D2,D5
  168.     ADD.L    D4,D4
  169.     OR.L    D4,D5
  170.     RTS
  171. StepheadBack
  172.     BSET    #1,(A5)
  173.     BRA.S    Stepit
  174. StepHeadFor
  175.     BCLR    #1,(A5)
  176. Stepit    BCLR    #0,(A5)
  177.     BSET    #0,(A5)
  178.     bra.s    timeit
  179.  
  180. timeita    MOVE.B    #$40,$600(A5)
  181.     bra    timeit1
  182. timeit    MOVE.B    #$10,$600(A5)
  183. timeit1    MOVE.B    #0,$500(A5)
  184.     MOVE.B    #$19,$E00(A5)
  185. .w1    BTST    #0,$E00(A5)
  186.     BNE.S    .w1
  187.     rts
  188. CurrTrk    dc.w    $FF00
  189. buf    blk.b    $2c,0
  190. jend
  191.