home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / osborne / dirpatch.azm < prev    next >
Text File  |  1994-07-13  |  10KB  |  285 lines

  1. ;         Copyright 1984 by John M. Blalock
  2.  
  3. ;         ********************************
  4. ;         *                              *
  5. ;         *         DIRPATCH.AZM         *
  6. ;         *                              *
  7. ;         *     An extension to the      *
  8. ;         *     Osborne Executive's      *
  9. ;         *     CP/M Plus extended       *
  10. ;         *     directory program.       *
  11. ;         *                              *
  12. ;         *         Written by:          *
  13. ;         *        John M. Blalock       *
  14. ;         *         Dec 10, 1984         *
  15. ;         *                              *
  16. ;         ********************************
  17.  
  18. ; The  CP/M Plus operating system for the Osborne  Executive 
  19. ; computer  has  many nice features,  including an  extended 
  20. ; directory function that gives useful information about the
  21. ; files on the disks.  It's incomplete,  however,  since  it
  22. ; does not tell you how much space is remaining on the disk.
  23. ; Normally, the program SHOW.COM  must  be  used to get this
  24. ; information.   Digital  Research  did  leave  a  few bytes
  25. ; available in the beginning of DIR.COM for their  copyright
  26. ; notice that can be overlaid with this patch.  With it  you
  27. ; will  no  longer have their copyright notice buried in the
  28. ; program,  but  the extended directory  listing  will  tell
  29. ; you the space remaining on the disk.  
  30.  
  31. ; This  patch was written in Z80 assembly language in  order 
  32. ; to  take  advantage of the Z80 op-codes that were used  to 
  33. ; keep the program short enough  to  fit  in  the  available 
  34. ; space.  Unless you change to a non-Z80 machine they should 
  35. ; cause no problems.
  36.  
  37. ; To  install this patch,  assemble the source with ZASM.COM 
  38. ; or  extract  and use the DIRPATCH.HEX file attached at the
  39. ; end  of  this  source  listing.   A  typical  installation
  40. ; sequence follows:
  41.  
  42. ;    A>SID DIR.COM
  43. ;    CP/M 3 SID - Version 3.0
  44. ;    NEXT MSZE  PC  END
  45. ;    3A00 3A00 0100 D7FF
  46. ;    #RDIRPATCH.HEX
  47. ;    NEXT MSZE  PC  END
  48. ;    041B 3A00 0100 D7FF
  49. ;    #WDIR.COM,100,39FF
  50. ;    0072h record(s) written.
  51. ;    #^C
  52. ;    A>
  53.  
  54. ; Now type  DIR A: [A to see how your new extended directory 
  55. ; program works!
  56.  
  57. ; This  program  can be copied and used  for  non-commercial 
  58. ; purposes  only.   Any other use violates the copyright  of 
  59. ; the  author  who  wouldn't  mind  receiving  payment   for 
  60. ; commercial usages.
  61.  
  62. ; John M. Blalock, W7AAY, PO Box 39356, Phoenix, AZ 85069
  63.  
  64.  
  65. BDOS    EQU    0005
  66.  
  67.     ORG    0106H        ;START OF PATCH AREA 
  68.  
  69. PATCH:    LD     C,25        ;RETURN CURRENT DISK
  70.     CALL    BDOS        ; IN REG A
  71.     LD    E,A        ;PASS CURRENT DISK IN REG E
  72.     LD    C,46        ;GET DISK FREE SECTOR COUNT
  73.     CALL    BDOS        ; -NOT K BYTES-IN (80) & (81)
  74.     LD     B,3        ;3 PASSES = DIVIDE BY 8
  75. DIVLP:    OR    A        ;CLEAR CARRY
  76.     LD    HL,0081H    ;HIGH BYTE OF FREE SPACE
  77.     RR    (HL)        ;DIVIDE BY TWO
  78.     DEC    HL        ;LOW BYTE OF FREE SPACE
  79.     RR    (HL)        ;DIVIDE BY TWO
  80.     DEC    B        ;3 PASSES DONE ?
  81.     JR    NZ,DIVLP    ;NO, THEN REPEAT
  82.     LD    B,'0'        ;ASCII ZERO TO HUNDS
  83.     LD    C,B        ; AND TENS REGISTERS
  84.     LD    A,(HL)        ;GET FREE SPACE (<255K)
  85. HUND:    SUB    100        ;ANY HUNDREDS?
  86.     JR    C,TENS        ;NO, TRY TENS
  87.     INC    B        ;YES, BUMP HUNDS DIGIT
  88.     JR    HUND        ;AND LOOP
  89. TENS:    ADD    A,100        ;ADD BACK 100
  90. TENLP:    SUB    10        ;ANY TENS ?
  91.     JR    C,ONES        ;NO, DO ONES DIGITS
  92.     INC    C        ;YES, BUMP TENS DIGIT
  93.     JR    TENLP        ;AND LOOP
  94. ONES:    ADD    A,10+'0'    ;ADD TEN PLUS ASCII BIAS
  95.     LD    D,A        ;PUT IN ONES DIGIT
  96.     LD    HL,NUMS        ;POINT TO NUMBERS
  97.     LD    A,'0'        ;STILL ZERO IF NONE ADDED
  98.     CP    B        ;ANY HUNDREDS ?
  99.     JR    Z,NOHUND    ;NO, SKIP IT
  100.     LD    (HL),B        ;SAVE HUNDS IN MESSAGE
  101. NOHUND: INC    HL        ;POINT TO TENS POSITION
  102.     CP    C        ;ANY TENS ?
  103.     JR     Z,NOTENS    ;NO, SKIP IT
  104.     LD    (HL),C        ;SAVE TENS IN MESSAGE
  105. NOTENS:    INC    HL        ;POINT TO ONES POSITION
  106.     LD    (HL),D        ;SAVE ONES IN MESSAGE
  107.     LD    DE,MSG        ;POINT TO MESSAGE
  108.     LD    C,9        ;PRINT STRING FUNCTION
  109.     CALL    BDOS        ;OUTPUT MESSAGE TO CONSOLE
  110.     JP    0475H        ;JUMP TO ORIGINAL EXIT POINT
  111.  
  112. MSG    DB    'Space Remaining =    '
  113. NUMS    DB    '   k',13,10,'$'
  114.     LD    C,D
  115.     LD    C,L
  116.     LD    B,D
  117. LAST    EQU    $        ;DON'T GO PAST 016FH
  118.  
  119.     ORG    0418H        ;ORIGINAL JUMP TO EXIT
  120.  
  121.     JP    PATCH        ;JUMP TO OUR PATCH
  122.  
  123.     END
  124.  
  125. ; DIRPATCH.HEX:
  126.  
  127. :100106000E19CD05005F0E2ECD05000603B7218121
  128. :1001160000CB1E2BCB1E0520F40630487ED6643855
  129. :10012600030418F9C664D60A38030C18F9C63A57F8
  130. :100136002166013E30B828017023B9280171237267
  131. :100146001151010E09CD0500C37504537061636535
  132. :100156002052656D61696E696E67203D2020202002
  133. :0A0166002020206B0D0A244A4D42B0
  134. :03041800C3060117
  135. :0000000000
  136. 
  137. 1, answered, recent,,
  138. Return-Path: <@seismo.ARPA:noao!terak!jb@seismo.ARPA>
  139. Received: from seismo.ARPA by SIMTEL20.ARPA with TCP; Fri 14 Dec 84 22:27:46-MST
  140. Return-Path: <noao!terak!jb@seismo.ARPA>
  141. Received: from noao.UUCP by seismo.ARPA with UUCP; Sat, 15 Dec 84 00:27:36 EST
  142. From: noao!terak!jb@seismo.ARPA
  143. Received: by noao.UUCP (4.12/4.7)
  144.     id AA16599; Fri, 14 Dec 84 04:59:01 mst
  145. Date: Fri, 14 Dec 84 04:59:01 mst
  146. Message-Id: <8412141159.AA16599@noao.UUCP>
  147. To: noao!seismo!KPETERSEN@SIMTEL20.ARPA
  148. Subject: Bug in DIRPATCH.AZM 
  149.  
  150. *** EOOH ***
  151. Date: Friday, 14 December 1984  04:59-MST
  152. From: noao!terak!jb at seismo.ARPA
  153. To:   noao!seismo!KPETERSEN at SIMTEL20.ARPA
  154. Re:   Bug in DIRPATCH.AZM 
  155.  
  156. Keith, there was a minor bug in the version of DIRPATCH.AZM I sent you.
  157. Sorry...
  158.  
  159. Here's the corrected version:
  160. ;         Copyright 1984 by John M. Blalock
  161.  
  162. ;         ********************************
  163. ;         *                              *
  164. ;         *         DIRPATCH.AZM         *
  165. ;         *                              *
  166. ;         *     An extension to the      *
  167. ;         *     Osborne Executive's      *
  168. ;         *     CP/M Plus extended       *
  169. ;         *     directory program.       *
  170. ;         *                              *
  171. ;         *         Written by:          *
  172. ;         *        John M. Blalock       *
  173. ;         *         Dec 10, 1984         *
  174. ;         *                              *
  175. ;         ********************************
  176.  
  177. ; The  CP/M Plus operating system for the Osborne  Executive 
  178. ; computer  has  many nice features,  including an  extended 
  179. ; directory function that gives useful information about the
  180. ; files on the disks.  It's incomplete,  however,  since  it
  181. ; does not tell you how much space is remaining on the disk.
  182. ; Normally, the program SHOW.COM  must  be  used to get this
  183. ; information.   Digital  Research  did  leave  a  few bytes
  184. ; available in the beginning of DIR.COM for their  copyright
  185. ; notice that can be overlaid with this patch.  With it  you
  186. ; will  no  longer have their copyright notice buried in the
  187. ; program,  but  the extended directory  listing  will  tell
  188. ; you the space remaining on the disk.  
  189.  
  190. ; This  patch was written in Z80 assembly language in  order 
  191. ; to  take  advantage of the Z80 op-codes that were used  to 
  192. ; keep the program short enough  to  fit  in  the  available 
  193. ; space.  Unless you change to a non-Z80 machine they should 
  194. ; cause no problems.
  195.  
  196. ; To  install this patch,  assemble the source with ZASM.COM 
  197. ; or  extract  and use the DIRPATCH.HEX file attached at the
  198. ; end  of  this  source  listing.   A  typical  installation
  199. ; sequence follows:
  200.  
  201. ;    A>SID DIR.COM
  202. ;    CP/M 3 SID - Version 3.0
  203. ;    NEXT MSZE  PC  END
  204. ;    3A00 3A00 0100 D7FF
  205. ;    #RDIRPATCH.HEX
  206. ;    NEXT MSZE  PC  END
  207. ;    041B 3A00 0100 D7FF
  208. ;    #WDIR.COM,100,39FF
  209. ;    0072h record(s) written.
  210. ;    #^C
  211. ;    A>
  212.  
  213. ; Now type  DIR A: [A to see how your new extended directory 
  214. ; program works!
  215.  
  216. ; This  program  can be copied and used  for  non-commercial 
  217. ; purposes  only.   Any other use violates the copyright  of 
  218. ; the  author  who  wouldn't  mind  receiving  payment   for 
  219. ; commercial usages.
  220.  
  221. ; John M. Blalock, W7AAY, PO Box 39356, Phoenix, AZ 85069
  222.  
  223. ; Revised to fix bug that caused 100k Space Remaining to be
  224. ; displayed as 1 0k Space Remaining.  JMB 12/15/84
  225.  
  226. BDOS    EQU    0005
  227.  
  228.     ORG    0106H        ;START OF PATCH AREA 
  229.  
  230. PATCH:    LD     C,25        ;RETURN CURRENT DISK
  231.     CALL    BDOS        ; IN REG A
  232.     LD    E,A        ;PASS CURRENT DISK IN REG E
  233.     LD    C,46        ;GET DISK FREE SECTOR COUNT
  234.     CALL    BDOS        ; -NOT K BYTES-IN (80) & (81)
  235.     LD     B,3        ;3 PASSES = DIVIDE BY 8
  236. DIVLP:    OR    A        ;CLEAR CARRY
  237.     LD    HL,0081H    ;HIGH BYTE OF FREE SPACE
  238.     RR    (HL)        ;DIVIDE BY TWO
  239.     DEC    HL        ;LOW BYTE OF FREE SPACE
  240.     RR    (HL)        ;DIVIDE BY TWO
  241.     DEC    B        ;3 PASSES DONE ?
  242.     JR    NZ,DIVLP    ;NO, THEN REPEAT
  243.     LD    B,'0'        ;ASCII ZERO TO HUNDS
  244.     LD    C,B        ; AND TENS REGISTERS
  245.     LD    A,(HL)        ;GET FREE SPACE (<255K)
  246. HUND:    SUB    100        ;ANY HUNDREDS?
  247.     JR    C,TENS        ;NO, TRY TENS
  248.     INC    B        ;YES, BUMP HUNDS DIGIT
  249.     JR    HUND        ;AND LOOP
  250. TENS:    ADD    A,100        ;ADD BACK 100
  251. TENLP:    SUB    10        ;ANY TENS ?
  252.     JR    C,ONES        ;NO, DO ONES DIGITS
  253.     INC    C        ;YES, BUMP TENS DIGIT
  254.     JR    TENLP        ;AND LOOP
  255. ONES:    ADD    A,10+'0'    ;ADD TEN PLUS ASCII BIAS
  256.     LD    D,A        ;PUT IN ONES DIGIT
  257.     LD    HL,NUMS        ;POINT TO NUMBERS
  258.     LD    A,'0'        ;STILL ZERO IF NONE ADDED
  259.     CP    B        ;ANY HUNDREDS ?
  260.     JR    Z,NOHUND    ;NO, SKIP IT
  261.     LD    (HL),B        ;YES, SAVE HUNDS IN MESSAGE
  262. NOHUND: INC    HL        ;POINT TO TENS POSITION
  263.     JR    NZ,HUNDS    ;SAVE TENS IF HAD HUNDS
  264.     CP    C        ;ANY TENS ?
  265.     JR     Z,NOTENS    ;NO, SKIP IT
  266. HUNDS:    LD    (HL),C        ;SAVE TENS IN MESSAGE
  267. NOTENS:    INC    HL        ;POINT TO ONES POSITION
  268.     LD    (HL),D        ;SAVE ONES IN MESSAGE
  269.     LD    DE,MSG        ;POINT TO MESSAGE
  270.     LD    C,9        ;PRINT STRING FUNCTION
  271.     CALL    BDOS        ;OUTPUT MESSAGE TO CONSOLE
  272.     JP    0475H        ;JUMP TO ORIGINAL EXIT POINT
  273.  
  274. MSG    DB    'Space Remaining =    '
  275. NUMS    DB    '   k',10,'$'
  276.     LD    C,D
  277.     LD    B,D
  278. LAST    EQU    $        ;DON'T GO PAST 016FH
  279.  
  280.     ORG    0418H        ;ORIGINAL JUMP TO EXIT
  281.  
  282.     JP    PATCH        ;JUMP TO OUR PATCH
  283.  
  284.     END
  285.