home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z80dos / ws40oz8d.lbr / WS40OZ8D.ZZ0 / WS40OZ8D.Z80
Encoding:
Text File  |  1989-02-12  |  4.0 KB  |  157 lines

  1. ;**************************************************
  2. ;
  3. ; WS40OZ8D.Z80
  4. ; Eugene Nolan
  5. ; C/O DHN* RCPM 215-623-4040
  6. ;
  7. ; This file provides an overlay for WS 4.0 that
  8. ; allows it to carry the creation date of files
  9. ; from the input file to the output file.
  10. ;
  11. ; Assemble to a .HEX file and use
  12. ;
  13. ; MLOAD WS.COM=WS.OLD,WS40OZ8D.HEX
  14. ;
  15. ; There are currently defined two areas inside the
  16. ; WS.COM file that this overlay may be placed, the
  17. ; first is at MORPAT, which is 128 bytes long, and
  18. ; EXTRA, which is 512 bytes long. To tell which area
  19. ; to use, run WSCHANGE on a FULLY installed WS and
  20. ; use the general COMPUTER patch function to examine
  21. ; these areas. This can be done by specifying the
  22. ; labels MORPAT and EXTRA. If when examined, they
  23. ; come up as 0's, that area is free and you may
  24. ; chose which equate EXTRA or MORPAT to use, then
  25. ; do the assembly and overlay.
  26. ;
  27. ; Included in this .LBR are the files MORPAT.HEX and
  28. ; EXTRA.HEX that are ready to overlay if you choose to
  29. ; use the MORPAT or EXTRA areas.
  30. ;
  31. ;  If both of these areas are found in use, you may want
  32. ; to examine the areas PRNPAT and CRTPAT to see if they are
  33. ; free ( haven't tried them myself), and set the equate MYOWN
  34. ; to TRUE ( EXTRA and MORPAT to false) and fill in the
  35. ; ORG at IF MYOWN. Don't make any claims to know if this
  36. ; will work though.
  37. ;  It should also be possible to use the BGNMEM variable to
  38. ; tell WS that the beginning of free memory is higher and place
  39. ; the overlay at the old location BGNMEM pointed to, but I couldn't
  40. ; find out where the BGNMEM variable is located in memory. It is
  41. ; alluded to in the MORPAT description in the PATCH.LST file, but
  42. ; not anywhere else. See below for how to use it if you find it.
  43.  
  44.  
  45.  
  46.     org    13afh            ; Overlay inside WS.COM
  47.     jp    dater
  48.  
  49.  
  50. no    equ    0
  51. yes    equ    not no
  52.  
  53. extra    equ    no            ; Set to yes if you want to use
  54.                     ; WS's EXTRA area to store the
  55.                     ; date support code
  56. morpat    equ    yes            ; Set to yes to use the MORPAT area
  57.  
  58. myown    equ    no            ; Set to yes if you have your own
  59.                     ; patch area
  60.  
  61. bgnmem    equ    no            ; Use this equate if you want to
  62.                     ; use the BGNMEM variable to
  63.                     ; set WS's free memory higher and
  64.                     ; place the overlay at the old BGNMEM
  65.                     ; location. Use MYOWN to set the
  66.                     ; ORG, and look for references to
  67.                     ; BGNMEM at the end of this file.
  68.  
  69.      if    extra
  70.     org    896h
  71.      endif        ; extra
  72.  
  73.      if    morpat
  74.     org    45bh
  75.      endif        ; morpat
  76.  
  77.  
  78.      if    myown
  79.     org    XXXXh            ; fill it in
  80.      endif        ; myown
  81.  
  82. dater:
  83.     ld    a,c            ; check if BDOS ftn = OPEN
  84.     cp    0fh
  85.     jr    z,isopen        ; Z=yes
  86.     cp    16h
  87.     jr    z,ismake        ; Ftn = MAKE
  88.  
  89. jbdos:    jp    5
  90.  
  91. ismake:    ld    a,e            ; MAKE or WRITE RAN, check if FCB
  92.     cp    87h            ; is that for the source file
  93.     jr    nz,jbdos
  94.     ld    a,d
  95.     cp    1ch
  96.     jr    nz,jbdos
  97.     ld    a,(wasopen)        ; Check if source was opened ok
  98.     or    a
  99.     jr    z,jbdos            ; Z = NO
  100.     push    hl
  101.     push    de
  102.     push    bc
  103.     ld    c,55            ; Use Z80DOS's USESTAMP ftn
  104.     call    5
  105.     pop    bc
  106.     pop    de
  107.     pop    hl
  108.     jr    jbdos            ; And do original operation
  109.  
  110. isopen:    ld    a,e            ; Check if trying to open source file
  111.     cp    0cdh            ; by checking if this is the source FCB
  112.     jr    nz,jbdos
  113.     ld    a,d
  114.     cp    1bh
  115.     jr    nz,jbdos
  116.     xor    a            ; Is call to OPEN source,
  117.                     ; assume not found
  118.     ld    (wasopen),a
  119.     call    5
  120.     cp    0ffh            ; If A = FF, then not found
  121.     ret    z
  122.     ld    (wasopen),a        ; Was found, set flag to say so
  123.     push    hl
  124.     push    de
  125.     push    bc
  126.     push    af
  127.     ld    c,54            ; Use Z80DOS's GETSTAMP ftn to save
  128.     call    5            ; time stamps of source
  129.     pop    af
  130.     pop    bc
  131.     pop    de
  132.     pop    hl
  133.     ret
  134.  
  135. timbuf:    ds    5
  136. wasopen:
  137.     db    0            ; Flag to hold status of OPEN of
  138.                     ; original source file
  139.     
  140.      if    extra            ; If overlaying EXTRA area of memory
  141.     org    894h            ; WS wants to know how much of it is
  142.                     ; used, so store where we stopped at
  143.                     ; EXTRA-2 ( RAM1ST)
  144.     dw    wasopen+1
  145.     endif            ; extra
  146.  
  147.  
  148.      if    bgnmem
  149.     org    XXXXh            ; fill in the address of the BGNMEM
  150.                     ; variable itself here, then the
  151.                     ; overlay will fill in the new value
  152.                     ; for you automatically
  153.     dw    wasopen+1
  154.      endif            ; bgnmem
  155.  
  156. ;*******************************
  157.