; Overlay: WS4PAT.MAC ; Author: Joe Wright ; Date: 20 November 87 ; Version: 1.0 VERS EQU 10 ; Release MONTH EQU 11 ; November DAY EQU 20 ; 20th YEAR EQU 87 ; 1987 ; The purpose of this overlay is to provide a generic ZCPR3 version of ; WordStar which will not require specific terminal installation but will ; take its lead from the TCAP. NZTCAP is expanded to include all (and more) ; that WordStar requires for its operation. ; Based on PATCH.LST in the WordStar 4.0 release, this overlay installs ; all but Printer patches. All new code is at EXTRA. MORPAT and CRTPAT ; areas are unused and therefore still available for small patches. ; Assemble WS4PAT.MAC to a .HEX file with SLRMAC and overlay your current ; WS.COM with it as follows: ; MLOAD WSZ.COM=WS.COM,WS4PAT.HEX ; You can rename this file to .ASM and assemble it with ASM or MAC. ; The overlay supports video attributes of the TeleVideo 955 and Wyse 60. ; It was tested only superficially for VT-100, using the Wyse 60 in VT-100 ; emulation mode. ; This overlay expects a ZCPR3 system with extended NZTCAP. All the code ; at VIDATT: and EXTRA: is my own. Before running WordStar with this ; overlay, you must create and install a NZTCAP for your terminal. I have ; provided an example here for TeleVideo 955 and the file NZWYS60.MAC ; as prototypes for your NZTCAP. If you run it with your normal TCAP, ; WordStar will not know how to do LINE INSERT and LINE DELETE functions ; and will slow a little and paint the screen more. ; I invite the interested programmer to study what I've done for WordStar ; and perhaps do the same for dBASE2 or SuperCalc2. ;---------------------------------------------------- ; ; NZCPR TERMINAL CAPABILITIES DATA ; In order determine specific terminals without regard to the ascii name, ; we now use the last byte of the name field as a 'type' byte. Until now, ; the types are assigned as follows: ; ; ASCII types (0-15) ; ; TeleVideo 955 00h ; TeleVideo 925 01h ; Wyse 60 02h ; Wyse 50 03h ; ; ANSI types (16-31) ; ; VT-100 10h ; ; WS4PAT simply looks at bit 4 to determine ASCII or ANSI types. ; ;NZTCAP: ; DB 'TVI-955 ' ; Name of terminal (Always 15 characters) ; DB 0 ; ASCII type (TeleVideo 955) ; DB 'K'-'@' ; Cursor up ; DB 'J'-'@' ; Cursor down (re-programmed from ^V) ; DB 'L'-'@' ; Cursor right ; DB 'H'-'@' ; Cursor left ; DB 0 ; CL delay ; DB 0 ; CM delay ; DB 0 ; CE delay ; DB ESC,'+',0 ; CL string 1st (NZTCAP+17H) ; DB ESC,'=%+ %+ ',0 ; CM string 2nd ; DB ESC,'T',0 ; CE string 3rd ; DB ESC,')',0 ; SO string 4th ; DB ESC,'(',0 ; SE string 5th ; DB 0 ; TI string 6th ; DB 0 ; TE string 7th ; ; Extensions to Standard Z3TCAP ; ; DB ESC,'R',0 ; Line Delete 8th ; DB ESC,'E',0 ; Line Insert 9th ; DB ESC,'G',0 ; Set Attributes 10th ; ; FILL UNUSED SPACE WITH NULLS ; ; REPT 128-($-NZTCAP) ; DB 0 ; ENDM ;---------------------------------------------------- ; ; WS4PAT will treat the full complement of TeleVideo functions and attributes. ; Any of the functions may be omitted (replaced with null) with the exception ; of the CM (Cursor Movement) string. WordStar will work around any other ; missing capabilities if your particular terminal doesn't support them. ; ; The custom routine POSCUR uses WordStar's cursor position in HL and sends ; the expanded CM string to the terminal. ; ; The CM string in NZTCAP is a macro of sorts. Characters in the string will ; be sent to the terminal as they appear. The special case is the COMMAND ; lead-in character '%'. The character following the '%' indicates the action ; required. Nine commands are supported as follows: ; ; %I Increment Row/Col by 1 (before D, 2, 3 or .) ; %D Send Row/Col as one, two or three ascii digits ; %2 Send Row/Col as two ascii digits ; %3 Send Row/Col as three ascii digits ; %. Send Row/Col as binary ; ; %R Send Col before Row ; %+ Add the next character to Row/Col and send it ; %N Send a NULL (00h) ; ; \ Send the next character literally (except null) ; ; The %N command, new in NZTCAP, allows a null (00h) to be sent to the ; terminal (no nulls are allowed within CM strings). ; ; The \ command permits sending a literal % or \ to the terminal. ; Use '\%' to send the percent sign or '\\' to send backslant. ; ; These commands allow virtually any terminal to be supported by WordStar. ; ; The prototype TeleVideo command is ESC = ROW COL where row and col ; are biased by the space character (20h). The CM string for this in ; assembly language: 1BH,'=%+ %+ ',0 or.. ; ; DB 1BH,'=' ; Lead-in string ; DB '%+ ' ; Send Row + 32 ; DB '%+ ' ; Send Col + 32 ; DB 0 ; Terminate the string (not sent) ; ; The prototype ANSI (VT-100) command is ESC [ ROW ; COL H where row and ; col are ascii decimal digits beginning with 1 rather than 0. The CM string ; for this is: 1BH,'[%I%D;%DH',0 or if you prefer.. ; ; DB 1BH,'[' ; Lead in string ; DB '%I' ; Row/Col begin at 1 instead of 0 ; DB '%D' ; Send Row in decimal ; DB ';' ; Send delimiter ; DB '%D' ; Send Col in decimal ; DB 'H' ; Send trailing H ; DB 0 ; Terminate the string (not sent) ; ; The Hazeltine 1500 is strange enough to demonstrate NZTCAP flexibility. ; The CM string is 7EH,11H,'%R%.%+ ',0 or.. ; ; DB 7EH,11H ; Lead-in string ; DB '%R' ; Reverse Row/Col ; DB '%.' ; Send Col in binary ; DB '%+ ' ; Send Row + 32 ; DB 0 ; Terminate the string (not sent) ; ; In order to use this powerful parser for attribute strings as well as ; CM strings, enter PARSE with HL pointing to the first character of a ; null-terminated string and DE containing the value to be parsed. ; A complex VT-200 SGR string is prototyped as: ; ;SGR: DB ESC,'[%R%D;%Dm',0 ; ; You would clear attributes with the following code. ; ; LXI H,SGR ; LXI D,0 ; CALL PARSE ; ... ; ; The resulting string to the terminal is: ; ; ESC [ 0 ; 0 m ; ; To set the VT-200 to blinking: ; ; LXI H,SGR ; LXI D,4 ; CALL PARSE ; ; The terminal gets: ; ; ESC [ 0 ; 4 m ; ; This great feature is not yet fully implemented ; ; ; Normal System Equates ; FALSE EQU 0 TRUE EQU NOT FALSE ; ; Ascii control code equates ; BS EQU 8 LF EQU 10 FFEED EQU 12 CR EQU 13 ESC EQU 27 CTRLA EQU 'A'-40H CTRLD EQU 'D'-40H CTRLK EQU 'K'-40H CTRLL EQU 'L'-40H CTRLP EQU 'P'-40H CTRLQ EQU 'Q'-40H CTRLZ EQU 'Z'-40H ; ; ;In order to minimize changes to the locations of User area ;data, the origin is forced here to 180H above the start of ;the TPA. ; ;This jump table provides commonly used subroutines for use ;by custom subroutines in the User areas. It must not be ;modified in any way. ; ;To output a character to the terminal from within your ; custom subroutines, call DISPLA with the character ; to be output in the accumulator (A register). All ; registers will be preserved. ; DISPLA EQU 280H ; Display character routine ; ;To output a string to the terminal that is in the normal ; user area format (count followed by bytes), call ; STRING with HL pointing to the string to be output. ; Upon returning, HL points to the byte following the ; string. ; STRING EQU 283H ; Display string routine ; ;To use WordStar's standard list output drivers, call the ; following subroutines. In all cases, all registers ; except for the PSW are unchanged by the subroutines. ; LSTOUT EQU 286H ; Prints character in A LSOSTA EQU 289H ; Returns output status to A (0 if busy). LSTIN EQU 28CH ; Inputs char from printer to A. (Only ; Works if custom ULISTI exists.) LSISTA EQU 28FH ; Returns input status to A (0 if no char). ; (Only works if custom ULISTA.) LSTRNG EQU 292H ; Send string to list device. (HL points ; To string, count byte first, just like ; Console strings). ; ;This flag is used if WordStar is on a multi-user system. It should ;be set to zero on single-user systems. Each bit of MPMFLG is used ;as follows: ; ; Bit Meaning ; ; ; 0 If 0, WordStar will issue a SYSTEM RESET when logging ; onto a removable disk drive. If 1, no reset will ; occur, and the operating system itself must handle ; any disk swapping. ; ; 1 If 1, users can share documents. Before opening a ; document to edit, WordStar will check to see if temporary ; files with that document name (e.g. FILENAME.$A$) ; already exist. If such files exist, WordStar will open ; the document as a protected document, preventing any ; changes to it. If 0, WordStar will delete existing ; temporary files when opening the document for editing. ; ; 2 If 1, users can share printer. MP/M function calls are ; issued to attach and detach the list device. If 0, ; the printer is assumed to be always attached. ; ; 3 If 1, WordStar will issue frequent MP/M "dispatch to ; next task" function calls to assure that multiple users ; have balanced access to the computer. If 0, WordStar ; assumes that only one user is on the computer at a time. ; If the operating system itself can load share adequately ; (such as MP/M 8/16 systems), set this bit to 0. ; ; 4-6 Reserved. ; ; 7 If 1, TurboDOS 1.3 operating system. WordStar will not ; check the disk drive write protect vector, will not check ; printer busy status, and will issue the TurboDos printer ; detach call when done printing. If 0, CP/M or MP/M. ; WordStar does not support TurboDos 1.2. ; ;If you are using MP/M, bits 0, 1 and 2 should all be set to 1. Bit 3 ;should be set for older versions of MP/M. If you are running on a ;networked system, only bit 1 should be set. If you are using TurboDos ;1.3 in a multi-user environment, bits 1 and 7 should be set. If you ;are using single-user TurboDos, only bit 7 should be set. ; ORG 295H MPMFLG: DB 0 ; Zero for single-user systems ; ;SHARE specifies how WordStar will handle two users in a shared file ;system who attempt to edit the same file. If 0, the second user ;will be denied access to the file. If 1, the second user can ;view as much of the file as can be loaded into memory, but he ;cannot modify the file. ; ORG 297H SHARE: DB 1 ; Allow viewing (protected edit) ; ;The function key table allows you to program any function keys that ;your terminal supports into one or more other keystrokes. Note that ;on many terminals, the function keys generate a sequence of characters ;where the first character is a control code. Since WordStar probably ;uses this same code for one its commands, a timer is used to determine ;when the "burst" of characters from the function key is done. ;This works because the terminal will usually send the function ;key characters at close to full baud rate. At 9600 baud, each character ;takes 1/960 of a second to send, or close to one millisecond. That ;means that three characters would take approximately three milliseconds. ;There is no way that even the fastest human typist could type that ;fast! Therefore, this method will usually work. ; ;Each function key in the table below is represented by two strings. ;The first describes the "burst" from the key. The second is what it ;should be translated into. You may not use string indirections in ;this table (size of -1 followed by address). ; ;The end of the function key table is indicated when the size of the ;function key string is zero. If you have more function keys than will ;fit, you can put a continuation address after the zero to point to more ;table. The table at that address must be the same format as this ;one. No continuation is indicated by an address of zero. ; ;One character "bursts" will not work here. If you need to translate ;a single character into something else, use the user console input ;routine UCONI. ; ;Warning! Terminals or computers that have their own type-ahead ;buffering may cause problems with this approach since it will be more ;likely that characters other than just function keys will be "burst" ;into WordStar by it. ; ORG 29BH FUNDLY: DB 0 ; Milliseconds of delay between characters ; Of function key burst (if zero, no ; Function keys are implemented). See ; Section on delays below before adjusting ; FUNDLY for your system. DB CTRLA ; Character that starts each burst ; (set to 0FFh to disable) FUNTBL: DB 3 ; Three chars in burst DB CTRLA,'@',CR ; Function key 1 DB 2 ; Two chars in replacement DB CTRLK,'B' ; Mark beginning of block DB 3 DB CTRLA,'A',CR ; Function key 2 DB 2 DB CTRLK,'K' ; Mark end of block DB 3 DB CTRLA,'B',CR ; Function key 3 DB 2 DB CTRLK,'C' ; Copy marked block DB 3 DB CTRLA,'C',CR ; Function key 4 DB 2 DB CTRLK,'V' ; Move marked block DB 3 DB CTRLA,'D',CR ; Function key 5 DB 2 DB CTRLK,'Y' ; Delete marked block DB 3 DB CTRLA,'E',CR ; Function key 6 DB 2 DB CTRLQ,'F' ; Find string DB 3 DB CTRLA,'F',CR ; Function key 7 DB 2 DB CTRLQ,'A' ; Search and replace DB 3 DB CTRLA,'G',CR ; Function key 8 DB 1 DB CTRLL ; Repeat last find or replace again DB 3 DB CTRLA,'H',CR ; Function key 9 DB 2 DB CTRLK,'D' ; Save document DB 3 DB CTRLA,'I',CR ; Function key 10 DB 2 DB CTRLK,'Q' ; Abandon editing DB 3 DB CTRLA,'J',CR ; Function key 11 DB 6 DB CTRLQ,'F',CTRLP ; Find end of paragraph DB CR,CR,CR DB 3 DB CTRLA,'K',CR ; Function key 12 DB 8 DB CTRLQ,'F',CTRLP ; Find beginning of paragraph DB CR,CR,'B',CR,CTRLD DB 0 ; End of table DW 0 ; No continuation ; ; TERMINAL PATCH AREA ; ;This section contains the user-modifiable constants and ; routines for hardware-dependent terminal functions ; and characteristics required by the editor. ; ;There are three types of patches in this area. One can ; patch data values (HITE, WID) which describe the ; terminal, strings (CLEAD1, ERAEOL) which define ; control sequences, or actual microprocessor ; instructions. ; ;For the string sequences, the first byte of the patch ; indicates the number of bytes in the string, ; followed by that many string bytes. If there is ; insufficient room for the whole string, the format ; can be modified by putting a -1 (0FFH) where the ; number of bytes would go, and then putting the ; address in the following two bytes (low order byte ; first) of the address where the longer patch ; resides. The longer patch must then be of the ; normal format which is the number of bytes followed ; by the string. ; ;This area is normally patched for your specific terminal ; by the interactive INSTALL program. Additional ; patching to this area is needed only for unusual ; terminals or video boards, or to meet special ; requirements, or to enhance or personalize your ; copy of WordStar. The default user area is ; set up for this example installation. ; ORG 31FH ; ;Video screen height, width, and wrap-around parameters are required. ; HITE: DB 24 ; Must be exact screen height in lines. WID: DB 80 ; Must be <= exact screen width in columns. WRAP: DB TRUE ; Indicates if terminal wraps around to next ; Line if a character is displayed in WIDth ; Column of screen (set FALSE if it doesn't) XONOFF: DB FALSE ; TRUE if XON/XOFF protocol to be used for ; The CRT terminal SCROLL: DB 20 ; Number of columns that are horizontally ; Scrolled when cursor moves beyond right ; Or left side of screen. DIRSIZ: DB 5 ; Number of lines available for directory ; At bottom of screen. If zero, no directory. DB 11 ; Larger directory for document selection ; ;Delete Display String ; ;The following string indicates to WordStar how to display a delete ;character (hex 7F) on the screen while editing. On terminals that ;interpret the delete character code into a displayable character, it ;is recommended that DELSTR be translated into the delete code itself ;(length of 1, then 7FH). All characters in the string must display. ; ORG 326H DELSTR: DB 3 ; Number of chars in string DB 'DEL' ; What is displayed ; ;Soft and End of Line Hyphen Display String ; ;In order to distinguish soft hyphens from normal hyphens in the text, ;WordStar will substitute the following string when one is encountered. ; ORG 32CH SHYSTR: DB 1 ; Number of chars in string DB '=' ; What is displayed ; ;Block Marker Strings ; ;Block marker strings are displayed on the screen to show the start and ;end of a block of text. The strings are in the typical format of the ;length followed by as many characters. Control characters should not ;be included within these strings because they would not be sent ;directly to the screen. ; ORG 332H BBLOCK: DB 3 ; Three chars DB '' ; Begin block ; ORG 337H KBLOCK: DB 3 ; Three chars DB '' ; End block ; ;Special character used when displaying soft spaces with ^OB. ; ORG 33CH SOFTSP: DB '+' ; Soft spaces show up as plus signs ; ;The following string is used at sign-on to describe the type ;of terminal being used by WordStar. Up to 40 bytes are available ;for the string, including its null terminator. ; ORG 342H CRTID: DB 'ZCPR3 Universal Terminal',CR,LF,0 ; Terminal name ; ;Cursor positioning control sequences are required. ; ;Cursor positioning for most terminals is accomplished ; by sending: ; ; 1. A 'lead-in' string of one or more terminal ; specific characters. ; 2. The line number, with an offset (often 20H) added. ; For some terminals, the column number is ; sent first. ; 3. For some terminals, another 'lead-in' string. ; 4. The column (or line) number, with an offset. ; 5. For some terminals, a terminating string. ; ;For most terminals, the line and column number are sent ; as one-byte binary numbers. Some terminals require ; that a two- or three-digit ASCII number is sent. ; ;For terminals that do not fit the above patterns, you ; must code your own subroutine. ; ;For example, the cursor is positioned on this sample ; installation by sending: ; ; ESCAPE, '=', ; line number plus 20H, ; column number plus 20H. ; ORG 36AH CLEAD1: ; Initial lead-in string DB 2 ; Number of characters DB ESC ; First character DB '=' ORG 36FH CLEAD2: ; Sent between line and column DB 0 ; Number of characters, none in our DB 0 ; Example. First character ORG 374H CTRAIL: ; Terminating string DB 0 ; Number of characters ORG 379H CB4LFG: ; Send column before line? DB 0 ; Set non-zero to send column first CUROFF: ; Cursor offsets ; Offset to add to line DB 20H ; Add 20H to line number (0 is top ; Line of screen before offset) ; Offset to add to column DB 20H ; Add 20H to column number (0 is ; Left-most column of screen ; Before offset) ASCUR: ; Binary/ASCII digit flag DB 0 ; 0 to send binary line and column ; 2 to send 2-digit ASCII numbers ; 3 to send 3-digit ASCII numbers ; ;Provision for positioning cursor by user-coded ; subroutine, instead of under control of above ; items. For use in exceptional cases only. ; ;Insert a JMP instruction to your subroutine in the ; following three bytes. Whenever the first byte ; is non-NOP, this location will be called to ; position the cursor, and the above cursor patch ; items will be ignored. ; ;Your subroutine will receive the line number in the L ; register (0 = top line), the column number in ; the H register (0 = left-most column), and the ; video attributes at the next typing position in ; the A register. Attributes are represented as ; described for the VIDATT routine, except that the ; warning/error bit indicates double-strike. ; ;Your subroutine may alter all registers. ; UCRPOS: JMP POSCUR ; Local cursor positioning via NZTCAP ; ;Displaying characters on some screens can be significantly faster if the ;cursor can be turned off. ; ONCUR: ; Turn cursor on by changing to jump NOP ; To custom subroutine. NOP ; L = current cursor line RET ; H = cursor column OFFCUR: ; Turn cursor off by changing to jump NOP ; To custom subroutine. NOP ; L = current cursor line RET ; H = cursor column ; ;Everything in the rest of this section is optional. ; The items relate either to enhanced performance, ; or for accomodating unusual terminals. ; ; ;Erase screen. If this function is not available, leave ; the first byte zero, and the WordStar will either send ; line feeds, or update a screen of text using ERAEOL ; below. ; ;After the screen is erased, WordStar assumes that the video ; attributes are set to normal (dim for the example ; terminal), and that the cursor is at the home position ; (upper left hand corner). ; ORG 386H ; 17 bytes max. ERASCR: DB 3 ; Number of characters DB CTRLZ ; First character (clear screen) DB ESC,')' ; Additional characters (dim) ; ;Backspace one character string. If this function is not ; available, leave the first byte zero, and WordStar ; will use cursor addressing to backspace. ; ORG 397H ; 5 bytes max. BAKSPC: DB 0 ; ;Erase to end of line string. If this function is not ; available, leave the first byte zero, and WordStar ; will perform the function more slowly via software. ; ORG 39CH ; 5 bytes max. ERAEOL: DB 2 ; Number of characters DB ESC ; First character DB 'T' ; Additional characters ; ;Erase to end of screen string. If this function is not ; available, leave the first byte zero, and WordStar ; will perform the function more slowly via software. ; ORG 3A1H ; 5 bytes max. ERAEOS: DB 0 ; Not available in NZTCAP ; ;Delete screen line containing the cursor, and move lower ; lines on the screen up one line. If this function ; is not available, leave the first byte zero, and ; WordStar will perform the function more slowly ; via software. ; ORG 3A6H ; 5 bytes max. LINDEL: DB 2 ; Number of characters DB ESC ; First character DB 'R' ; Additional characters ; ;Insert a blank line on the screen, moving the line ; containing the cursor, and the lines below it down ; one line. If this function is not available, leave ; the first byte zero, and WordStar will perform ; the function more slowly via software. ; ORG 3ABH ; 5 bytes max. LININS: DB 2 ; Number of characters DB ESC ; First character DB 'E' ; Additional characters ; ;WordStar will use LINDEL and LININS to delete or insert a group ; of lines rather than just displaying a whole new screenful ; of characters. LINMAX below indicates the maximum number ; of lines that this would generally be faster than the ; re-display. Set to zero if don't care. ; ORG 3B0H ; 1 byte LINMAX: DB 5 ; Five lines ; ;Terminal initialization string. A string of bytes which ; will be sent to the terminal at the beginning of a ; session. See also INISUB. ; ORG 3B1H ; 5 bytes max. TRMINI: DB -1 ; Number of bytes DW ERASCR ; Use extension mechanism (-1 as byte ; Count) to erase screen as initialization. ; ;Terminal un-initialization string. A string of bytes ; which will be sent to the terminal at the end of a ; session. See also UNISUB. ; ORG 3B6H ; 5 bytes max TRMUNI: DB 2 ; Number of bytes DB ESC,'(' ; ;User-patchable initialization subroutine. Called before ; the TRMINI string is sent. This subroutine may be ; used for special console initialization or other ; purposes. See UCRPOS comments. ; ORG 3BBH INISUB: JMP STRINIT ; Initialize strings via NZTCAP ; ;User patchable un-initialization subroutine. Called ; before the TRMUNI string is sent. This subroutine ; may be used to 'undo' any special terminal status ; used for the WordStar. See UCRPOS comments. ; UNISUB: NOP ; Normally NOP, or JMP to NOP ; Your subroutine RET ; ;Video attributes are used in various places on the WordStar display. ;The following table describes what each bit of an attribute byte ;means when used within WordStar. Note that when no bit is set, that ;is the normal condition. ; ; Bit WordStar Usage ; ; none Normal text ; 0 Strike-out text ; 1 Warning & error messages ; 2 Marked block of text ; 3 Underlined text ; 4 Subscripted text ; 5 Superscripted text ; 6 Bold text ; 7 Italic (or ribbon color) ; ; ;The VIDATT subroutine is used to change video attributes on the screen. ;On entry, WordStar will supply the NEW attributes in the C register and ;the OLD attributes in the B register. ; ;This subroutine is called only when a video attribute changes! ; ; ; TeleVideo 955 attributes ; BLINK EQU 2 ; Blinking REVRS EQU 4 ; Reverse video UNDRL EQU 8 ; Underline ; ; VT-100 attributes ; UNDR EQU 4 REVR EQU 7 ; ; WordStar attributes ; STRK EQU 1 ; Double Strike WARN EQU 2 ; Warning & Error messages BLOK EQU 4 ; Marked Block UNDL EQU 8 ; Underlining SUBS EQU 16 ; Subscripts SUPS EQU 32 ; Superscripts BOLD EQU 64 ; Bold text ITAL EQU 128 ; Italics or ribbon color change ; ; The following code at VIDATT maps the attributes as follows: ; ; WordStar TVI-955 VT-100 ; ; Strike-Out blink reverse ; Warning/Error blink, reverse reverse ; Marked Block bright/dim reverse ; Underline underline underline ; Sub-Script reverse reverse ; Super-Script reverse reverse ; Bold bright/dim reverse ; Italic reverse reverse ; ORG 3C1H VIDATT: MOV A,C ; New attributes XRA B ; XOR old attributes MOV B,A ; Changes to B ANI 10111011B ; Any 'big' changes? MOV H,A ; Save WordStar attributes JZ VIDINT ; No, do intensity ATTR: LDA ATTMSG ; Get the first byte of attribute message ORA A ; Check it for null JZ VIDINT ; No attribute string available LXI D,0 ; Build the attribute in DE (clear it here) MVI A,10111011B ; Attr mask ANA C ; Mask bold and blok off JZ ATTRX ; Back to 'normal' LDA WRAP ; WRAP is zero for ANSI ORA A JNZ ATT1 ; Non-zero for ASCII MVI E,UNDR ; Try underline first MOV A,H ANI UNDL MVI A,0 JNZ ATTRX ; Underline it MVI E,REVR JMP ATTRX ; Reverse it ATT1: MOV A,H ; Get WordStar attributes ANI STRK+WARN ; Strike-out or Warning.. JZ ATT2 ; Not Strike-out or Warning MVI A,BLINK ; Blink ORA E ; Or in the blink bit MOV E,A ; Put it back ATT2: MOV A,H ; Get WordStar attributes ANI ITAL+SUPS+SUBS+WARN ; If any of these.. JZ ATT3 ; If not MVI A,REVRS ; Reverse video ORA E ; Or the reverse bit MOV E,A ; Put it back ATT3: MOV A,H ; Get WordStar attributes ANI UNDL ; Check underline JZ ATTRX ; If not MVI A,UNDRL ; Underline bit ATTRX: ORA E MOV E,A ; Binary attributes to E LXI H,ATTMSG+1 ; Point to the message CALL PARSE ; Ship it, expanded (?) LDA WRAP ; WRAP is zero if ANSI ORA A JZ VIDINT ; ANSI attributes are complete MOV A,E ; Must be ASCII, get attributes ADI '0' ; ASCII bias CALL DISPLA ; Ship the character JMP VIDINT ; ;Normally the status line, text and directories are displayed in ;dim intensity so that bold and doublestruck text can be shown in ;high intensity. Setting BRITE to 0FFH reverses the usage of ;bright and dim for the status line, text and directories ;zero ;normally. ; ORG 441H BRITE: DB TRUE ; Reverse ; 0FFH = normal text bright ; ;Delays are executed after various terminal functions, before ; the next character is sent to the terminal, to ; allow response time required by certain terminals ; when operating at a high baud rate. Set to a ; larger value if you suffer a loss of characters ; after a terminal function. ; ;Note that an additional delay FUNDLY is located near the ; function key table FUNTBL above. ; ;Each delay is approximately the number of milliseconds ; on a 4 MHz Z80 processor, about twice as long on ; a 2 MHz 8080 (in other words, divide delay values ; in half for a 2 MHz processor to achieve the same ; results). ; DELCUS: DB 0 ; No delay after cursor positioning ; (if your terminal works better with ; 5 milliseconds of delay, you would ; Put a 5 here instead) DELMIS: ; Miscellaneous screen delays DB 0 ; No delay DXOFF: ; If XON/XOFF used for terminal, sometimes DW 2000 ; A legitimate ^S will be interpreted as an ; XOFF character. DXOFF is used to time out ; So that the terminal will continue. DLONG: ; Long delays (like at sign-on) DW 2000 ; 2 seconds = 2,000 milliseconds ; (1000 if 8080) DMED: ; Medium delays (like at P, O, or K menus) DW 1000 ; 1 second = 1,000 milliseconds ; (500 if 8080) DSHORT: ; Short delays (like before help menus) DW 200 ; 200 milliseconds (100 if 8080) UPDLY: ; Position update delay DW 200 ; 200 milliseconds (100 if 8080) DDISK: ; Disk access delay. If character typed DW 500 ; During disk access, wait this duration for ; More characters. 500 milliseconds DFAST: ; Delay when typing fast. Holds off displaying DW 50 ; The rest of the line briefly ; ;Optional user-supplied console I/O subroutines. You may ; patch JMP's here to your own console input, console ; output, and console status subroutines, in which ; case these routines, instead of the operating ; system BIOS entry points, will be used for all ; console I/O. These subroutines may alter all registers. ; ;Use of a custom subroutine accessed here is suggested, ; for example, to drive a video board that cannot be ; driven via output to the operating system. ; UCNSTA: ; User console status subroutine. NOP ; Normally NOP, or JMP to your own NOP ; Subroutine. Must return 0 in A if RET ; No character ready, 0FFH if one is ; Ready. UCONI: ; User console input subroutine. NOP ; Normally NOP, or JMP to your own NOP ; Subroutine. Must return the RET ; Character in A. May be called ; Before a character is ready. If ; No character is ready, routine ; Must wait until a character is ; Available. UCONO: ; User console output subroutine. NOP ; Normally NOP, or JMP to your own NOP ; Subroutine. Subroutine receives RET ; The character in A, video attributes in ; B, and current cursor address in HL. ; ;This is 128 bytes set aside for anything that the user wishes to use. ;If more than 128 bytes are required, it is necessary to put them after ;the main WordStar code which can be determined by looking at the ;contents of BGNMEM to see where it is. After using as much space as ;necessary, change BGNMEM to the new beginning of free memory. ; ORG 45BH MORPAT: ; ;CRTPAT is a patch area that may be used by WordStar's installation ;program. ; ORG 4DBH CRTPAT: ; ;If non-standard initialization parameters are used, the ;following identification string can be displayed at ;sign-on. Up to 40 bytes are available for the string, ;including the null terminator. ; ORG 6BBH INITID: DB 'Joe Wright Special ' DB MONTH/10+'0',MONTH MOD 10+'0','/' DB DAY/10+'0',DAY MOD 10+'0','/' DB YEAR/10+'0',YEAR MOD 10+'0' DB CR,LF,0 ; No ID if standard ; ;Legal Drives ; ;Note that the first drive is assumed to be the default drive where any ;special files are located such as the WSMSGS.OVR file. The drives listed ;should be reduced to the ones that are actually in use on the system ;upon which WordStar is running. ; ;If the most significant bit of the drive letter is set to 1, WordStar ;will assume that the drive is non-removable. A disk reset will not ;be done when non-removable drives are logged. ; ORG 6E3H LGLDRV: DB 'ABCDEFGHIJKLMNOP',0 ; Every legal drive ; ;Legal User Numbers ; ;Some CP/M operating systems can support user numbers from 0 to 15, ;others support 0 to 31. Also, a user can be prevented from accessing ;other user numbers if zero. ; LGLUSR: DB 32 ; Thirty two user numbers from 0 to 31 ; ;WordStar uses several files. Their names are specified here. WordStar ;uses the following search pattern to try to find the file: ; ; 1. Look on the current drive and user. ; 2. Default user (DEFUSR) on the current drive. ; 3. Current user on the default drive. ; 4. Default user on the default drive. ; ;If the drive byte of the filename is non-zero, it should be set to a ;number 1 through 16 representing drives A through P respectively. In ;this case, WordStar will look only on the specified drive and the ;DEFUSR user number for the file. ; MSFILE: ; Message file DB 0,'WSMSGS OVR' HPFILE: ; Help messages file DB 0,'WSHELP OVR' DB 0FFH ; Zero if never to search for help IXFILE: ; Indexer exclusion word list filename DB 0,'WSINDEX XCL' LDFILE: ; Load file for overlays DB 0,'WS OVR' OVFILE: ; Print driver overlays DB 0,'WSPRINT OVR' WSFILE: ; File containing WordStar (after running pgm) DB 0,'WS COM' SHFILE: ; Shorthand file DB 0,'WSSHORT OVR' ; ;If WordStar does not find its own files (WS.COM, WS.OVR...) on the ;logged user, it will look for them on the default user. ; DEFUSR: DB 0 ; Default user number for system files ; Set to 0-15 or 0-31 (depends on LGLUSR), ; Or -1 to defeat ; ;When you use the S command at the Opening Menu, this is the spelling ;check command that is used. If you want WordStar to prompt for the ;document to be checked and then automatically append it to this command, ;set SPFILE non-zero. ; ORG 74BH SPCMD: DB 2 ; Five letters in command DB 'TW' ; Run The WORD Plus ORG 758H SPFILE: DB TRUE ; Automatically ask ; ;When you run a program at the Opening Menu, WordStar first tries to find ;the COM file in the current drive and user, then in this drive and user. ;The default is to look on drive A, user 0. ; URUN: DB 1 ; Drive code (0=disabled, 1=A, 2=B, ...) DB 0 ; User number ; ;INILOG allows the user to specify a drive and user number for WordStar to ;log onto at start up time. The first byte is a character count, the ;following bytes (up to three) can contain a drive name (A-P) and user ;number (0-31). ; ORG 75BH INILOG: DB 0 ; ;WordStar creates backup and temporary files. The following ;are the file types to be used for them. ; ORG 75FH BAKTYP: ; Type for backup files DB 'BAK' BFTYPE: DB '$B$' ; File type of temporary file before memory AFTYPE: DB '$A$' ; File type of temporary file after memory BLKTYP: DB '$C$' ; Type for block move/copy buffer file ; ;When the directory is displayed, file types from this table ;are suppressed. Question marks may be used as wild cards to ;match any character (maximum 8 entries + null). ; NOTYPE: ; File types to be ommitted from directories DB 'COM' ; Command files DB 'OV?' ; Overlays DB 'REL' ; M-Rel files DB '$??' ; WordStar and other temporary files DB 0 ; End of table ; ;DIRFIL is a file name "image" that is used in conjunction with NOTYPE (above) ;to determine which files are to be displayed in WordStar's directories. ;DIRFIL determines which files can possibly be included, and NOTYPE then ;eliminates certain types of files. Use a question mark in DIRFIL at each ;spot where any file name character can match. ; ORG 784H DIRFIL: DB '???????????' ; All files match ; ;The name of the file to be edited can be specified at the operating system ;prompt. ININON indicates whether the file should be edited as a document ;or nondocument. ; ININON: DB TRUE ; Non-document from command line ; ;WordStar normally makes BAK backup files every time you save your work. ;INITBAK can be used to disable backups by setting it FALSE. ; INIBAK: DB TRUE ; Make backups ; ;When a nondocument is edited, WordStar will decide how to expand tabs ;(ASCII 09H), and whether or not to use auto-indenting by looking in this ;table. ; ;There is a special case of the tab masks shown below. When the most ;significant bit of the tab mask is set to 1, WordStar will assume that ;you want to use variable tabbing. When the tab key is typed, instead ;of inserting an ASCII 09H into the file, spaces will be entered up to ;the next tab stop. The tab stops used are in the INIRLR table. An ;ASCII 09H can still be entered in this mode, however, by typing ^PI. ; ; There is room for nine entries, including the required default entry. ; EDCOND: ; Edit conditions for specific file types DB 'PAS',00000001B,TRUE ; File extension, followed by a DB 'PLI',00000011B,TRUE ; Binary tab mask (e.g. a mask of DB 'C ',00000011B,TRUE ; 00000111B expands tab characters DB 'H ',00000011B,TRUE ; To every 8th column), followed by ; TRUE if auto-indent is turned on. ; ; Room for four more ; DB 0,0,0,00000111B,FALSE ; End of table with defaults if file ; Type doesn't match above ; ;WordStar normally only considers alphabetic or numeric characters ;as being within a "word". If other characters are legally part ;or a word too, then the bit for the corresponding character code in ;the following table must be set to a 1. ; ;There are 256 bits in the table to allow for 8-bit character sets. ;The default table has the bits set for the numbers "0" through "9" ;(ASCII codes of 30H through 39H), for the upper case letters ;"A" through "Z" (41H through 5AH), and the lower case letters "a" ;through "z" (61H through 7AH). Since the ASCII codes are only ;seven bits, the corresponding codes with the eighth bit set are ;also legal. ; ; I have modified these tables to my own preference. The interested ; user may want to change it again to his own. JWW ORG 7BEH LGLCHR: ; 01234567 89ABCDEF DB 00000000B,00000000B ; Codes 00H to 0FH DB 00000000B,00000000B ; Codes 10H to 1FH DB 00000000B,00000000B ; Codes 20H to 2FH DB 11111111B,11100000B ; Codes 30H to 3FH DB 01111111B,11111111B ; Codes 40H to 4FH DB 11111111B,11100000B ; Codes 50H to 5FH DB 01111111B,11111111B ; Codes 60H to 6FH DB 11111111B,11100000B ; Codes 70H to 7FH ; DB 00000000B,00000000B ; Codes 80H to 8FH DB 00000000B,00000000B ; Codes 90H to 9FH DB 00000000B,00000000B ; Codes A0H to AFH DB 11111111B,11100000B ; Codes B0H to BFH DB 01111111B,11111111B ; Codes C0H to CFH DB 11111111B,11100000B ; Codes D0H to DFH DB 01111111B,11111111B ; Codes E0H to EFH DB 11111111B,11100000B ; Codes F0H to FFH ; ;When you use ^A or ^F to move a word at a time, WordStar uses the ;following table to determine which characters to skip. It is organized ;in the same manner as LGLCHR above. 0 to skip, 1 to stop. ; MOVCHR: ; 01234567 89ABCDEF DB 11111111B,10010010B ; Codes 00H to 0FH DB 11111011B,11000011B ; Codes 10H to 1FH DB 00111111B,00000000B ; Codes 20H to 2FH DB 11111111B,11011110B ; Codes 30H to 3FH DB 11111111B,11111111B ; Codes 40H to 4FH DB 11111111B,11111111B ; Codes 50H to 5FH DB 11111111B,11111111B ; Codes 60H to 6FH DB 11111111B,11111110B ; Codes 70H to 7FH ; DB 11111111B,10010010B ; Codes 80H to 8FH DB 11111011B,11000011B ; Codes 90H to 9FH DB 00111111B,00000000B ; Codes A0H to AFH DB 11111111B,11011110B ; Codes B0H to BFH DB 11111111B,11111111B ; Codes C0H to CFH DB 11111111B,11111111B ; Codes D0H to DFH DB 11111111B,11111111B ; Codes E0H to EFH DB 11111111B,11111110B ; Codes F0H to FFH ; ;Certain special characters can be inserted into this table to cause ;WordStar to automatically generate a backspace character (^H) preceding ;the character as you type. This can be especially useful for accent ;characters in some foreign languages. ; AUTOBS: ; Automatic backspace table DB 0 ; Number of characters in table ; Up to 8 character codes ; ;When WordStar gets a file for editing, it will use the following ;initial conditions. ; ORG 807H INIDOC: ; Document initializations DB 3 ; Top of page margin. DB 8 ; Bottom of page margin. DB 66 ; Total lines per page. DW 1 ; Initial page number (note 2 bytes). DB TRUE ; Page number prints at bottom of page ; If TRUE. No page number if FALSE. DB 28 ; Column where page number prints. DB 2 ; Heading margin. This is the number of lines ; Above the text where the heading is to print. DB 2 ; Footing margin. This is the number of lines ; Below the text where the footing is to print. DB 00000111B ; Default document tab mask (must be ; Binary, 00000000B through 01111111B). DB 8 ; Left column where printing starts. DB TRUE ; Bidirectional printing if TRUE. Just ; Unidirectional or printer controlled ; If FALSE. (Many printers do not allow ; Software control of print direction). DB TRUE ; Letter quality printing if TRUE. Draft ; Quality if FALSE. (Only supported on ; Some printers.) DB 2 ; Microjustified printing. 0 turns it off, ; 1 turns it on, and 2 makes it discretionary ; (depending on the printer driver in use). DB FALSE ; Underline blanks between words if TRUE. ; NOTE: Not implemented for all printers. DB 12 ; Standard character width (in HMI units). ; The printer is reset to this when done ; Printing. DB 8 ; Standard line height (in VMI units). The ; Printer is reset to this after .LH dot ; Commands. It is also used to determine ; The page size in VMI units by multiplying ; By the lines per page above. DB 12 ; Character width (in HMI units) ; For normal pitch. If HMI is 120, ten pitch ; Is 12/120, twelve pitch is 10/120. DB 10 ; Character width for alternate pitch (use ; ^PA to select alternate pitch while editing). DB 3 ; Subscript and superscript roll (in VMI ; Units). This value determines how ; Far up or down the carriage moves when ; Subscripting or superscripting. DB 8 ; Line height (in VMI units). This value ; Determines how far to roll the carriage ; To get to the next line. ; ;The default ruler line can be described by defining the following values. ;Note that the tab stop tables must contain values in ascending order only. ;The regular tab stops are put in the table first, immediately followed by ;the decimal tabs. ; INIRLR: ; Ruler data DB 1 ; Left ruler margin DB 65 ; Right ruler margin DB 0 ; Paragraph margin DB 11 ; Eleven tabs DB 6,11,16,21 ; Tab stops DB 26,31,36,41 ; (Must be in DB 46,51,56 ; Ascending order) DB 0,0,0,0 ; Space for 4 more DB 0 ; No decimal tabs DB 0,0,0,0,0,0 ; Space for 6 INISIZ EQU $-INIDOC ; Size of document initialization ; ;INIRLI determines whether the ruler line is re-initialized from INIRLR each ;time any document is edited. If INIRLI is FALSE, you can change the initial ;ruler line with ^OL, ^OR, ^OI, and ^ON commands, and have those changes ;be used for every document edited until you exit WordStar. ; INIRLI: DB TRUE ; Initialize ruler for each document ; ;As you move through a document, WordStar executes some of the dot commands, ;like .RR ruler line commands, as they are encountered. As WordStar moves ;forward through the text, the old ruler line is stored in memory so that it ;can be restored when you move backwards over the .RR later. Other dot ;commands work in a similar manner. ; ;DSTKSZ is used to allocate storage for the dot commands. While you are ;editing, WordStar puts a Dot-Limit indicator in the status line if you ;use too many dot commands. ; ; Dot Command Size ; .RR 26 ; .RM .LM .LH .PL 1 ; .MT .MB 1 ; .PN 2 ; DSTKSZ: DW 75 ; Room for 2 .RR commands or 75 .RM & .LM ; ;INIDIR determines whether the directory is initially displayed or not. ;DIRSRT tells WordStar whether or not to sort directories in alphabetical ;order before displaying them. ; INIDIR: DB TRUE ; Directory on DIRSRT: DB TRUE ; Sort directory in alphabetical order ; ;INIHLP is the default help level. It can have a value from 0 to 3. ; INIHLP: DB 1 ; Maximum help level at start ; ;When editing, the last erasure can be undone with ^U. UNONE determines ;whether single character erasures with ^G and DEL can also be undone. ; UNONE: ; Don't unerase single characters DB FALSE ; ;UNSIZE is the maximum erasure that can later be undone. The unerase ;buffer shares the same memory space as the text you are editing. Making ;UNSIZE very large may cause WordStar to "spill over" to disk more ;frequently, slowing down editing. ; UNSIZE: DW 500 ; Maximum unerase size ; ;VMSIZE indicates the number of 128-byte records that can be read from ;the disk for WordStar's messages and menus. ; VMSIZE: DB 4 ; Four records (.5k byte) ; ;EDSIZE indicates the minimum number of records of edit buffer required ;to edit a document properly. WordStar must be able to keep a whole ;page in memory to determine page breaks and line numbers correctly. ;Less memory can sometimes be used with occasional strange results. ;(Non-documents are automatically allocated a minimum of 6 records.) ; EDSIZE: DB 24 ; Enough memory for an average full page ; ;BFSIZE is the number of 128-byte records that WordStar uses for its ;general purpose buffer. There is a different buffer allocation for ;editing, the Opening Menu, and for merge printing. ; ;This buffer is used for: ; ; - File directories (each file uses 11 bytes), ; - Printer driver directory (each driver uses 11 bytes and 256 ; bytes are used for buffering), ; - File copies, ; - Block reads and writes, ; - Merge printing. ; BFSIZE: DB 16 ; Edit buffer size (16 records = 2k) ; (Minimum is 1 record) DB 8 ; Opening menu buffer size ; (Minimum is 3 records) DB 8 ; Merge print buffer size ; (Minimum is 1 record) ; ;If a document becomes too large to fit in memory at one time, WordStar ;begins to "spill" the excess to the disk. TYSIZE determines how many ;128-bytes records to use for each spillover. Picking a correct size ;is important but can usually be done by trial and error. If TYSIZE is ;too large, you may see long delays during scrolling or typing when memory ;fills. ; TYSIZE: DB 16 ; Number records read or stored while typing ; ;A "find" or "find and replace" uses the INIFIN options if you do not ;explicitly enter any at the "Options?" prompt. The possible options ;that can be used are: ; ; W whole words only ; U ignore case ; B backwards search ; G whole file ; R rest of file ; N replace without asking ; ;Blank the unused options. ; ORG 849H INIFIN: DB ' ' ; No options ; ;The status line is usually displayed at the top of the screen. ;INISTA lets you always turn it off. STFILL specifies what character ;to use to fill unused space in the status line. ; INISTA: DB TRUE ; Display status line STFILL: DB '-' ; Fill with dashes ; ;When paragraphs are aligned with ^B or ^QU and hyphen help is on, HYMAX ;is used to determine when to ask the user to hyphenate a word. ; HYMAX: DB 5 ; Ask user when the word extends more than 5 ; Characters past the right margin ; ;When WordStar asks a question that requires a Y for yes or N for no response, ;YNCR indicates whether or not the user must push the RETURN key before ;WordStar will accept it. ; YNCR: DB FALSE ; Don't wait for RETURN key ; ;WordStar can index every word in a document as well as selected words and ;phrases. IDXALL determines whether this is the default or not. ; IDXALL: DB FALSE ; Don't index every word ; ;Using ^B or ^QU in a nondocument normally strips the eighth bit from ;each character in a line. STRPFL can disable stripping. ; STRPFL: DB TRUE ; Stripping is enabled ; ;Editor Entry Conditions ; INIEDT: DB TRUE ; Right justification when typing DB TRUE ; Word wrap when typing at end of line DB TRUE ; Insert on DB TRUE ; Print controls displayed DB FALSE ; No hyphen help DB TRUE ; Ruler displayed DB FALSE ; Block column mode off DB FALSE ; Block column replace mode off DB 1 ; Single spacing DB 2 ; Scrolling speed DB FALSE ; Proportional spacing off DB FALSE ; Soft space not displayed DB 0,0,0 ; Reserved ; INIESZ EQU $-INIEDT ; Size of editor conditions ; ;The following are special characters that affect how numbers are ;evaluated and dispayed. ; COMCHR: DB ',' ; Comma to separate 1,000's DECCHR: DB '.' ; Decimal point ; ;The following flags are used to control the way WordStar processes ;certain commands. CTLNFL and CTLHFL are provided primarily to allow ;WordStar 3.3 users to use ^N and ^H in the same way as they are accustomed. ; CTLNFL: DB FALSE ; Set true if ^N to break line and ; RETURN moves down a line when insert off. ; Set false so ^N converts paragraph lines ; And turns auto indent on/off for ; Nondocuments, and RETURN always inserts CRLF. CTLHFL: DB FALSE ; Set non-zero if ^H to be same as ^S instead ; Of DEL. CASEFL: DB FALSE ; Set non-zero if ^^ is case toggle. When ; Zero and CLTNFL is non-zero, use as ; Paragraph line and auto-indent on/off. DELFLG: DB FALSE ; Set non-zero if DEL erases to left, zero ; To erase to right (like ^G). BLKFLG: DB TRUE ; Set non-zero if the cursor should move ; To column 1 if the cursor is next to a block ; Marker at the left edge of the screen LSPFLG: DB FALSE ; Set non-zero if lines with soft carriage ; Returns should not be added to paragraphs ; For line spacing other than 1 ; ;RLRVID allows the user to select video attributes used to highlight ;the ruler line. See VIDATT for bit definitions. ; RLRVID: DB FALSE ; No ruler highlighting ; ;AHEAD indicates whether type ahead is allowed for ^E, ^X, ^W, ^Z, ;^G, DEL, ^T, ^Y, ^QY, and ^QDEL. If AHEAD is 0, WordStar's type ;ahead buffer will be flushed whenever one of the functions is ;encountered. If it is non-zero, no flushing will occur. This ;flag should be used primarily for external keyboard enhancers where ;the functions shown above are to be used. WordStar's function key ;and shorthand processing automatically compensate. ; AHEAD: DB TRUE ; ;Maximum size for the shorthand definitions. Should be optimized to ;match actual usage since it reduces the amount of memory available ;for text while editing and printing. The size of each definition ;is equal to 5 plus the number of characters defined. If this value ;is smaller than the size of the shorthand file (see SVFILE above), ;only some of the definitions will be used. Setting it to zero ;disables shorthand and makes the ESC key clear the screen instead. ; HANMAX: DB 4 ; Size of shorthand buffer in records ; (4 times 128 = 512 bytes) ; ;With shorthand you can insert the dollar-formatted results of the last ;math you performed. WordStar uses the format below when you do this. ;(Make sure that the character count includes the zero at the end.) ; DOLLAR: DB 17 ; Character count DB '--,---,---,---.99' ; ;EXTRA is a large buffer area for general patching. Some versions of ;the WINSTALL installation program use EXTRA. Whenever EXTRA is used, ;RAM1ST must be changed to point to the first available byte within EXTRA ;that is still available for WordStar's use. If all of EXTRA is used, ;RAM1ST should point to ENDPAT. ; ORG 894H RAM1ST: DW ENDPAT ; First location in EXTRA that WordStar can use ; EXTRA: ; Z3ENV EQU 109H ; Z3 environment descriptor address MAXDRV EQU 2CH ; Maximum drive from Z3ENV CLSTR EQU 97H ; CL string in Termcap ; ; Initialize the various terminal strings needed by WordStar ; STRINIT: LHLD Z3ENV ; Get the 'installed' environment address MOV A,H ORA L ; Check for zero JZ NOTINS ; Report 'Not Installed' and quit XCHG ; Environment address to DE LXI H,8FH ; Offset to terminal type DAD D ; Point to it MVI A,10H ; ANSI term type XRA M ; Zero if ANSI JNZ STRIN STA WRAP ; VT-100 does not wrap, TVI and WYSE do. STRIN: XCHG ; Env address back to HL LXI D,CLSTR DAD D ; Point to TCAP's CL string ; ; Concatenate TCAP's CL and SO strings at ERASCR ; LXI D,ERASCR ; WordStar's string MVI C,0 ; Initialize a counter PUSH D ; Save pointer to erascr INX D ; Bump it CALL GETSTR ; Get CL string from TCAP SHLD CMSTR ; Save location of CM string CALL NEXT ; Skip CM string PUSH H ; Save pointer to CE CALL NEXT ; Skip CM and CE CALL GETSTR ; Get SO string POP H ; Get pointer to CE POP D ; Pointer to erascr MOV A,C ; Byte count at erascr STAX D ; Plug it in ; LXI D,ERAEOL ; Point to WordStar's string CALL PUTSTR ; Put CE LXI D,DIMMSG ; Point to WordStar's string CALL PUTSTR ; Put SO LXI D,BRTMSG ; Point to WordStar's string CALL PUTSTR ; Put SE CALL PARSE ; Send TI string to terminal LXI D,TRMUNI ; Point to WordStar's string CALL PUTSTR ; Put TE LXI D,LINDEL ; Point to WordStar's string CALL PUTSTR ; Put Delete Line LXI D,LININS ; Point to WordStar's string CALL PUTSTR ; Put Insert Line LXI D,ATTMSG ; Point to WordStar's string CALL PUTSTR ; Put Attribute ; ; Set WordStar's legal drives string ; LHLD Z3ENV ; Environment LXI D,MAXDRV ; Offset DAD D ; Point to maxdrv in Z3ENV MOV A,M ; Get maxdrv in A LXI H,LGLDRV ; Legal drive string MVI B,'A' ; Start with drive A MXD: MOV M,B ; Move B into the string INX H ; Point to the next position INR B ; Next drive letter DCR A ; Decrement maxdrv no. JNZ MXD ; Again if not zero MOV M,A ; Terminate the string with zero RET ; ; Put the null-terminated string at (HL) into a length-defined ; string at (DE). ; PUTSTR: PUSH D ; Pointer to beginning of destination INX D ; Start the string here MVI C,0 ; Clear character counter CALL GETSTR ; Get the string from (HL) to (DE) POP D ; Point to the beginning again MOV A,C ; Get the character count STAX D ; Plug it in RET ; ; Move a null-terminated string from (HL) to (DE), counting them in C. ; GETSTR: MOV A,M ; Get a byte INX H ; Point to the next one STAX D ; Store it at (DE) ORA A ; Check for null RZ ; Finished if so INX D ; Point to next one INR C ; Increment character counter JMP GETSTR ; Try again ; ; Skip over the present string to the next one. ; NEXT: MOV A,M ; Get a byte INX H ; Point to next ORA A ; Check for null JNZ NEXT ; If not, try again, else.. RET ; ; Report 'Not Installed' and quit ; NOTINS: LXI H,NOTZ3 ; Point to the message CALL PARSE ; Send it JMP 0 ; Quit to operating system NOTZ3: DB ' Not Installed for ZCPR3',0 ; ; VIDATT enters here to parse and send the attribute string. ; Enter with HL pointing to the string and E containing the 1st ; (and D the 2nd) variable. PARSE can be used as a general purpose ; null-terminated string output routine (no % or \ please). ; PARSE: PUSH B ; Save the attribute bits in BC CALL PSTRNG ; Print and expand the string at HL POP B ; Restore BC RET ; ; Arrive here with row in L and column in H (rel 0) ; POSCUR: XCHG ; Row/Col to DE LHLD CMSTR ; Point to cursor movement string PSTRNG: XRA A ; Get a zero STA RCB ; Relative char base GOXY: MOV A,M ; Get the character from CM string INX H ; Point to the next one ORA A ; Check for null RZ ; Finished if so CPI '\' JZ LITERAL ; Send the next character, regardless. CPI '%' ; Command? JZ GXYCMD ; Do something, else.. SHIP: CALL DISPLA ; Send A to the terminal JMP GOXY ; Again ; ; Interpret next character as a command ; GXYCMD: MOV A,M ; Get the command character INX H ; Point to next character CPI 'a' ; Check lower case JC CASOK CPI 'z'+1 JNC CASOK ANI 5FH ; Force upper case CASOK: CPI 'D' JZ XYDEC ; Send Row/Col as decimal digits CPI '2' JZ XYDEC ; Send two decimal digits CPI '3' JZ XYDEC ; Send three decimal digits CPI 'I' JZ XYINC ; Increment Row/Col by 1 CPI 'R' JZ REVORD ; Send Col first, then Row CPI '.' JZ BINARY ; Send binary CPI 'N' JZ NULOUT ; Send a null CPI '+' JNZ GOXY ; Unknown command, Ignore it, else... ; ; Output value in E with added bias ; MOV A,M ; Bias from TCAP string INX H ; Next BINOUT: ADD E ; Add Row/Col to bias MOV E,D ; Next time.. JMP SHIP ; Ship it ; ; Send Binary value ; BINARY: LDA RCB ; Get relative bias JMP BINOUT ; Do it ; ; Send a NULL (00h) to the terminal ; NULOUT: XRA A ; Get a null JMP SHIP ; Ship it ; ; Send the next character literally. ; LITERAL:MOV A,M ; Get the character INX H ; Point to the next one JMP SHIP ; Ship it ; ; Swap Row and Column ; REVORD: MOV A,D ; Save D a moment MOV D,E ; Move E to D MOV E,A ; Old D to E JMP GOXY ; Again ; ; Increment before processing D command ; XYINC: XRA A INR A ; Get a 1 STA RCB ; Save it JMP GOXY ; Again ; ; Output value in E as decimal digits ; Enter with A containing 44h, 33h or 32h ; XYDEC: ANI 7 DCR A ; Now 1, 2 or 3 MOV B,A ; Save it in B LDA RCB ; Relative bias (0 or 1) ADD E ; Value in A MOV E,D ; Next time.. MVI D,1 ; Assume leading zeroes DCR B JZ XYD2 ; Two digits DCR B JZ XYD3 ; Three digits DCR D ; D goes to 0 (no leading zeroes) XYD3: MVI B,100 CALL DECO ; 100's digit XYD2: MVI B,10 CALL DECO ; 10's digit MOV C,A CALL DECOT ; 1's digit JMP GOXY ; Again ; ; Divide A by B and output the ASCII result ; C is the 'scratch' register ; Return Remainder in A ; DECO: MVI C,0 ; Clear C DEC0: SUB B ; A - B JC DEC1 ; Overflow, else.. INR C ; Develop quotient in C JMP DEC0 ; Again DEC1: ADD B ; Remainder MOV B,A ; Remainder to B JNZ DECOT ; Ship digit from C MOV A,D ; Chars shipped ORA A ; RZ ; Don't send leading zeroes DECOT: INR D ; D is non-zero after any char is shipped MOV A,C ; Get quot digit ADI '0' ; Ascii bias CALL DISPLA ; Ship it MOV A,B ; Get Remainder RET ; VIDINT: MVI A,BOLD+BLOK ; Check bold or blok.. ANA B ; For change RZ ; No change, go home MOV A,C ; Get new attributes ANI BOLD+BLOK ; Check bold or blok JZ DIM ; Dim if neither CPI BOLD+BLOK ; Check bold and blok JZ DIM ; Dim if both CPI BOLD ; Check bold only JZ BRIGHT ; Bright if so LDA BRITE ; Must be blok only ORA A ; Set Z accordingly JNZ DIM ; Take opposite sense of brite ; BRIGHT: LXI H,BRTMSG+1 JMP PARSE ; DIM: LXI H,DIMMSG+1 JMP PARSE ; BRTMSG: DB 2,ESC,'(' ; Bright DS 13 ; Allow 16 bytes DIMMSG: DB 2,ESC,')' ; Dim DS 13 ; Allow 16 bytes ATTMSG: DB 2,ESC,'G' ; Change attributes DS 13 ; Allow 16 bytes RCB: DB 0 ; Relative bias (0 or 1) CMSTR: DW 0 ; Cursor movement string address UVERS: DB VERS ; User area version number preceding UDATE ; ; This is the end of the patch area. A size test follows. ; ENDPAT: ; ENDPAT points to UDATE UDATE: DB MONTH,DAY,YEAR ; User area version date IF ENDPAT-EXTRA GT 512 *** EXTRA Patch Area Larger Than 512 Bytes *** ENDIF END ; ; End of WS4PAT.MAC