home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 601 / changesz / chngsize.s next >
Encoding:
Text File  |  1992-03-07  |  3.5 KB  |  143 lines

  1.  
  2. ; save as a TOS program
  3.  
  4.   Text
  5.  
  6.   Include TOS\GEMDOS.S
  7.   Include TOS\XBIOS.S
  8.   Include TOS\EZMAC.S
  9.  
  10.   Cursor Solid                      ;I hate the flashing cursor!
  11. Restart:
  12.   Cls
  13.   Cls
  14.   PrintCR '        Cluster Size Changer  v.2'
  15.   PrintCR '                   by'
  16.   PrintCR '            ML & ML Software'
  17.   CR
  18.   PrintCR 'Change cluster size of disk in which'
  19.   Print   'Drive (A or B, X exits)? '
  20.   CapsIn
  21.   Cmp.B   #'B',D0
  22.   Beq     DriveOK
  23.   Cmp.B   #'A',D0
  24.   Beq     DriveOK
  25.   Cmp.B   #'X',D0
  26.   Bne     Restart
  27.   Term
  28.  
  29. DriveOK:
  30.   Move.B  D0,Char
  31.   Move.B  #0,Char+1
  32.   VPrintCR Char                     ;display choice
  33.   Move.B  Char,D0                   ;D0 is fried during print!
  34.   Move.B  D0,AnyFiles               ;part of pathname
  35.   Sub     #'A',D0                   ;D0=0 (A) or 1 (B)
  36.   Move    D0,Drive
  37.   SFirst  #0,AnyFiles               ;make sure the disk is newly formatted
  38.   Cmp.B   #-33,D0                   ;-33 = no files ... good!
  39.   Bne     FilesExist                ;uh-oh, there are files here
  40.  
  41.   FlopRd  #1,#0,#0,#1,Drive,Sector0 ;read sector 0
  42.  
  43.   CR
  44.   CR
  45.   CR
  46.   PrintCR 'Cluster size on this disk:'
  47.  
  48.   Lea     Sector0,A0
  49.   Move.B  13(A0),D0                 ;what is the current cluster size?
  50.   Cmp.B   #1,D0                     ;is it 1?
  51.   Beq     SwitchTo2
  52.   Cmp.B   #2,D0                     ;how about 2?
  53.   Bne     Problems                  ;neither?  better not touch it
  54.  
  55. SwitchTo1:
  56.   PrintCR '  2 sectors per cluster'
  57.   Print   'Change cluster size to 1? '
  58.   CapsIn
  59.   Move.B  D0,Char
  60.   Move.B  #0,Char+1
  61.   VPrintCR Char                     ;display choice
  62.   Cmp.B   #'Y',Char                 ;do they want it changed?
  63.   Bne     Restart
  64.   Lea     Sector0,A0                ;need to reload A0
  65.   Move.B  #1,13(A0)                 ;set 1 sectors per cluster
  66.   Bra     WriteIt
  67.  
  68. SwitchTo2:
  69.   PrintCR '   1 sector per cluster'
  70.   Print   'Change cluster size to 2? '
  71.   CapsIn
  72.   Move.B  D0,Char
  73.   Move.B  #0,Char+1
  74.   VPrintCR Char                     ;display choice
  75.   Cmp.B   #'Y',Char                 ;do they want it changed?
  76.   Bne     Restart
  77.   Lea     Sector0,A0                ;reload A0
  78.   Move.B  #2,13(A0)                 ;set 2 sectors per cluster
  79.  
  80. WriteIt:
  81.   FlopWr  #1,#0,#0,#1,Drive,Sector0 ;write sector 0
  82.   Tst     D0                        ;errors?
  83.   Bne     Oops                      ;yep!
  84.  
  85.   CR
  86.   CR
  87.   CR
  88.   Print   'Drive '
  89.   Move.B  AnyFiles,Drive            ;copy drive letter
  90.   Move.B  #0,Drive+1
  91.   VPrint  Drive                     ;print drive letter
  92.   PrintCR ' has been modified'
  93.   PrintCR 'Press SPACE to do another,'
  94. Again:
  95.   Print   'any other key exits: '
  96.   KeyIn
  97.   Cmp.B   #' ',D0
  98.   Beq     Restart
  99.   Term
  100.  
  101.  
  102. FilesExist:
  103.   CR
  104.   CR
  105.   CR
  106.   PrintCR '◆THIS IS NOT A BLANK DISK!'
  107. Exist2:
  108.   PrintCR 'Press SPACE to retry,'
  109.   Bra      Again
  110.  
  111. Oops:
  112.   CR
  113.   CR
  114.   CR
  115.   PrintCR '◆DISK WRITE ERROR! (check WP tab)'
  116.   Bra     Exist2
  117.  
  118. Problems:
  119.   CR
  120.   CR
  121.   CR
  122.   PrintCR '◆This disk contains a value other'
  123.   PrintCR 'than 1 or 2 as the sectors-per-'
  124.   PrintCR 'cluster size...it may be a special'
  125.   PrintCR 'format or a copy-protected game disk.'
  126.   PrintCR 'If it is neither of these, then it'
  127.   PrintCR 'might be a good idea to run a virus'
  128.   PrintCR 'checking program on this disk to'
  129.   PrintCR 'check for a possible viruses.'
  130.   Bra     Exist2
  131.  
  132.   Data
  133. AnyFiles: DC.B "?:\*.*",0
  134.   Align
  135.  
  136.   BSS
  137. Drive:    DS.W 1
  138. Sector0:  DS.B 512                  ;sector buffer
  139. Char:     DS.W 1
  140.  
  141.   End
  142.