; XEROX 820-II SPECIFIC PATCHES FOR WS4 ASEG .Z80 ORG 029BH STRING EQU 0283H FALSE EQU 0 TRUE EQU NOT FALSE REVERSE EQU TRUE IF REVERSE BRIGHT EQU ')' DIM EQU '(' MODE EQU '7' ELSE BRIGHT EQU '(' DIM EQU ')' MODE EQU '8' ENDIF BS EQU 8 LF EQU 0AH CR EQU 0DH ESC EQU 1BH DEL EQU 7FH CTRL@ EQU 0 CTRLA EQU 1 CTRLB EQU 2 CTRLC EQU 3 CTRLD EQU 4 CTRLE EQU 5 CTRLF EQU 6 CTRLG EQU 7 CTRLH EQU 8 CTRLI EQU 9 CTRLJ EQU 0AH CTRLK EQU 0BH CTRLL EQU 0CH CTRLM EQU 0DH CTRLN EQU 0EH CTRLO EQU 0FH CTRLP EQU 10H CTRLQ EQU 11H CTRLR EQU 12H CTRLS EQU 13H CTRLT EQU 14H CTRLU EQU 15H CTRLV EQU 16H CTRLW EQU 17H CTRLX EQU 18H CTRLY EQU 19H CTRLZ EQU 1AH ;CTRL[ EQU 1BH ;CTRL\ EQU 1CH ;(CTRL,) FOR XEROX 820 KEYBOARD ;CTRL] EQU 1DH ;CTRL^ EQU 1EH ;(HELP) FOR XEROX 820 KEYBOARD CTRL_ EQU 1FH ;(^-) FOR XEROX 820 KEYBOARD ;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. ; FUNDLY:: DB 1 ;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 1CH ;Character that starts each burst ;(set to 0FFh to disable) ; XEROX 820-II FUNCTION KEY TABLE FUNTBL: ; KEYPAD FUNCTION DEFINITIONS DB 2 DB 1CH,'1' DB 2 DB CTRLK,'1' DB 2 DB 1CH,'2' DB 2 DB CTRLK,'2' DB 2 DB 1CH,'3' DB 2 DB CTRLK,'3' DB 2 DB 1CH,'4' DB 2 DB CTRLK,'4' DB 2 DB 1CH,'5' DB 2 DB CTRLK,'5' DB 2 DB 1CH,'6' DB 2 DB CTRLK,'6' DB 2 DB 1CH,'7' DB 2 DB CTRLK,'7' DB 2 DB 1CH,'8' DB 2 DB CTRLK,'8' DB 2 DB 1CH,'9' DB 2 DB CTRLK,'9' DB 2 DB 1CH,'0' DB 2 DB CTRLK,'0' DB 2 DB 1CH,'.' DB 2 DB CTRLK,CTRLH DB 2 DB 1CH,01H ;UP ARROW DB 1 DB CTRLE DB 2 DB 1CH,02H ;DOWN ARROW DB 1 DB CTRLX DB 2 DB 1CH,03H ;RIGHT ARROW DB 1 DB CTRLD DB 2 DB 1CH,04H ;LEFT ARROW DB 1 DB CTRLS DB 2 DB 1CH,'-' DB 3 DB CTRLQ,CTRLQ,CTRLR DB 2 DB 1CH,'+' DB 3 DB CTRLQ,CTRLQ,CTRLC DB 0 ;END OF TABLE DW FNTBL2 ;EXTENSION ADDRESS FOR TABLE IF $ GT FUNTBL+128 ******* FUNTBL IS TOOOOOO LARGE ENDIF IF $ LT FUNTBL+128 REPT 128-($-FUNTBL) ;FILL REMAINDER OF 128 BYTES DB 0 ENDM ENDIF DB 0,0 ;Reserved ; ; 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. ; ; ;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. ; DELSTR:: DB 3 ;Number of chars in string DB 'DEL' ;What is displayed DB 0,0 ;Spare bytes ; ;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. ; SHYSTR:: DB 1 ;Number of chars in string DB '=' ;What is displayed DB 0,0,0,0 ;Spare bytes ; ;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. ; BBLOCK:: DB 3 ;Three chars DB '' ;Begin block DB 0 ;1 spare ; KBLOCK:: DB 3 ;Three chars DB '' ;End block DB 0 ;1 spare ; ;Special character used when displaying soft spaces with ^OB. ; SOFTSP:: DB '+' ;Soft spaces show up as plus signs DB 0,0,0,0,0 ;Reserved ; ;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. ; CRTID:: DB 'Xerox 820-II ',CR,LF,0 ;Terminal name DB ' ' ;Extra room ; ;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. ; CLEAD1:: ;Initial lead-in string DB 2 ;Number of characters DB ESC ;First character DB '=' ;Second character DB 0,0 ;Space for two more characters CLEAD2:: ;Sent between line and column DB 0 ;Number of characters, none in our DB 0 ;example. First character DB 0,0,0 ;Space for three more characters CTRAIL:: ;Terminating string DB 0 ;Number of characters DB 0,0,0,0 ;Space for four characters 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:: NOP ;Normally NOP, or JMP to your cursor NOP ;positioning routine. RET ; ;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). ; ERASCR:: DB 3 ;Number of characters DB CTRLZ ;First character (clear screen) DB ESC,DIM ;Room for 17 characters total INISCR: DB 9 DB CTRLZ ;First character (clear screen) DB ESC,MODE DB ESC,DIM DB ESC,'1' DB ESC,'<' ;USED BY MY CUSTOM ROM..WON'T HURT YOU DB 0,0,0 ; ;Backspace one character string. If this function is not ; available, leave the first byte zero, and WordStar ; will use cursor addressing to backspace. ; BAKSPC:: DB 1 ;Number of characters DB BS ;First character DB 0,0,0 ;Additional characters ; ;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. ; ERAEOL:: DB 2 ;Number of characters DB ESC ;First character DB 'T',0,0 ;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. ; ERAEOS:: DB 2 ;Number of characters DB ESC ;First character DB 'Y',0,0 ;Additional characters ; ;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. ; LINDEL:: DB 2 ;Number of characters DB ESC ;First character DB 'R',0,0 ;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. ; LININS:: DB 2 ;Number of characters DB ESC ;First character DB 'E',0,0 ;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. ; LINMAX:: DB 0 ; ;Terminal initialization string. A string of bytes which ; will be sent to the terminal at the beginning of a ; session. See also INISUB. ; TRMINI:: DB -1 ;Number of bytes DW INISCR ;Use extension mechanism (-1 as byte DB 0,0 ;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. ; TRMUNI:: IF REVERSE DB 4 ;Number of bytes DB ESC,DIM DB 1AH,6 ELSE DB 4 ;Number of bytes DB ESC,BRIGHT DB 1AH,6 ENDIF ; ;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. ; INISUB:: NOP ;Normally NOP, or JMP to NOP ;your subroutine RET ; ;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) ; ;For this sample installation, the following translation of attribute ;bits into video conditions could be used. ; ; WordStar Example ; ; Normal Dim ; Warning Bright ; Marked Bright ; Underlined Bright ; Subscripted Bright ; Superscripted Bright ; Highlighted Bright ; Italic Bright ; ;Because each terminal uses such diverse strings to change video ;attributes, you must provide a custom subroutine at VIDATT to ;build the proper one for yours. You may be able to take advantage ;of the fact that many terminals use a binary method to encode the ;attributes. If you do not wish to use any video attributes, put ;the customary two NOP's followed by a RET at VIDATT to disable it. ; ;The VIDATT subroutine is used to change video attributes on the screen. ;On entry, WordStar will supply the attributes that are on in the C ;register. You must translate them into whatever your particular terminal ;requires. The following implementation is a sample installation. ;This subroutine is called only when a video attribute changes. ; ; XEROX 820-II VIDEO ATTRIBUTE PATCH FOR WS4 VIDATT:: LD HL,HILITE LD A,C AND 11111110B JR Z,BOLDTEST LD A,(BRITE) OR A JP Z,STRING JR NORMVID BOLDTEST: LD A,C AND 00000001B JP NZ,STRING NORMVID: LD HL,LOWLIT JP STRING HILITE: DB 2,1BH DB BRIGHT LOWLIT: DB 2,1BH DB DIM ; PATCH TO CONVERT XEROX HI-PROFILE FUNCTION KEYS ; WITH BIT 7 HIGH INTO TWO BYTE STRINGS PREFIXED ; WITH 1CH. ALSO CONVERTS HELP KEY (1EH) TO 0AH ; (CTRL J) &(CTRL -) TO A PSEUDO FUNCTION KEY. XECONST: LD A,(FUNFLG) ;IS A FUNCTION KEY READY ? OR A JR Z,KDLY1 ;IF NO FUNCTION KEY OR 0FFH RET KDLY1: LD A,0 ;INSURE THAT THE INTERUPT DRIVEN KEYDLY EQU $-1 ;820-II BIOS ISN'T FASTER THAN AND 7 ;THE FUNCTION KEY ROUTINE DEC A LD (KEYDLY),A JR Z,BCONST XOR A RET BCONST: LD HL,(1) ;GET WBOOT VECTOR INC HL ;POINT TO CONSTS INC HL INC HL JP (HL) ;GET BIOS KB STATUS XECONIN: LD A,0 ;GET FUNCTION FLAG FUNFLG EQU $-1 INC A ;FUNCTION ACTIVE ? JR NZ,BCONIN ;IF NOT,GET KB CHAR LD (FUNFLG),A ;CLEAR FUNCTION FLAG LD A,0 ;ELSE, SEND CHAR #2 OF FUNC KEY CHAR2 EQU $-1 RET ;GET KB CHAR WITH BIOS CALL BCONIN: XOR A ;CLEAR FUNCTION FLAG LD (FUNFLG),A LD HL,(1) ;GET BIOS WBOOT ADDR LD DE,6 ;BIOS CONIN OFFSET ADD HL,DE LD DE,CONRET ;RETURN ADDRESS PUSH DE JP (HL) ;GET CHAR CONRET: CP 1EH ;HELP KEY ? JR NZ,NXTTST LD A,0AH ;CONVERT TO WS HELP KEY RET NXTTST: CP 1FH ;CTRL_ ? JR Z,SETFUNC ;MAKE CTRL_ INTO A FUNC KEY ;NO OTHER KEYS ARE CONVERTED, BUT IF THEY ;WERE, YOU COULD DO IT HERE FUNCTST: BIT 7,A ;FUNCTION KEY ? RET Z ;IF NOT, WE'RE DONE SETFUNC: RES 7,A ;RESET BIT 7 LD (CHAR2),A ;SAVE THE BASIC CHAR LD A,0FFH LD (FUNFLG),A ;SET PASS2 FLAG LD A,1CH ;FUNCTION KEY LEAD-IN RET IF $ GT VIDATT+128 ******* VIDATT IS TOOOOOO LARGE ENDIF IF $ LT VIDATT+128 REPT 128-($-VIDATT) ;FILL REMAINDER OF 128 BYTES DB 0 ENDM ENDIF ; ;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. ; BRITE:: DB 0 ;Don't 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) ;---------------------------------------------------------------------- ;NOTE....This function combined with AHEAD can cause SERIOUS problems ; for even moderately fast touch typists if left in the default ; values supplied by Micropro. RWS DDISK:: ;Disk access delay. If character typed DW 0 ;during disk access, wait this duration for ;more characters. (500 milliseconds default) ;----------------------------------------------------------------------- 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. UCNSTA:: JP XECONST UCONI:: JP XECONIN UCONO:: NOP NOP RET MORPAT:: DS 128 CRTPAT:: ; EXTENSION OF FUNCTION TABLE FNTBL2: ; UPPER ROW OF MAIN KEYBOARD + TAB KEY DB 2 DB 1CH,CTRLQ ;CTRL 1 (!) DB 2 DB CTRLQ,CTRLR ;TOP OF FILE DB 2 DB 1CH,CTRLR ;CTRL 2 (@) DB 2 DB CTRLQ,CTRLE ;TOP OF SCREEN DB 2 DB 1CH,CTRLS ;CTRL 3 (#) DB 2 DB CTRLQ,CTRLI ;GOTO PAGE/LINE DB 2 DB 1CH,CTRLT ;CTRL 4 ($) DB 2 DB CTRLK,CTRLD ;SAVE,GO TO MENU DB 2 DB 1CH,CTRLU ;CTRL 5 (%) DB 2 DB CTRLK,CTRLQ ;QUIT,GO TO MENU DB 2 DB 1CH,CTRLV ;CTRL 6 (^) DB 1 DB 1EH ;HARD>SOFT OR AUTO INDENT DB 2 DB 1CH,CTRLW ;CTRL 7 (&) DB 2 DB CTRLQ,CTRLA ;FIND & REPLACE DB 2 DB 1CH,CTRLX ;CTRL 8 (*) DB 2 DB CTRLQ,CTRLF ;FIND DB 2 DB 1CH,CTRLY ;CTRL 9 '(' DB 2 DB CTRLQ,CTRLS ;BEGINNING OF LINE DB 2 DB 1CH,CTRLP ;CTRL 0 ')' DB 2 DB CTRLQ,CTRLD ;END OF LINE DB 2 DB 1CH,CTRL_ ;CTRL _/- DB 2 DB CTRLQ,DEL ;DEL LINE TO LEFT DB 2 DB 1CH,CTRLZ ;CTRL +/= DB 2 DB CTRLQ,CTRLY ;DEL LINE TO RIGHT DB 2 DB 1CH,CTRLI ;CTRL TAB DB 2 DB CTRLP,CTRLI ;INSERT ASCII TAB CHAR DB 0 ;END OF TABLE DW 0 ;EXPANSION ADDRESS IF $ GT CRTPAT+128 ******* FNTBL2 IS TOOOOOO LARGE ENDIF IF $ LT CRTPAT+128 REPT 128-($-CRTPAT) ;FILL REMAINDER OF 128 BYTES DB 0 ENDM ORG 086DH ; ;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. ; ;NOTE....This function combined with DDISK can cause SERIOUS problems ; for even moderately fast touch typists if left in the default ; values supplied by Micropro. RWS AHEAD:: DB TRUE ;DON'T Flush END