home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / OS / Z80DOVL.ARC / BUXZD20.LBR / BUXZD20.ZZ0 / BUXZD20.Z80
Text File  |  1991-02-10  |  7KB  |  264 lines

  1. ;****************************************************
  2. ;
  3. ;    BUXZD20.Z80
  4. ;    Eugene Nolan
  5. ;    1/4/88
  6. ;
  7. ;
  8. ;    This file functions as an RSX that is to be used
  9. ;    with Z80DOS and BU20.LBR/BUSHBETA.LBR to preserve date stamps
  10. ;    of the source files on the destination files.
  11. ;    The companion program BUXREM is used to remove the RSX.
  12. ;
  13. ;    NOTE: BUXZD20 functions differently from BUXZD10 in that
  14. ;          it is not affected by warm boots. BUXREM MUST be used
  15. ;          to have it remove itself.
  16. ;
  17. ;
  18. ;    The limitations are that only one source and one destination
  19. ;    drive may be specified for a single execution of BU/BUSH.
  20. ;    BUSH allows you to specify another source/destination drive
  21. ;    after the current backup is complete, unfortunatly this feature
  22. ;    is not useable with BUXZD.
  23. ;
  24. ;    The following are examples of use in different scenarios
  25. ;
  26. ;    In ALIAS.CMD:
  27. ;
  28. ;        BU BUXZD $*;BU20 $*;BUXREM
  29. ;            or
  30. ;        BU BUXZD $*;BUSHND;BUXREM
  31. ;
  32. ;    In a ZEX script:
  33. ;
  34. ;        BUXZD $1 $2            BUXZD $1 $2
  35. ;        BU20  $1 $2 $3        or    BUSHND
  36. ;        BUXREM                BUXREM
  37. ;
  38. ;    Stand alone in a multi-command line:
  39. ;
  40. ;        BUXZD A D;BU20 A[:AFN] D [opts]
  41. ;            or
  42. ;        BUXZD A D;BUSHND;BUXREM
  43. ;
  44. ;    As a series of single command lines
  45. ;
  46. ;        BUXZD A D
  47. ;         any other command may be executed here with the stipulation
  48. ;         of all Make file and writes to drive D will be stamped
  49. ;         with the date of the last file Opened on Drive A.
  50. ;
  51. ;        BU20 A[:AFN] D [opts]         or BUSHND
  52. ;
  53. ;        BUXREM
  54. ;
  55. ;
  56. ;    BUXZD expects to find as parameters the source disk( ignores file name
  57. ;     if present) and destination disk in the command line buffer at 80h.
  58. ;
  59. ;    BUXZD is to assembled with M80 and linked with L80 (M80,L80 tm Microsoft)
  60. ;    and used with the automated SPR generator RELOC24 (Ashby Method)
  61. ;
  62. ;    Generation instructions:
  63. ;
  64. ; M80 =BUXZD.Z80                 Assemble the file to a .REL
  65. ; L80 RELOC,/P:1FE,BUXZD,ORG200/N/E,@@relo   Link with RELOC.REL to ORG200.COM
  66. ; L80 RELOC.ABS,/P:2FE,BUXZD,ORG300/N/E         Link with RELOC.ABS to ORG300.COM
  67. ; RELOC24 BUXZD -                 Run the SPR generator to BUXZD.COM
  68. ; ERA ORG*.COM                          Erase temporary files
  69. ;
  70. ;
  71. ;
  72. JBDOS    EQU    6        ; Holds BDOS entry address
  73. CLBUF    EQU    80H        ; Command line buffer address
  74. GETSTP    EQU    54        ; Z80DOS call to get time stamp
  75. USESTP    EQU    55        ; Z80DOS call to use time stamp
  76. OPEN    EQU    15        ; BDOS call to open file
  77. CLOSE    EQU    16        ;  "    "   "  close "
  78. MAKE    EQU    22        ;  "    "   "  make  "
  79. WRSEQ    EQU    21        ;  "    "   "  write sequential
  80. WRRAN    EQU    34        ;  "    "   "  write random
  81. WRRANF    EQU    40        ;  "    "   "  write random with zero fill
  82. NORSX    EQU    0F8h        ; Our extended BDOS call to remove RSX
  83.  
  84.     .z80
  85.     CSEG
  86.                 ; The next 3 lines are for RELOC24.COM
  87. $MEMRY::            ; Filled in by L80 with last in last module
  88.     DS    2
  89.     JP    START        ; Required by RELOC24
  90. START:
  91.     LD    HL,(JBDOS)    ; Get BDOS entry address
  92.     INC    HL        ; Skip over jump that is there
  93.     INC    HL
  94.     INC    HL
  95.     LD    A,(HL)        ; See if were already here( look for 'BU')
  96.     CP    'B'
  97.     JR    NZ,INSTALL    ; NZ= not here
  98.     INC    HL
  99.     LD    A,(HL)
  100.     CP    'U'
  101.     JR    NZ,INSTALL
  102.     LD    DE,AINSMESS    ; Get to here and found out already loaded
  103.     LD    C,9
  104.     CALL    5
  105.     RET
  106. AINSMESS:
  107.     DB    13,10,'BU RSX already installed',13,10,'$'
  108.  
  109. INSTALL:
  110.     LD    HL,CLBUF    ; Point to input line
  111.     LD    DE,DRVARY    ; Point to array of drives
  112.     LD    A,(HL)        ; Get char count
  113.     OR    A
  114.     RET    Z        ; Z=no input, must want help, don't install
  115.     INC    HL
  116.     LD    B,A
  117. SRCH:    LD    A,(HL)        ; Skip all spaces
  118.     CP    ' '
  119.     JR    NZ,SRCH1
  120.     INC    HL
  121.     DJNZ    SRCH
  122.     JR    NOINS        ; Exausted input and found nothing, so don't
  123.                 ; install
  124. SRCH1:    SUB    40H        ; Convert to drive number
  125.     LD    (DE),A        ; Save disk to be backed up
  126.     INC    DE
  127.     INC    HL
  128.     DEC    B
  129.     JR    Z,NOINS        ; Exausted input and found nothing, so don't
  130.                 ; install
  131.  
  132. SRCH2:    LD    A,(HL)        ; Skip all till find next space or exaust input
  133.     CP    ' '
  134.     JR    Z,SRCH3        ; Z=is a space, continue
  135.     INC    HL
  136.     DJNZ    SRCH2
  137.     JR    NOINS        ; Input all done, don't install
  138.  
  139. SRCH3:    LD    A,(HL)        ; Skip intervening spaces
  140.     CP    ' '
  141.     JR    NZ,SRCH4
  142.     INC    HL
  143.     DJNZ    SRCH3
  144.     JR    NOINS        ; Input done, don't install
  145.  
  146. SRCH4:    SUB    40H
  147.     LD    (DE),A        ; Save it in drive array
  148.     INC    HL
  149.     LD    A,(HL)        ; Input done?
  150.     OR    A
  151.     JR    Z,OKINS        ; Yes, ok to install
  152.     CP    ' '        ; A space?
  153.     JR    NZ,NOINS    ; No, don't install
  154.  
  155. OKINS:    LD    HL,(JBDOS)    ; Get BDOS entry address
  156.     LD    (MYJUMP+1),HL    ; Save it internally
  157.     LD    HL,MYENTRY    ; Put our entry point there
  158.     LD    (JBDOS),HL
  159.     LD    HL,(1)        ; Get address of BIOS warmboot
  160.     INC    HL
  161.     LD    E,(HL)
  162.     INC    HL
  163.     LD    D,(HL)
  164.     LD    (HWB1),DE    ; And save it away for BUXREM later
  165.     DEC    HL
  166.     LD    DE,BUWBOT    ; Overwrite BIOS JP with our warm boot code
  167.     LD    (HL),E
  168.     INC    HL
  169.     LD    (HL),D
  170.     DEC    HL
  171.     LD    DE,1604H    ; Calculate where the CCP cold entry point is
  172.     OR    A
  173.     SBC    HL,DE
  174.     LD    (BCCP),HL    ; And save it away for our warmboots
  175.     LD    DE,INSMESS
  176.     LD    C,9
  177.     JP    MYJUMP
  178. INSMESS:
  179.     DB    13,10,'BU RSX installed',13,10,'$'
  180.  
  181. NOINS:    RET
  182.  
  183. MYENTRY:            ; With RSX loaded, all CALL/JUMP 5 will go
  184.     JP    MYENTRY1    ; thru us here.
  185.     DB    'BU'        ; Our flag as to already loaded
  186.  
  187.                 ; Our warm boot entry point
  188. BUWBOT:    LD    A,(4)        ; Get current DU
  189.     LD    C,A
  190.     DB    0C3H        ; And go to CCP cold entry point
  191. BCCP:    DW    0        ; Filled in above by install
  192.  
  193. HWB1:    DW    0        ; Holds original BIOS warm boot entry point
  194.  
  195. MYENTRY1:
  196.     LD    A,C
  197.     CP    OPEN        ; Open file?
  198.     JR    Z,ISOPEN
  199.     CP    MAKE        ; Make,Wrseq,Wrran,Wrranf,Close all treated same
  200.     JR    Z,ISMAKE
  201.     CP    WRSEQ
  202.     JR    Z,ISMAKE
  203.     CP    WRRAN
  204.     JR    Z,ISMAKE
  205.     CP    WRRANF
  206.     JR    Z,ISMAKE
  207.     CP    CLOSE
  208.     JR    Z,ISMAKE
  209.     CP    NORSX        ; Our extended BDOS call to remove RSX?
  210.     JR    NZ,MYJUMP
  211.     LD    HL,(MYJUMP+1)    ; Yes, restore original BDOS entry address
  212.     LD    (JBDOS),HL
  213.     LD    DE,(HWB1)    ; Get original BIOS warmboot entry point
  214.     LD    HL,(1)
  215.     INC    HL
  216.     LD    (HL),E        ; And restore it
  217.     INC    HL
  218.     LD    (HL),D
  219.     LD    DE,NORSXX
  220.     LD    C,9
  221.     JP    MYJUMP
  222. NORSXX:
  223.     DB    13,10,'BU RSX removed',13,10,'$'
  224.  
  225. ISOPEN:
  226.     LD    A,(DE)        ; Get drive code from FCB
  227.     LD    HL,DRVARY
  228.     CP    (HL)        ; Is it equal to drive to be backed up?
  229.     JR    NZ,NOTINP    ; NZ=no
  230.     CALL    MYJUMP        ; Do the open
  231.     CP    0FFH        ; Bad?
  232.     JR    Z,NOTINP    ; Z=yes
  233.     PUSH    DE
  234.     PUSH    BC
  235.     PUSH    AF
  236.     LD    C,GETSTP    ; Get the time stamp for file
  237.     CALL    MYJUMP        ; Z80DOS will keep it for us
  238.     POP    AF
  239.     POP    BC
  240.     POP    DE
  241.     RET
  242. NOTINP:
  243.     JP    MYJUMP
  244.  
  245. ISMAKE:
  246.     PUSH    DE
  247.     PUSH    BC
  248.     LD    A,(DE)        ; Get drive code from FCB
  249.     LD    HL,DRVARY+1
  250.     CP    (HL)        ; Is it equal to drive to be backed up?
  251.     JR    NZ,NOTINP1    ; NZ=no, just do it
  252.     LD    C,USESTP    ; Force Z80DOS to use stamp as stored above
  253.     CALL    MYJUMP
  254. NOTINP1:
  255.     POP    BC
  256.     POP    DE        ; Go do make,close, or writes
  257. MYJUMP:
  258.     JP    0        ; Filled in with BDOS entry address
  259.     RET
  260.  
  261. DRVARY:    DB    0,0        ; Holds Source/destination drives of BU
  262.     DW    0
  263.     END    
  264.