home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol044 / pippatch.asm < prev    next >
Assembly Source File  |  1984-04-29  |  5KB  |  157 lines

  1. ; PIPPATCH.ASM mod B
  2. ;
  3. ; Notes on PIPPATCH mod A
  4. ;
  5. ; One problem which is often encountered with PIP.COM is that 
  6. ; there is no convenient method to transfer files to and from 
  7. ; several different diskettes without rebooting CP/M and rerunning 
  8. ; PIP after each output disk change.  This is especially a problem 
  9. ; when some of your archive disks do not contain a system, and also 
  10. ; when your system does not allow warmbooting from a single density 
  11. ; disk.  These patches to PIP.COM add a special command to allow 
  12. ; the disk system to be reset, which allows the output diskettes to 
  13. ; be changed and then restored to R/W status.  
  14. ;
  15. ; The idea for these patches came from LIFELINES, October 1981. 
  16. ; This coding of the idea, however, is my own and is placed in the
  17. ; PUBLIC DOMAIN for all to use as they desire.
  18. ;
  19. ; The useage is simple:  When you have finished with an output 
  20. ; disk, change it.  Then, before doing anything else, let your 
  21. ; first command be the single character which you specified in this 
  22. ; file to be your reset character.  I chose "R".  When the prompt 
  23. ; returns, all disks have been restored to R/W status.
  24. ;
  25. ; Also, the opportunity was taken to make PIP give a signon 
  26. ; message, to help weed out the old versions, especially v1.4
  27. ;
  28. ; Additional notes on PIPPATCH mod B
  29. ;
  30. ; While I was at it, it seemed a good idea to be able to repeat 
  31. ; the previous command without having to retype it.  This feature 
  32. ; takes advantage of the fact that CP/M doesn't bother to clear the 
  33. ; console input buffer, but instead just overwrites a portion of 
  34. ; it, based on what was typed.  The command to repeat the last 
  35. ; command is also specified at assembly time.  I have chosen the 
  36. ; "!" for this, for no particular reason.  If you don't like it, 
  37. ; change it!
  38. ;
  39. ; Patches courtesy of:
  40. ;    Lewis Moseley, Jr.
  41. ;    2576 Glendale Ct. NE
  42. ;    Conyers, GA 30208
  43. ;                 Reciprocation encouraged.
  44.  
  45.  
  46.  
  47.     org    100H        ;program start
  48.  
  49.     jmp    signon
  50.  
  51.     org    110H        ;custom I/O area
  52.  
  53. signon:    lda    fcb+1        ;was a command given on the command line?
  54.     cpi    ' '
  55.     jnz    04CEH        ;skip new signon message if so
  56.  
  57.     lxi    d,msg1        ;else give new signon message
  58.     mvi    c,9
  59.     call    bdos        ;write it to console
  60.     jmp    04CEH         ;join mainline code
  61.  
  62. msg1:    db    0dh,0ah
  63.     db    'PIP v2.2 mod B',0dh,0ah,'$'
  64.  
  65. getcon:    lxi    h,buff
  66.     mvi    m,80H        ;specify max length of reply
  67.     xchg            ;buffer address to DE
  68.     mvi    c,10        ;bdos command to read console buffer
  69.     call    bdos        ;ask bdos to do it
  70.  
  71.     lda    buff+1        ;length of reply
  72.     cpi    1        ;just 1 caharacter entered?
  73.     jnz    gobak        ;let PIP process the command if not
  74.     
  75.     lda    buff+2        ;first (and only) char typed
  76.     cpi    rptchr        ;was it the repeat command?
  77.     jnz    getc1        ;jump if not
  78. ;
  79. ;
  80. ; REPEAT command - Restore first 4 chars of the console buffer to
  81. ;           their former contents, echo the old command to
  82. ;           console, RESET disk system, and let PIP reprocess it
  83. ;
  84.     lhld    stash        ;restore length and first char typed
  85.     shld    buff+1
  86.  
  87.     lxi    d,msg3        ;'Disk system reset' msg
  88.     mvi    c,9
  89.     call    bdos
  90.  
  91.     lxi    d,msg2        ;'Repeating...' message
  92.     mvi    c,9
  93.     call    bdos        ;write it to console
  94.  
  95.     lxi    h,buff+1    ;get length byte
  96.     mov    c,m        ;to reg BC
  97.     mvi    b,0
  98.     inx    h        ;get buffer start address to HL
  99.     dad    b        ;point to first free position in buffer
  100.     mvi    m,'$'        ;flag end of line with a "$"
  101.     lxi    d,buff+2
  102.     mvi    c,9
  103.     call    bdos        ;echo line
  104.  
  105.     mvi    c,13        ;bdos command to RESET
  106.     call    bdos
  107.  
  108.     ret            ;let PIP process the previous command again
  109.  
  110. msg2:    db    0dh,0ah
  111.     db    'Repeating:  $'
  112.  
  113. getc1:    ani    5FH        ;convert lc to UC (note: don't use for numbers)
  114.     cpi    rstchr        ;is it the user-specified RESET command?
  115.     jnz    gobak        ;let PIP process if not
  116. ;
  117. ; RESET command - make all diskettes R/W
  118. ;
  119.     lxi    d,msg3        ;'Disk system reset' msg
  120.     mvi    c,9
  121.     call    bdos
  122.     mvi    c,13        ;bdos command to RESET
  123.     call    bdos
  124.     call    crlf
  125.  
  126.     pop    h        ;clear stack
  127.     jmp    53CH        ;rejoin command loop within PIP
  128.  
  129. msg3:    db    0DH,0AH
  130.     db    'All disks made R/W.$'
  131.  
  132. ;
  133. ; not a special command, so stash the console buffer for later
  134. ;
  135. gobak:    lhld    buff+1        ;save length and first char typed
  136.     shld    stash
  137.     ret            ;and back to PIP to process
  138.  
  139. stash    dw    0        ;no initial command
  140.  
  141.  
  142.     org    96FH        ;patch PIP to vector to this routine
  143.  
  144.     jmp    getcon
  145.  
  146.  
  147.  
  148. bdos    equ    5        ;cp/m entry point
  149. fcb    equ    05CH        ;default fcb
  150.  
  151. crlf    equ    082EH        ;PIP's internal CR-LF routine
  152. buff    equ    1ECBH        ;PIP's input buffer
  153.  
  154. rstchr    equ    'R'        ;put your choice for the reset char here
  155. rptchr    equ    '!'        ;same here for the repeat command char
  156.  
  157.