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 / CPM / PROGRAMS / WSTAR / WSUFIX4.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  230 lines

  1. ; WSUFIX VERSION 4 - 11/22/83 by:
  2. ;
  3. ;                            Ron Mozer
  4. ;                    Southwest Computer Center
  5. ;                      121 Wyatt Dr. Suite 7
  6. ;                      Las Cruces, NM 88001
  7. ;                      (505) 523-6037 RCP/M
  8. ;                      (505) 526-2842 Voice
  9. ;
  10. ;
  11. ; THIS PROGRAM IS TO BE OVERLAYED WITH WS.COM TO FIX THE PROBLEM
  12. ; WITH THE OVERLAY FILES BEING EXPECTED IN THE CURRENT USER.
  13. ;
  14. ;**NOTICE**NOTICE**  This patch for WS MUST be considered experimental at this
  15. ;    time.  It has been tested on a NorthStar Horizon and a Kaypro10 and
  16. ;    seems to work as advertised.  Please report any bugs, comments, or
  17. ;    suggestions for improvement to the RCP/M listed above or to the
  18. ;    Mesilla Valley RCP/M, (505) 522-8856.
  19. ;
  20. ;
  21. ; Known limitations:
  22. ;
  23. ;    1) The (R)un command has some restrictions that are caused by the fact
  24. ;       that WS must be switched to DEFUSR and stay there while the .COM
  25. ;       file is executing.  WS returns to the current(start up) user when
  26. ;       the first .OVR file is opened upon return to normal WS operation.
  27. ;       All .COM files to be run must be in DEFUSR and either DEFDRV or the
  28. ;       current drive.  When executing programs such as COMPARE, HEXDIF, 
  29. ;       BISHOW, etc. that require a filename input on the command line, 
  30. ;       those files must be in DEFUSR on the CURRENT drive.  Directory
  31. ;       programs such as SD will show the directory of the CURRENT drive and
  32. ;       DEFUSR.  Calculator programs such as @ or ALLBASE, and disk util-
  33. ;       ities such as DU seem to execute with no problem.  The latter are 
  34. ;       the types of programs one would most likely want to (R)un under
  35. ;       Wordstar. (The previous assumes operation under ZCPR2 with DEFUSR/
  36. ;       DRV somewhere in the path.)
  37. ;
  38. ;    2) If you try to edit an .OVR or .COM file under Wordstar(who would
  39. ;       want to do that?), the file will be created in the current drive/
  40. ;       user, but then cannot be accessed again from that location.  The
  41. ;       file, once created, must be in DEFUSR of the CURRENT drive before it
  42. ;       can be accessed under WS.
  43. ;
  44. ;    3) This patch has not been tested with SPELSTAR.OVR.  It is expected
  45. ;       that SPELSTAR.DCT would have to be in DEFUSR of the CURRENT drive
  46. ;       for it to execute properly.  Who knows where the various work files
  47. ;       would wind up.
  48. ;     
  49. ;
  50. ; REVISION HISTORY
  51. ;
  52. ; 11/22/83  Changed logic to look for an .OVR or .COM filetype before switching
  53. ; VER #4    to DEFUSR.  In the case of .COM files, WS stays in DEFUSR while
  54. ;        the program executes and then returns to the current user when the
  55. ;        first .OVR file is again opened.  This allows limited use of the
  56. ;        (R)un command.  Moved CURUSR and added COMFLG, both located in a
  57. ;        safe memory location outside of the MORPAT area.  This area is
  58. ;        overwritten when the (R)un commanbd is used.  Moved code that gets
  59. ;        and saves the current user area to a separate routine invoked from
  60. ;        INISUB.  The user area saved is that from which WS is invoked.
  61. ;        Changed back to 8080 code which uses all but two bytes of MORPAT.
  62. ;        (pwc).  Changed to use table driven compare routine.(Ron Mozer).
  63. ;
  64. ; 11/10/83  Fixed lots of bugs.  Made Z80 code and require MAC
  65. ; VER #3    to assemble. (Ron Mozer)
  66. ;
  67. ; 11/09/83  Changed to make compatible with all wordstars?
  68. ;        of varied version numbers.  Still must make sure
  69. ; VER #2    you get the right address for INTERC. This code now
  70. ;        needs to be simplified since there is only a couple of
  71. ;        bytes left in MOPAT, thus no room to include spell star
  72. ;        as one of the overlay files to check.
  73. ;                        (Ron Mozer)
  74. ;
  75. ; 10/03/83  Orignal version 1 (Ron Mozer)
  76. ;
  77. ; All BDOS calls made by Wordstar except for normal I/O are intercepted
  78. ; and sorted out.  If the call is made to open the .OVR files the 
  79. ; intercept will set the user to DEFUSR.  After the BDOS returns, the
  80. ; intercept will set the user back to the current user. (See VER #4 notes above
  81. ; for change).
  82. ;
  83. ; This will allow those people who are running ZCPR, NZCPR, ZCPR2, etc,
  84. ; to have only one copy of wordstar on the system and be able to use
  85. ; it from any user/drive combination. (Very useful for hard disk machines)
  86. ;
  87. ; Care must be taken for those people who have already made major changes
  88. ; in wordstar.  The area at MORPAT is being used by this program to
  89. ; accomadate the intercept.  With VER #4, INISUB is also used.
  90. ;
  91. ; To implement this program, first edit this file to suit your needs,
  92. ; then assemble it with ASM.  You can then overlay this use DDT as follows:
  93. ;
  94. ;     >DDT WS.COM
  95. ;    DDT VERS 2.2
  96. ;    NEXT  PC
  97. ;    3F00 0100
  98. ;    -IWSUFIX.HEX
  99. ;    -R
  100. ;    NEXT  PC
  101. ;    3F00 0000
  102. ;    -G0
  103. ;    >SAVE 62 WS.COM
  104. ;    
  105. ;
  106. ;************************ W A R N I N G **************************
  107. ; If you are using a non-standard CP/M (one that does not start the
  108. ; TPA at 100H such as TRS-80, HEATH H8, etc.) you will have to change
  109. ; MOPAT, INTERC, BDOS, DEFDSK and anything else that may conflict.
  110. ;*****************************************************************
  111. ;
  112. DEFUSR    EQU    0AH    ;User area which has the .OVR and .COM files
  113. DEFDRV    EQU    1    ;The default disk drive to test for
  114.             ;the .OVR and .COM files (A=1, B=2, etc.)
  115.  
  116. BDOS    EQU    5    ;BDOS ENTRY POINT
  117. USRCMD    EQU    32    ;GET/SET USER COMMAND
  118. OPEN    EQU    15    ;OPEN FILE COMMAND
  119.  
  120. DEFDSK    EQU    02DCH    ;location of DEFDSK in WS.COM
  121. MORPAT    EQU    02E0H    ;location of MORPAT (free space)
  122. inisub    equ    02a4h    ;location of inisub routine called on startup
  123. INTERC    EQU    1824H    ;location of intercept address. NOTE:
  124.             ;you should check this with your favorite
  125.             ;debuger to make sure that it is the LSB of
  126.             ;the BDOS entry point. INTERC-1 should be:
  127.             ; CD 05 00
  128.  
  129. ;******************************************************************************
  130.  
  131. ;NOTE*****  These locations must be in an unused area of memory.  DO NOT leave
  132. ;them in the morpat area as they are overwritten by WS when the (R)un command
  133. ;is used.
  134.  
  135. CURUSR    equ    0FE08H    ;TEMP SAVE AREA for startup user area.
  136. comflg    equ    0FE0AH    ;location of COM file flag
  137.  
  138. ;******************************************************************************
  139.  
  140. yes    equ    0ffh
  141. no    equ    0
  142.  
  143.     org    inisub
  144.     jmp    savusr  ;Save user area from which WS is invoked.
  145.  
  146.     ORG    DEFDSK
  147.     DB    DEFDRV    ;Set the default disk drive in WS.
  148.  
  149.     ORG    INTERC
  150.     DW    PATCH    ;INSTALL INTERCEPT PATCH
  151.  
  152.     ORG    MORPAT
  153. PATCH    MOV    A,C    ;GET COMMAND
  154.     CPI    OPEN    ;OPEN???
  155.     JNZ    BDOS    ;LET BDOS HAVE IT IF NOT
  156.     push    h
  157.     push    d
  158.     push    b
  159.     xchg        ;get address of FCB in HL
  160.     lxi    d,9
  161.     dad    d    ;point to filetype
  162.     LXI    D,OVRNM ;Set up to compare filetype with OVR
  163.     CALL    CMPARE    ;check it
  164.     JNZ    TRYCOM    ;NO, check for COMfile
  165.     mvi    a,no    ;is OVR, so indicate not COM
  166.     sta    comflg
  167.     jmp    setdef    ;is OVR so look in def drive/user
  168.  
  169. trycom    LXI    D,COMNM    ;Set up to compare filetype with COM
  170.     CALL    CMPARE    ;check it
  171.     JNZ    RETBDOS    ;Not COM so do normal BDOS call
  172.     mvi    a,yes    ;is COM so set flag and fall through to setdef
  173.     sta    comflg
  174.  
  175. setdef    pop    b
  176.     pop    d
  177.     pop    h
  178.     MVI    A,DEFUSR    ;SELECT DEFAULT USER
  179.     CALL    USER
  180.     CALL    BDOS    ;PROCESS OPEN COMMAND
  181.     PUSH    PSW
  182.     lda    comflg    ;If COM file, must stay in defusr until finished
  183.     cpi    yes    ;return to current du after next OVR file open.
  184.     jz    stay
  185.     LDA    CURUSR    ;GET CURRENT USER BACK
  186.     CALL    USER
  187.     POP    PSW
  188.     RET
  189. ;
  190. USER    PUSH    B    ;SAVE EVERYTHING IN SIGHT
  191.     PUSH    D
  192.     PUSH    H
  193.     MOV    E,A
  194.     MVI    C,USRCMD
  195.     CALL    BDOS
  196.     POP    H
  197.     POP    D
  198.     POP    B
  199.     RET
  200.  
  201. retbdos    pop    b
  202.     pop    d    ;restore registers
  203.     pop    h
  204.     jmp    bdos    ;normal bdos call
  205.  
  206. stay    pop    psw    ;get back open file result and stay in DEFUSR.
  207.     ret
  208.  
  209. CMPARE    MVI    B,3    ;CHECK THREE BYTES
  210. CMPLP    LDAX    D    ;WHAT WERE CHECKING AGAINST
  211.     CMP    M    ;WHAT WERE CHECKING
  212.     RNZ        ;NOT THE SAME
  213.     INX    H    ;POINT TO NEXT BYTE
  214.     INX    D
  215.     DCR    B    ;DECREMENT COUNTER
  216.     JNZ    CMPLP    ;LOOP TILL DONE
  217.     RET
  218.  
  219. OVRNM    DB    'OVR'
  220. COMNM    DB    'COM'
  221.  
  222. ;The following routine is jumped to from INISUB
  223.  
  224. savusr:    MVI    A,0FFH    ;REQUEST USER NUMBER
  225.     CALL    USER
  226.     STA    CURUSR    ;SAVE IT
  227.     ret
  228.  
  229.     end
  230.