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
/
ZSUS
/
ZSUS001.LBR
/
TCJWSPAT.LBR
/
TCJEXTRA.WZ
/
TCJEXTRA.WS
Wrap
Text File
|
2000-06-30
|
10KB
|
366 lines
.mt2
.mb2
; Program: WordStar Shell Modification Patches
; Author: Jay Sage
; Date: August 7, 1988
; Patches to make the WordStar Release 4 'R' command operate as a ZCPR2-type
; shell. Several routines in WS.COM and WS.OVR must be changed.
;
; 1. WordStar must be prevented from pushing its name onto the Z-System shell
; stack. However, a flag that is used by the 'R' command to determine how
; to operate must be set as if WS4 had set itself up as a shell.
;
; 2. The popping of the shell stack when WS4 terminates must be disabled.
;
; 3. The user input to the prompt from the 'R' command must be handled
; differently. A command to reinvoke WS4 must be appended to the user's
; input, and then any commands pending in the multiple command line buffer
; must be added as well. The result is then placed into the command line
; buffer. If overflow occurs, the user command is ignored, and an error
; message is displayed until a key is pressed. The chaining command is of
; the form ";DUU:WSNAME ,". The comma at the end of the command tail is
; used as a signal that WS4 was invoked as a ZCPR2 shell.
;
; 4. An optional patch can be included to defeat the use of the path for
; searching for the overlay files. An internal path can be specified.
;------------------------------------------------------------
0000 no equ 0
FFFF yes equ not no
;*****************************************************************
;* MUST change the following equate if not using the MORPAT *
;* area of WS4.COM *
;*****************************************************************
0000 morarea equ no
0000 mload equ no
FFFF intpath equ yes
0894 ram1st equ 0894h
0896 extra equ 0896h
0000 if morarea
else
0896 morpat equ extra
endif
0906 namebuf equ morpat+128-16
0AA4 envoff equ 0aa4h
2200 zflag equ 2200h
1F38 rcmdbuf equ 1f38h
1F39 rcmd equ rcmdbuf+1
0386 clrscr equ 0386h
17C7 scrnfn equ 17c7h
0280 conout equ 0280h
0007 bell equ 07
è FFFF if not mload
;----------------------------------------------------------------------
;
; PATCHES TO WS.OVR
;
;----------------------------------------------------------------------
; Modifications to the code that pushes WordStar onto the shell stack.
; This patch prevents the WordStar shell entry from being set up, but it
; sets the flag in 2200h that makes WordStar think that it has set it up.
; In this way, the 'R' command will work as it would with shells engaged.
; The space is used to determine the command line needed to reinvoke
; WordStar. The ZCPR33 facility for returning the directory in which the
; program was located is used to provide an explicit DU: prefix. The
; resulting command line is kept at the end of the user patch area.
2380 offset defl 2380h
3CBF org 3cbfh
3CBF 1E 24 ld e,24h
3CC1 CD A40A call envoff
3CC4 E5 push hl
3CC5 11 0D00 ld de,0dh
3CC8 19 add hl,de
3CC9 46 ld b,(hl)
3CCA 23 inc hl
3CCB 7E ld a,(hl)
3CCC C6 40 add a,'A'-1
3CCE 21 0609 ld hl,namebuf
3CD1 36 3B ld (hl),';'
3CD3 23 inc hl
3CD4 77 ld (hl),a
3CD5 23 inc hl
3CD6 78 ld a,b
3CD7 0E 2F ld c,'0'-1
3CD9 tens:
3CD9 0C inc c
3CDA D6 0A sub 10
3CDC 30 FB jr nc,tens
3CDE C6 3A add 10+'0'
3CE0 71 ld (hl),c
3CE1 23 inc hl
3CE2 77 ld (hl),a
3CE3 23 inc hl
3CE4 36 3A ld (hl),':'
3CE6 23 inc hl
3CE7 D1 pop de
3CE8 06 08 ld b,8
3CEA copyname:
3CEA 13 inc de
3CEB 1A ld a,(de)
3CEC FE 20 cp ' '
3CEE 28 05 jr z,copydone
3CF0 77 ld (hl),a
3CF1 23 inc hl
3CF2 05 dec b
3CF3 20 F5 jr nz,copyname è 3CF5 copydone:
3CF5 36 20 ld (hl),' '
3CF7 23 inc hl
3CF8 36 2C ld (hl),','
3CFA 23 inc hl
3CFB 36 00 ld (hl),0
3CFD 3E FF ld a,0ffh
3CFF 32 0022 ld (zflag),a
^
|------ After you enter this byte in ZPATCH press ^W, then
move to the next record and resume entering at the "0"
3D02 C3 AA60 jp 60aah
3D05 end1pat:
3D2A endaddr defl 60aah - offset
0025 free defl endaddr - end1pat
0000 if $ gt endaddr
endif
;------------------------------------------------------------
; This patch takes the user's response to the 'R' command, adds the command
; to reinvoke WordStar, and appends any pending commands in the command line
; buffer. The result is written out to the command line buffer. This
; implements a ZCPR2-style shell for the 'R' command.
; If the resulting command line is too long for the MCL, an error message is
; displayed until a key is pressed, and then WS resumes as if no command line
; had been entered.
; The first part of this patch replaces code in WS.OVR. There is not enough
; space there for all the code, so it continues in the user patch area.
E200 offset defl -1e00h
endif; not mload
A000 scratch equ 0a000h
FFFF if not mload
67B2 org 67b2h
67B2 21 381F ld hl,rcmdbuf
67B5 4E ld c,(hl)
67B6 06 00 ld b,0
67B8 23 inc hl
67B9 11 00A0 ld de,scratch
67BC ED B0 ldir
67BE 21 0609 ld hl,namebuf
67C1 CD D113 call cpy2nul
67C4 C3 9608 jp morpat
67C7 end2pat:
0004 free defl 67cbh - end2pat
0000 if $ gt 67cbh
endif
endif; not mload
;----------------------------------------------------------------------
;
; PATCHES TO WS.COMè;
;----------------------------------------------------------------------
; This is the continuation of the patch in WS.OVR that inserts the user's
; command line, together with the WS reinvocation command, into the multiple
; command buffer.
FFFF if (morpat=extra)
0894 org ram1st
0894 1609 dw namebuf+16
endif
0896 org morpat
0896 D5 push de
0897 1E 18 ld e,18h
0899 CD A40A call envoff
089C 5E ld e,(hl)
089D 23 inc hl
089E 56 ld d,(hl)
089F EB ex de,hl
08A0 D1 pop de
08A1 CD D113 call cpy2nul
08A4 21 8603 ld hl,clrscr
08A7 CD C717 call scrnfn
08AA 1E 18 ld e,18h
08AC CD A40A call envoff
08AF 11 00A0 ld de,scratch
08B2 47 ld b,a
08B3 lenloop:
08B3 1A ld a,(de)
08B4 B7 or a
08B5 28 11 jr z,oklength
08B7 13 inc de
08B8 10 F9 djnz lenloop
08BA 11 DA08 ld de,errmsg
08BD 0E 09 ld c,9
08BF CD 0500 call 0005h
08C2 CD 491A call sak
08C5 C3 4E7F jp 7f4eh
08C8 oklength:
08C8 11 0400 ld de,4
08CB EB ex de,hl
08CC 19 add hl,de
08CD EB ex de,hl
08CE 73 ld (hl),e
08CF 23 inc hl
08D0 72 ld (hl),d
08D1 21 00A0 ld hl,scratch
08D4 CD D113 call cpy2nul
08D7 C3 F613 jp 13f6h
08DA errmsg:
08DA 07 4D 43 4C db bell,'MCL Ovfl - press any key...$'
08F7 end3pat:
000F free defl namebuf - end3pat
0000 if $ gt namebuf
endif
;------------------------------------------------------------
; This optional patch causes WS4 to use an internal path to locate
; its overlay files.
FFFF if intpath
0F5F org 0f5fh
0F5F CD D913 call setpath
0F62 00 nop
0F63 00 nop
endif ;intpath
;------------------------------------------------------------
; Modification to the termination routine that pops the shell stack.
; This patch eliminates the popping of the shell stack on exit from
; WordStar. The space from the end of this patch to 13f6h is available
; for other uses (40 bytes).
13CE org 13ceh
13CE C3 F613 jp 13f6h
; This routine copies the string pointed to by HL to the address pointed to by
; DE until a null byte is encountered. The null byte is copied as well.
13D1 cpy2nul:
13D1 7E ld a,(hl)
13D2 12 ld (de),a
13D3 B7 or a
13D4 C8 ret z
13D5 23 inc hl
13D6 13 inc de
13D7 18 F8 jr cpy2nul
FFFF if intpath
13D9 setpath:
13D9 21 E013 ld hl,path0
13DC 7E ld a,(hl)
13DD 23 inc hl
13DE B7 or a
13DF C9 ret
13E0 02 path0: db 2
13E1 02 db 2
13E2 04 db 4
13E3 00 db 0
13E4 00 db 0
13E5 00 db 0
endif ;intpath
13E6 end4pat:
0010 free defl 13f6h - end4pat
0000 if $ gt 13f6h
endif
;------------------------------------------------------------
; Modification to initialization code where WS4 determines if it was
; invoked as a shell. We have defined a convention where a comma on
; the end of the command line signals WS4 to display its shell-wait
; message and wait for the user to press a key.
1A2F org 1a2fh
1A2F 21 8000 ld hl,80h
1A32 6E ld l,(hl)
1A33 CB FD set 7,l
1A35 7E ld a,(hl)
1A36 FE 2C cp ','
1A38 20 25 jr nz,1a5fh
1A3A 36 20 ld (hl),' '
1A3C 11 101B ld de,1b10h
1A3F 0E 09 ld c,9
1A41 CD 0500 call 0005
1A44 CD 491A call sak
1A47 18 16 jr 1a5fh
1A49 sak:
1A49 1E FF ld e,0ffh
1A4B 0E 06 ld c,6
1A4D CD 0500 call 0005
1A50 B7 or a
1A51 28 F6 jr z,sak
1A53 1E 0D ld e,0dh
1A55 0E 06 ld c,6
1A57 C3 0500 jp 0005
1A5A end5pat:
0005 free defl 1a5fh - end5pat
0000 1 if $ gt 1a5fh
endif
end