home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d537 / paulcopy.lha / PaulCopy / pc.s < prev    next >
Text File  |  1991-08-26  |  16KB  |  797 lines

  1.  
  2. *****************************************
  3. *                *
  4. *          PAULCOPY        *
  5. *    Single Drive DiskCopy    *
  6. *    (C) 1990 Paul Hayter    *
  7. *    V2    910106        *
  8. *                *
  9. *****************************************
  10.  
  11. * TRY ALTERNATE METHOD OF ALLOCATING 5.5K CHUNKS AND ALSO USING A SINGLE PLANE
  12. * Now (0.04) ONLY ALLOCATE 159 5.5K CHUNKS AND ONLY READ ONE SECTOR FROM LAST TRACK
  13.  
  14. * Now (0.07) WILL COPY IN 3 SWAPS ON 512K MACHINES
  15. *    Note: has big bug which stuffs up all destination tracks where only
  16. *    one sector is read/written.
  17.     
  18. * Now (0.08) WILL ALSO COPY ON DF1: ,IF YOU TYPE 1> PAULCOPY DF1:
  19. * Now (1.00) MEGADISC RELEASE VERSION
  20. * Now (1.01) Open little dos window. Removed ability to copy on df1:
  21. *       Also can start from Workbench.
  22. * Now (II)   Changed title, so that ONE SWAP appears in title bar.
  23.     
  24. _LVORemakeDisplay        equ    -384
  25. _LVOAllocRaster        equ    -492
  26. _LVOFreeRaster        equ    -498
  27. _LVOBltClear        equ    -300
  28.  
  29. _LVOAllocMem        equ    -198
  30. _LVOFreeMem        equ    -210
  31. _LVOAvailMem        equ    -216
  32.  
  33. _LVOOpenLibrary        equ    -552
  34. _LVOCloseLibrary        equ    -414
  35. _LVOFindTask        equ    -294
  36. _LVOForbid        equ    -132
  37. _LVOPermit        equ    -138
  38. _LVOCopyMemQuick        equ    -630
  39. _LVOReplyMsg        equ    -378
  40.  
  41.  
  42. _LVOPutMsg        equ    -366
  43. _LVOGetMsg        equ    -372
  44. _LVOWaitPort        equ    -384
  45.  
  46. _LVOOpenDevice        equ    -444
  47. _LVOCloseDevice        equ    -450
  48. _LVODoIO            equ    -456
  49.  
  50. _LVOWrite            equ    -48
  51. _LVORead            equ    -42
  52. _LVOInput            equ    -54
  53. _LVOOutput        equ    -60
  54. _LVODeviceProc        equ    -174
  55. _LVOOpen            equ    -30
  56. _LVOClose            equ    -36
  57.     
  58.  
  59. pr_CLI            equ    172
  60. pr_MsgPort        equ    92
  61. bm_Planes_1        equ    8+4
  62. rp_BitMap            equ    4
  63. sc_RastPort        equ    84
  64. sc_BitMap            equ    184
  65. ActiveScreen        equ    56
  66. bm_Depth            equ    5
  67. sc_Width            equ    12
  68. sc_Height            equ    14
  69.  
  70. PortA        equ    $bfe001
  71. LeftMouse        equ    6
  72.  
  73. MODE_NEWFILE        equ    1006
  74.     
  75. *************
  76. * exec/io.i *
  77. *************
  78.  
  79. IO_DEVICE               EQU  $14   ;IO Request Structure
  80. IO_UNIT                 EQU  $18
  81. IO_COMMAND              EQU  $1C
  82. IO_FLAGS                EQU  $1E
  83. IO_ERROR                EQU  $1F
  84. IO_SIZE                 EQU  $20
  85.  
  86. IO_ACTUAL               EQU  $20
  87. IO_LENGTH               EQU  $24
  88. IO_DATA                 EQU  $28
  89. IO_OFFSET               EQU  $2C
  90. IOSTD_SIZE              EQU  $30
  91.  
  92. IOF_QUICK               EQU  1<<0  ;IO_FLAGS bit definitions
  93.  
  94. CMD_INVALID             EQU  0     ;Standard Device Commands
  95. CMD_RESET               EQU  1
  96. CMD_READ                EQU  2
  97. CMD_WRITE               EQU  3
  98. CMD_UPDATE              EQU  4
  99. CMD_CLEAR               EQU  5
  100. CMD_STOP                EQU  6
  101. CMD_START               EQU  7
  102. CMD_FLUSH               EQU  8
  103. CMD_NONSTD              EQU  9
  104.  
  105. * ALLOCATION GUNK
  106. MEMF_PUBLIC             EQU  1<<0  ;Memory Options
  107. MEMF_CHIP               EQU  1<<1
  108. MEMF_FAST               EQU  1<<2
  109. MEMF_CLEAR              EQU  1<<16
  110. MEMF_LARGEST            EQU  1<<17
  111.  
  112. ***********************
  113. * devices/trackdisk.i *
  114. ***********************
  115.  
  116. NUMCYLS                    EQU  80   ;Physical drive constants
  117. MAXCYLS                    EQU  NUMCYLS+20
  118. NUMSECS                    EQU  11
  119. NUMHEADS                   EQU  2
  120. MAXRETRY                   EQU  10
  121. NUMTRACKS                  EQU  NUMCYLS*NUMHEADS
  122. NUMUNITS                   EQU  4
  123.  
  124. TD_SECTOR                  EQU  512
  125. TD_SECSHIFT                EQU  9
  126.  
  127.  
  128. TDF_EXTCOM                 EQU  1<<15
  129.  
  130. TD_MOTOR                   EQU  9
  131. TD_SEEK                    EQU  10
  132. TD_FORMAT                  EQU  11
  133. TD_REMOVE                  EQU  12
  134. TD_CHANGENUM               EQU  13
  135. TD_CHANGESTATE             EQU  14
  136. TD_PROTSTATUS              EQU  15
  137. TD_LASTCOMM                EQU  TD_PROTSTATUS
  138.  
  139. ETD_WRITE                  EQU  CMD_WRITE!TDF_EXTCOM
  140. ETD_READ                   EQU  CMD_READ!TDF_EXTCOM
  141. ETD_MOTOR                  EQU  TD_MOTOR!TDF_EXTCOM
  142. ETD_SEEK                   EQU  TD_SEEK!TDF_EXTCOM
  143. ETD_FORMAT                 EQU  TD_FORMAT!TDF_EXTCOM
  144. ETD_UPDATE                 EQU  CMD_UPDATE!TDF_EXTCOM
  145. ETD_CLEAR                  EQU  CMD_CLEAR!TDF_EXTCOM
  146.  
  147. IOTD_COUNT                 EQU  $30   ;IOEXTTD Structure
  148. IOTD_SECLABEL              EQU  $34
  149. IOTD_SIZE                  EQU  $38
  150.  
  151. TD_LABELSIZE               EQU  16
  152.  
  153. TDERR_NotSpecified         EQU  20
  154. TDERR_NoSecHdr             EQU  21
  155. TDERR_BadSecPreamble       EQU  22
  156. TDERR_BadSecID             EQU  23
  157. TDERR_BadHdrSum            EQU  24
  158. TDERR_BadSecSum            EQU  25
  159. TDERR_TooFewSecs           EQU  26
  160. TDERR_BadSecHdr            EQU  27
  161. TDERR_WriteProt            EQU  28
  162. TDERR_DiskChanged          EQU  29
  163. TDERR_SeekError            EQU  30
  164. TDERR_NoMem                EQU  31
  165. TDERR_BadUnitNum           EQU  32
  166. TDERR_BadDriveType         EQU  33
  167. TDERR_DriveInUse           EQU  34
  168.  
  169.  
  170. START
  171.     move.l    a7,entry_stack
  172.     move.l    (4).w,a6
  173.     sub.l    a1,a1
  174.     jsr    _LVOFindTask(a6)
  175.     move.l    d0,a4
  176. ;------ are we running as a son of Workbench?
  177.     tst.l    pr_CLI(A4)
  178.     bne.s    start2
  179. fromWB
  180. waitmsg
  181.     lea    pr_MsgPort(A4),a0     * our process base
  182.     jsr    _LVOWaitPort(a6)
  183.     lea    pr_MsgPort(A4),a0     * our process base
  184.     jsr    _LVOGetMsg(a6)
  185.     move.l    d0,_WBenchMsg
  186. ;------ push the message on the stack for wbmain
  187.     move.l    d0,-(SP)
  188.     clr.l    -(SP)    indicate: run from Workbench
  189.     bsr    start2    I KNOW (WEIRD) JUST WANTED THE STACK RIGHT.
  190.  
  191.  
  192. start2    move.l    #9000000,d0
  193.     moveq    #0,d1
  194.     jsr    _LVOAllocMem(a6)    kills any resident libraries.
  195.     tst.l    d0
  196.     beq.s    1$
  197.     move.l    d0,a1
  198.     move.l    #9000000,d0
  199.     jsr    _LVOFreeMem(a6)
  200. 1$    lea    dosname,a1
  201.     moveq    #0,d0
  202.     jsr    _LVOOpenLibrary(a6)        A6=EXECBASE
  203.     move.l    d0,dosbase
  204.  
  205.     lea    gfxname(pc),a1
  206.     moveq    #0,d0
  207.     jsr    _LVOOpenLibrary(a6)
  208.     move.l    d0,gfxbase
  209.     lea    intname(pc),a1
  210.     moveq    #0,d0
  211.     jsr    _LVOOpenLibrary(a6)
  212.     move.l    d0,intbase
  213.     bsr    cut_plane
  214. *    bra.s    close_int
  215. *    bsr    pr_tit        TITLE
  216. allocate_chunks
  217.     bsr    allocate_chip_half_track
  218.     move.l    d0,a5            A5 = CHIP HALF TRACK
  219.     move.w    #159-2,d7            ALLOCATE 158 5.5K bits
  220. all_ch1    move.l    d0,-(a7)            ????????????????????????
  221.     bsr    allocate_half_track
  222.     tst.l    d0
  223.     dbeq    d7,all_ch1
  224.     addq.w    #2,d7
  225.     move.w    #159,d6
  226.     sub.w    d7,d6
  227.     move.w    d6,dealloc_count    SHOULD=158 IF ALL OK
  228.     tst.l    d0
  229.     beq.s    init_port        BRANCH IF ABLE TO FULLY ALLOCATE FOR DISK
  230. *    beq.s    not_enough_mem
  231.     move.l    d0,-(a7)
  232.     move.b    #$20,title_delimiter
  233.  
  234. init_port
  235.     bsr    open_window
  236.     sub.l    a1,a1
  237.     jsr    _LVOFindTask(a6)
  238.     lea    DiskPort(pc),a0
  239.     move.l    d0,16(a0)
  240. open_disk_device
  241.     lea    DiskName(pc),a0
  242.     moveq    #0,d0    Unit num
  243.     move.b    msg2_drive(pc),d0
  244.     sub.b    #'0',d0
  245.     moveq    #0,d1
  246.     lea    DiskIOReq(pc),a4        A4 = DISKIOREQ
  247.     move.l    a4,a1
  248.     jsr    _LVOOpenDevice(a6)
  249.     tst.l    d0
  250.     bne    not_enough_mem
  251. *DOS INHIBIT NOW!
  252.     moveq    #-1,d7
  253.     bsr    dos_inhibit
  254.  
  255. round1    clr.l    last_offset
  256.     move.b    #'0',last_digit1
  257.     move.b    #'0',last_digit2
  258.     move.b    #'0',last_surface1
  259.  
  260. round2    bsr    pr_src            ASK FOR SOURCE DISK
  261.     bsr    wait_for_return
  262.     bne    check_mouse3
  263.  
  264.  
  265.  
  266.     
  267. * WAIT FOR DISK INSERTION
  268. wait1    bsr    check_changestate
  269.     tst.l    d1
  270.     bne.s    wait1
  271.  
  272.     bsr    motor_on
  273.     bsr    pr_rdg        SAY "READING..."
  274.     bsr    restore_last
  275. *    MOVEQ    #0,D7        D7 = IO_OFFSET (ie sector number)
  276. *    MOVEQ    #0,D6        D6 = HALF TRACK COUNT
  277.     move.l    d7,first_offset
  278.     move.l    a7,a3        A3 = PSEUDO STACK PTR
  279.     move.w    dealloc_count(pc),d6
  280. loop1    bsr    read_half_track
  281.     tst.b    IO_ERROR(A4)
  282.     beq.s    no_error
  283.     bsr    pr_bad        PRINT BAD TRACK
  284. no_error    bsr    check_mouse
  285.     subq.w    #1,d6        DEC HALF TRACK COUNT
  286.     
  287.     bmi    read_finished
  288.     cmp.l    #889856,d7    MAGIC NUMBER=2*79*11*512
  289.     beq.s    read_finished
  290.     move.l    #NUMSECS*TD_SECTOR,d0
  291.     move.l    a5,a0
  292.     move.l    (a3)+,a1
  293.     jsr    _LVOCopyMemQuick(a6)    transfer sector to public mem
  294.     add.l    #NUMSECS*TD_SECTOR,d7
  295.     bra.s    loop1
  296.  
  297. read_finished
  298.     bsr    read_last_sector
  299.     tst.b    IO_ERROR(A4)
  300.     beq.s    no_error79
  301.     bsr    pr_bad        ATTENTION !! BAD SECTOR
  302. no_error79
  303.     bsr    motor_off
  304.     bsr    save_last
  305.  
  306. wait3    bsr    pr_msg2        TELL USER TO PUT DESTINATION DISK IN
  307. wait600    bsr    wait_for_return
  308.     bne    check_mouse2    RETURN WAS NOT PRESSED
  309. wait2    bsr    check_changestate
  310.     tst.l    d1
  311.     bne.s    wait2
  312.     bsr    check_write_protect
  313.     tst.l    d1
  314.     beq.s    write_enabled
  315.     bsr    pr_wpt
  316.     bra.s    wait600
  317. write_enabled
  318.     bsr    motor_on
  319.     bsr    pr_wtg
  320.     bsr    write_last_sector    VERY IMPORTANT
  321.     
  322.     MOVE.W    dealloc_count(pc),D5    WRITE LAST 159 TRACKS
  323. wloop1    bsr    write_half_track    WRITE BACK LAST TRACK READ
  324.     move.l    -(a3),a0
  325.     move.l    a5,a1
  326.     move.l    #NUMSECS*TD_SECTOR,d0
  327.     jsr    _LVOCopyMemQuick(a6)
  328.     cmp.l    first_offset(pc),d7
  329.     beq.s    wexit1
  330.     sub.l    #NUMSECS*TD_SECTOR,d7
  331.     bsr    check_mouse
  332.     dbf    d5,wloop1
  333. wexit1
  334.     bsr    pr_msg1
  335.     bsr    motor_off
  336.  
  337.  
  338. close_trackdisk
  339.     move.l    last_offset(pc),d0
  340.     cmp.l    #901120,d0    MAGIC NUMBER=11*2*80*512
  341.     bne    round2
  342. once_more    bsr    pr_opt        ASK TO COPY AGAIN
  343.     bsr    wait_for_return
  344.     beq    round1
  345.     cmp.b    #'y',d0
  346.     beq    round1
  347. not_enough_mem_ui    
  348.     moveq    #0,d7
  349.     bsr    dos_inhibit    UN INHIBIT
  350.     move.l    a4,a1
  351.     jsr    _LVOCloseDevice(a6)
  352.  
  353. not_enough_mem
  354.     move.w    dealloc_count(pc),d7
  355. nem_1    move.l    (a7)+,a1
  356.     bsr    free_half_track
  357.     dbf    d7,nem_1
  358.     
  359.     bsr    return_plane
  360. close_int    move.l    intbase(pc),a1
  361.     jsr    _LVOCloseLibrary(a6)
  362.  
  363. close_gfx    move.l    gfxbase(pc),a1
  364.     jsr    _LVOCloseLibrary(a6)
  365.     bsr    close_window
  366. close_dos    move.l    dosbase(pc),a1
  367.     jsr    _LVOCloseLibrary(a6)
  368. the_end    move.l    entry_stack,SP    ; restore stack pointer
  369.     tst.l    _WBenchMsg
  370.     beq.s    exitToDOS
  371.     jsr    _LVOForbid(a6)
  372.     move.l    _WBenchMsg,a1
  373.     jsr    _LVOReplyMsg(a6)
  374.  
  375. exitToDOS    moveq    #0,d0
  376.     rts
  377.  
  378.  
  379. check_mouse
  380.     btst    #LeftMouse,PortA
  381.     bne.s    no_button
  382.     move.l    (a7)+,d0
  383. check_mouse2
  384.     bsr    motor_off
  385. *    move.l    a4,a1
  386. *    jsr    _LVOCloseDevice(a6)
  387. check_mouse3
  388.     bsr    pr_abort
  389.     bra    once_more
  390. no_button    rts
  391.  
  392.  
  393. read_last_sector
  394.     move.w    #CMD_READ,IO_COMMAND(A4)
  395.     bsr    pr_msg1
  396.     bsr.s    inc_half_track_count
  397.  
  398. rls2    lea    last_sector,a0
  399.     move.l    A0,IO_DATA(A4)
  400.     move.l    d7,d0
  401.     add.l    #NUMSECS*TD_SECTOR,d0    V0.08 has fixed bug.
  402.     move.l    D0,IO_OFFSET(A4)
  403.     move.l    #TD_SECTOR,IO_LENGTH(A4)    READ 0.5K
  404.     bra.s    rd3
  405.  
  406. write_last_sector
  407.     move.w    #CMD_WRITE,IO_COMMAND(A4)
  408.     bsr.s    dec_half_track_count
  409.     bsr    pr_msg1
  410.     bra.s    rls2
  411.  
  412. write_half_track
  413.     move.w    #TD_FORMAT,IO_COMMAND(A4)
  414.     bsr.s    dec_half_track_count
  415.     bsr    pr_msg1
  416.     bra.s    rd2
  417.  
  418. read_half_track
  419.     bsr    pr_msg1
  420.     bsr.s    inc_half_track_count
  421.     move.w    #CMD_READ,IO_COMMAND(A4)
  422. rd2    move.l    A5,IO_DATA(A4)
  423.     move.l    D7,IO_OFFSET(A4)
  424.     move.l    #NUMSECS*TD_SECTOR,IO_LENGTH(A4)    READ/WRITE 5.5K
  425. rd3    move.l    a4,a1
  426.     jsr    _LVODoIO(a6)
  427.     rts
  428.  
  429. inc_half_track_count
  430.     lea    surface1(pc),a2
  431.     addq.b    #1,(a2)
  432.     cmp.b    #$32,(a2)
  433.     bne.s    us_2
  434.     move.b    #$30,(a2)
  435.     lea    digit1+2(pc),a2
  436. us_1    addq.b    #1,-(a2)
  437.     cmp.b    #$3a,(a2)
  438.     bne.s    us_2
  439.     move.b    #$30,(a2)
  440.     bra.s    us_1
  441. us_2    rts
  442.  
  443. dec_half_track_count
  444.     lea    surface1(pc),a2
  445.     subq.b    #1,(a2)
  446.     cmp.b    #$2f,(a2)
  447.     bne.s    us_2
  448.     move.b    #$31,(a2)
  449.     lea    digit1+2(pc),a2
  450. us_3    subq.b    #1,-(a2)
  451.     cmp.b    #$2f,(a2)
  452.     bne.s    us_4
  453.     move.b    #$39,(a2)
  454.     bra.s    us_3
  455. us_4    rts
  456.     
  457.  
  458. wait_for_return
  459. * RETURN EQUAL- return pressed
  460.     move.l    a6,-(a7)
  461.     lea    in_buffer(pc),a0
  462.     move.l    a0,d2
  463.     moveq    #1,d3
  464.     move.l    in_handle(pc),d1
  465.     move.l    dosbase(pc),a6
  466.     jsr    _LVORead(a6)
  467.     move.l    (a7)+,a6
  468.     move.b    in_buffer(pc),d0
  469.     cmp.b    #13,d0
  470.     rts
  471.  
  472. motor_on
  473.     move.l    #1,IO_LENGTH(a4)
  474. do_mtr    move.w    #TD_MOTOR,IO_COMMAND(a4)
  475.     move.l    a4,a1
  476.     jsr    _LVODoIO(a6)
  477.     rts
  478.  
  479. motor_off
  480.     clr.l    IO_LENGTH(a4)
  481.     bra.s    do_mtr
  482.  
  483.  
  484. check_write_protect
  485. * RETURN D1=0 (write enable) D1<>0 (write protect)
  486.     move.w    #TD_PROTSTATUS,IO_COMMAND(A4)
  487.     bra.s    check2
  488.  
  489. check_changestate
  490. * RETURN D1=0 (disk in drive) D1<>0 (no disk present)
  491.     move.w    #TD_CHANGESTATE,IO_COMMAND(a4)
  492. check2    move.l    a4,a1
  493.     jsr    _LVODoIO(a6)
  494.     move.l    IO_ACTUAL(a4),d1
  495.     rts
  496.  
  497. pr_src    lea    msg5(pc),a0
  498.     moveq    #msg5_end-msg5,d3
  499.     bra.s    write_text
  500. pr_opt    lea    opt_text(pc),a0
  501.     moveq    #opt_text_end-opt_text,d3
  502.     bra.s    write_text
  503. pr_bad    lea    bad_text(pc),a0
  504.     moveq    #bad_text_end-bad_text,d3
  505.     bra.s    write_text
  506. pr_abort    lea    abort_text(pc),a0
  507.     moveq    #abort_text_end-abort_text,d3
  508.     bra.s    write_text
  509. pr_wpt    lea    wr_prot_txt(pc),a0
  510.     moveq    #wr_prot_txt_end-wr_prot_txt,d3
  511.     bra.s    write_text
  512. pr_rdg    lea    reading_text(pc),a0
  513.     moveq    #reading_text_end-reading_text,d3
  514.     bra.s    write_text
  515. pr_wtg    lea    writing_text(pc),a0
  516.     moveq    #writing_text_end-writing_text,d3
  517.     bra.s    write_text
  518. pr_msg1    lea    msg1(pc),a0
  519.     moveq    #msg1_end-msg1,d3
  520.     bra.s    write_text
  521. pr_msg2    lea    msg2(pc),a0
  522.     moveq    #msg2_end-msg2,d3
  523.     
  524. write_text
  525. * ENTRY A0 = text string, D3 = length
  526.     move.l    a6,-(a7)
  527.     move.l    a0,d2
  528.     move.l    out_handle(pc),d1
  529.     move.l    dosbase(pc),a6
  530.     jsr    _LVOWrite(a6)
  531.     move.l    (a7)+,a6
  532.     rts
  533.  
  534. open_window
  535.     move.l    a6,-(a7)
  536.     move.l    #MODE_NEWFILE,d2
  537.     lea    title(pc),a0
  538.     move.l    a0,d1
  539.     move.l    dosbase(pc),a6
  540.     jsr    _LVOOpen(a6)
  541.     move.l    d0,out_handle
  542.     move.l    d0,in_handle
  543.     move.l    (a7)+,a6
  544.     rts
  545.  
  546. close_window
  547.     move.l    a6,-(a7)
  548.     move.l    dosbase(pc),a6
  549.     move.l    out_handle(pc),d1
  550.     jsr    _LVOClose(a6)
  551.     move.l    (a7)+,a6
  552.     rts
  553.     
  554. allocate_chip_half_track
  555. * RETURN D0 = BLOCK ADDR
  556.     moveq    #MEMF_CHIP,d1
  557.     bra.s    alc_tk_2
  558. allocate_half_track
  559.     moveq    #0,d1
  560. alc_tk_2    move.l    #NUMSECS*TD_SECTOR,d0    allocate 5.5K
  561.     jsr    _LVOAllocMem(a6)
  562.     rts
  563.  
  564. free_half_track
  565. * ENTRY A1= BLOCK ADDR
  566.     move.l    #NUMSECS*TD_SECTOR,d0
  567.     jsr    _LVOFreeMem(a6)
  568.     rts
  569.  
  570. cut_plane
  571.     move.l    a6,-(a7)
  572.     bsr.s    get_plane_count
  573.     cmp.b    #1,d0
  574.     ble.s    already_cut
  575.     move.l    bm_Planes_1(a3),a0
  576.     move.w    sc_Width(a4),d0
  577.     move.w    sc_Height(a4),d1
  578.     move.l    gfxbase(pc),a6
  579.     jsr    _LVOFreeRaster(a6)
  580.     subq.b    #1,bm_Depth(a3)
  581.     move.l    a5,a6
  582.     jsr    _LVORemakeDisplay(a6)
  583. already_cut
  584.     move.l    (a7)+,a6
  585.     rts
  586.  
  587. return_plane
  588.     move.l    a6,-(a7)
  589.     bsr.s    get_plane_count
  590.     cmp.b    #1,d0
  591.     bgt.s    not_cut
  592.     move.w    sc_Width(a4),d0
  593.     move.w    sc_Height(a4),d1
  594.     move.l    gfxbase(pc),a6
  595.     jsr    _LVOAllocRaster(a6)
  596.     move.l    d0,bm_Planes_1(a3)
  597.     move.l    d0,a1        MEMORY
  598.     moveq    #0,d1        FLAGS
  599.     moveq    #0,d0
  600.     move.w    sc_Width(a4),d0
  601.     lsr.w    #3,d0
  602.     mulu    sc_Height(a4),d0    SIZE
  603.     jsr    _LVOBltClear(a6)
  604.     addq.b    #1,bm_Depth(a3)
  605.     move.l    a5,a6
  606.     jsr    _LVORemakeDisplay(a6)
  607. not_cut    move.l    (a7)+,a6
  608.     rts
  609.         
  610.     
  611. get_plane_count
  612.     move.l    intbase(pc),a5
  613.     move.l    ActiveScreen(a5),a4
  614.     lea    sc_BitMap(a4),a3
  615.     move.b    bm_Depth(a3),d0
  616.     rts
  617.  
  618. *DOS INHIBITER    
  619. dos_inhibit
  620. * ENTRY    D7=0 normal, D7=-1 subnormal    
  621.     lea    drivename(pc),a1
  622.     move.l    a1,d1
  623.     move.l    a6,-(a7)
  624.     move.l    dosbase(pc),a6
  625.     jsr    _LVODeviceProc(a6)    DOS.LIBRARY
  626.     move.l    (a7)+,a6
  627.     move.l    d0,d6        D6=pid
  628.     
  629.     lea    DiskPort(pc),a1
  630.     move.l    a1,d5        D5=reply port
  631.  
  632. *    lea    packet(pc),a4
  633. *    move.l    a4,packet_addr
  634.  
  635.     move.l    d7,arg1
  636.     lea    sp_Msg(pc),a1
  637.     move.l    a1,sp_Pkt        set sp_Pkt
  638.     lea    sp_Pkt(pc),a1
  639.     move.l    a1,ln_Name    set ln_Name
  640.     move.l    d5,dp_Port    set dp_port
  641.     move.l    #31,dp_Type    set dp_Type
  642.     
  643.     move.l    d6,a0
  644.     lea    packet(pc),a1
  645.     jsr    _LVOPutMsg(a6)    EXEC
  646.  
  647.     move.l    d5,a0
  648.     jsr    _LVOWaitPort(a6)    EXEC
  649.  
  650.     move.l    d5,a0
  651.     jsr    _LVOGetMsg(a6)    EXEC
  652.     rts
  653.  
  654. save_last    move.l    d7,d6
  655.     add.l    #2*NUMSECS*TD_SECTOR,d6
  656.     move.l    d6,last_offset
  657.     move.b    digit1(pc),last_digit1
  658.     move.b    digit1+1(pc),last_digit2
  659.     move.b    surface1(pc),last_surface1
  660.     rts
  661.     
  662. restore_last
  663.     move.l    last_offset(pc),d7
  664.     move.b    last_digit1(pc),digit1
  665.     move.b    last_digit2(pc),digit1+1
  666.     move.b    last_surface1(pc),surface1
  667.     rts
  668.         CNOP    0,4
  669.  
  670. **************************************************    
  671.  
  672. DiskName    dc.b    'trackdisk.device',0
  673. dosname    dc.b    'dos.library',0
  674. gfxname    dc.b    'graphics.library',0
  675. intname    dc.b    'intuition.library',0
  676. drivename    dc.b    'DF0:',0
  677.  
  678. title        dc.b    'RAW:100/80/312/40/PAULCOPY II © P.Hayter'
  679. title_delimiter    dc.b    0
  680.         dc.b    'ONE.SWAP',0
  681. mega_end
  682.  
  683. msg5        dc.b    ' Insert SOURCE disk in DF'
  684. msg5_drive    dc.b    '0: (RETURN)'
  685. msg5_end
  686.  
  687. reading_text    dc.b    ' Reading....',10
  688. reading_text_end
  689.  
  690. writing_text    dc.b    ' Writing....',10
  691. writing_text_end
  692.     
  693. msg1        dc.b    13,'  Track '
  694. digit1        dc.b    '0'
  695.         dc.b    '0'
  696.         dc.b    '  Surface '
  697. surface1        dc.b    '0'
  698.     
  699. msg1_end
  700.  
  701. msg2        dc.b    ' Insert TARGET disk in DF'
  702. msg2_drive    dc.b    '0: (RETURN)'
  703. msg2_end
  704.  
  705. wr_prot_txt    dc.b    10,'* TARGET DISK IS WRITE PROTECTED *'
  706. wr_prot_txt_end
  707.  
  708. abort_text    dc.b    10,'USER ABORT!!    ',10
  709. abort_text_end
  710.  
  711. bad_text        dc.b    ' has a bad sector',10
  712. bad_text_end
  713.  
  714. opt_text        dc.b    13,'COPY AGAIN (y/n) ?          '
  715. opt_text_end
  716. in_buffer        dc.b    ' '
  717.     
  718. lf    dc.b    10
  719. last_digit1    dc.b    '0'
  720. last_digit2    dc.b    '0'
  721. last_surface1    dc.b    '0'
  722.     even
  723.  
  724. entry_stack    dc.l    0
  725. in_handle        dc.l    0
  726. out_handle    dc.l    0
  727. dosbase        dc.l    0
  728. intbase        dc.l    0
  729. gfxbase        dc.l    0
  730. last_offset    dc.l    0
  731. first_offset    dc.l    0
  732. _WBenchMsg    dc.l    0
  733.  
  734. dealloc_count    dc.w    0
  735.         
  736.  
  737.     cnop    0,4
  738.  
  739. DiskPort    dc.l    0    ;0    ln_Succ
  740.     dc.l    0    ;4    ln_Pred
  741.     dc.w    $0400    ;8    ln_Type
  742.     dc.l    0    ;10    ln_Pri
  743.     dc.b    0    ;14    mp_Flags
  744.     dc.b    31    ;15    mp_SigBit
  745.     dc.l    0    ;16    Task addr goes here
  746. LH1    dc.l    LH2    ;20    lh_head    <MSG list
  747. LH2    dc.l    0    ;24    lh_tail
  748.     dc.l    LH1    ;28    lh_TailPred
  749.     dc.b    0    ;32    lh_Type
  750.     dc.b    0    ;33    l_pad
  751.  
  752. DiskIOReq    dc.l    0    ;0
  753.     dc.l    0    ;4
  754.     dc.b    5    ;8    ln_Type
  755.     dc.b    0    ;9
  756.     dc.l    0    ;10
  757.     dc.l    DiskPort     ;14    mn_Reply_Port
  758.     dc.w    48    ;18    mn_Length
  759.     dc.l    0    ;20
  760.     dc.l    0    ;24
  761.     dc.w    3    ;28 IO_CMD
  762.     dc.w    0    ;30
  763.     dc.l    0    ;32
  764.     dc.l    1024    ;36 IO_LENGTH
  765.     dc.l    0    ;40 IO_DATA
  766.     dc.l    0    ;44 IO_OFFSET
  767.     dc.l    0
  768.     dc.l    0
  769.  
  770.     cnop    0,4
  771. packet
  772. sp_Msg    dc.l    0    mn_Node    ln_Succ
  773.     dc.l    0        ln_Pred
  774.     dc.b    0        ln_Type
  775.     dc.b    0        ln_Pri
  776. ln_Name    dc.l    sp_Pkt        ln_Name
  777.     dc.l    0    mn_ReplyPort
  778.     dc.w    0    mn_Length
  779. sp_Pkt    dc.l    sp_Msg    dp_Link
  780. dp_Port    dc.l    DiskPort    dp_Port
  781. dp_Type    dc.l    31    dp_Type
  782.     dc.l    0    dp_Res1
  783.     dc.l    0    dp_Res2
  784. arg1    dc.l    0    dp_Arg1
  785.     dc.l    0    dp_Arg2
  786.     dc.l    0    dp_Arg3
  787.     dc.l    0    dp_Arg4
  788.     dc.l    0    dp_Arg5
  789.     dc.l    0    dp_Arg6
  790.     dc.l    0    dp_Arg7
  791.  
  792.     SECTION    last_bit,bss_c
  793.  
  794. last_sector    ds.l    128
  795.  
  796.     END
  797.