home *** CD-ROM | disk | FTP | other *** search
- ; WordStar Terminal definitions and smooth
- ; scroll code for the Osborne I
- ;
- ; Portions from WordStar manual,
- ; INSTALL program,
- ; Portable Companion,
- ; and George Peace.
- ;
- ; future revisions:
- ; (Try to) implement low intensity with memory mapped video.
- ; (Try to) use arrow key definitions from BIOS
- ;
- ; revision 4 - 3/28/83
- ; Add code to set the auto horiontal scroll flag in BIOS
- ; to allow operation without regard for disk setup option.
- ;
- ; revision 3 - 3/26/83
- ; Upgrade of WSMODS.ASM to include the features listed above.
- ;
- ; revision 2 - 2/21/83
- ; First field release - did not work with 1.4+ machines.
- ; This release was withdrawn soon thereafter.
- ;
- ; revision 1 - ???????
- ; Internal development version - never released
- ;
- ;-----------------------------------------------------------------------
- ;
- ; Direct comments, additions, and corrections to:
- ;
- ; George F Peace
- ; 1703 Headwaters Road
- ; Midlothian, Virginia 23113
- ;
- ; CompuServe id 71555,1501
- ;
- ; (Please keep me up to date)
- ;
- ;
- ; This file is a major rework of the Thom Hogan WordStar modification
- ; which appeared in an early issue of the Portable Companion. This
- ; file is an effort to correct the problems in the original version
- ; and provide a path for BIOS 1.4 and WS 3.0 upgrades. Most notable
- ; is that the Osborne I BIOS level is transparent to these routines
- ; whereas the original routines contained hard-coded references to version
- ; 1.3 BIOS. The terminal initialization routine has been expanded to use
- ; the addresses of the installed BIOS rather than values assumed by the
- ; author. Another change is that all hard-coded references to WordStar
- ; internal addresses have been replaced with configuration EQUates. In
- ; addition, I have provided code to allow user customization of several
- ; other WordStar terminal-related parameters.
- ;
- ;
- ;
- ; Installation Procedure:
- ;
- ;
- ; Put WS.COM, etc. on A:
- ; Put ASM, DDT, and WSMOD3.ASM on B:
- ;
- ; B:
- ; ERA B:WS.COM
- ; ERA B:WSMOD3.HEX
- ; ASM WSMOD3.BBZ
- ; DDT A:WS.COM
- ; IWSMOD3.HEX
- ; R
- ; G0
- ; SAVE 62 B:WS.COM for WordStar level 3.0
- ; SAVE 56 B:WS.COM for WordStar level 2.26
- ; B:WS (test, then copy to A:)
- ;
- ;
- FALSE EQU 0
- TRUE EQU NOT FALSE
- ;
- ESCAPE EQU 27 ;ASCII code of <ESC>
- ;
- ;
- ; C O N F I G U R A T I O N S E C T I O N
- ;
- ;
- SMOOTH EQU TRUE ;if TRUE, smooth scrolling implemented
- HILITE EQU FALSE ;if TRUE, underlined video selected for hilite
- WIDE EQU TRUE ;if TRUE, wide character width set
- WS226 EQU TRUE ;if TRUE, use WS 2.26 addresses
- WS30 EQU FALSE ;if TRUE, use WS 3.0 addresses
- ;
- ;
- ; Osborne-specific constants
- ;
- SCRWID EQU 52 ;number of columns displayed on CRT. For example,
- ;if 80Plus is installed and you are running
- ;with 80 columns displayed, set SCRWID to 80.
- CURSOR EQU 0EF5Ah ;location of cursor position in BMRAM
- ;(same in 1.3 and 1.4)
- SCREEN EQU 0F000h ;location of screen in RAM
- AHSENB EQU 00068h ;offset of AHSENB in BIOS (scroll flag)
- ;
- ;
- ; Now for the WordStar constants
- ;
- IF WS226
- IOUT EQU 00106h ;location of output routine in WordStar
- WSCOL EQU 0371Eh ;location of WordStar column pointer
- SCRRET EQU 01BBBh ;address to return to from screen scroll
- CMDADDR EQU 01BB4h ;address to intercept prompt/command
- DATADDR EQU 030D2h ;address to intercept data character
- MEM EQU 07400h ;address PBGMEM points to in release
- ENDIF
- IF WS30
- IOUT EQU 00106h ;location of output routine in WordStar
- WSCOL EQU 03561h ;location of WordStar column pointer
- SCRRET EQU 01BEAh ;address to return to from screen scroll
- CMDADDR EQU 01BE3h ;address to intercept prompt/command
- DATADDR EQU 02ED2h ;address to intercept data character
- MEM EQU 07900h ;address PBGMEM points to in release
- ENDIF
- ;
- ;
- ALABEL EQU 035EH
- ASCUR EQU 0260H
- CB4LFG EQU 025DH
- CLEAD1 EQU 024AH
- CLEAD2 EQU 0253H
- COLOFF EQU 025FH
- CRBLIV EQU 02B5H
- CTRAIL EQU 0258H
- DEL1 EQU 02CFH
- DEL2 EQU 02D0H
- DEL3 EQU 02D1H
- DEL4 EQU 02D2H
- DELCUS EQU 02AEH
- DELMIS EQU 02AFH
- ERAEOL EQU 026DH
- HETHBS EQU 02D5H
- HIBCUR EQU 02B4H
- HIBIV EQU 02B3H
- HITE EQU 0248H
- INISUB EQU 02A4H
- IVOFF EQU 028BH
- IVON EQU 0284H
- LINDEL EQU 0274H
- LININS EQU 027BH
- LINOFF EQU 025EH
- MEMADR EQU 02B1H
- MEMAPV EQU 02B0H
- MEMORY EQU 035CH
- MORPAT EQU 02E0H
- OUTCHR EQU 0267H
- PBGMEM EQU 035CH
- PFIXER EQU 02B9H
- RUBFXF EQU 02B8H
- SWIN EQU 02C3H
- SWOUT EQU 02C9H
- TBASE EQU 0100H
- TRMINI EQU 0292H
- TRMUNI EQU 029BH
- IF WS226
- TRSCIF EQU 02D4H
- TRSCRS EQU 02D3H
- ENDIF
- IF WS30
- TRSCIF EQU 02D5H
- TRSCRS EQU 02D4H
- ENDIF
- UCNSTA EQU 02BAH
- UCONI EQU 02BDH
- UCONO EQU 02C0H
- UCRPOS EQU 0264H
- UNISUB EQU 02A7H
- USELST EQU 02AAH
- WID EQU 0249H
- ZAFCIN EQU 02B6H
- TERNAM EQU 0190H
- ;
- ;******************************************************************
- ;
- ORG TERNAM ; CONFIGURED TERMINAL NAME FOR SIGNON
- DB 'Osborne I (with WSMOD4 changes) '
- ; '----------.---------.---------.--'
- ; 32 CHARACTER LIMIT
- ;
- ;******************************************************************
- ;
- ; START OF DATA. SEE WORDSTAR MANUAL FOR LENGTH OF EACH
- ; FIELD AND FULL EXPLANATION.
- ;
- ;
- ORG HITE ; NUMBER OF LINES ON THE SCREEN
- DB 24
- ;
- ORG WID ; WIDTH OF TERMINAL IN CHARACTERS
- IF WIDE OR SMOOTH
- DB 128
- ENDIF
- IF (NOT WIDE) AND (NOT SMOOTH)
- DB 80
- ENDIF
- ;
- ORG CLEAD1 ; LEAD IN FOR RANDOM CURSOR ADDRESSING
- DB 2,ESCAPE,'='
- ;
- ORG CLEAD2 ; LEAD IN BETWEEN X AND Y (OR Y AND X)
- DB 0
- ;
- ORG CTRAIL ; TRAIL CHARACTERS AFTER X AND Y
- DB 0
- ;
- ORG CB4LFG ; SEND X BEFORE Y IF NON-ZERO
- DB 0
- ;
- ORG LINOFF ; ADD THIS TO Y BEFORE SENDING
- DB 20H
- ;
- ORG COLOFF ; ADD THIS TO Y BEFORE SENDING
- DB 20H
- ;
- ORG ASCUR ; SEND X AND Y IN BINARY
- DB 0
- ;
- ORG UCRPOS ; SPECIAL SUBROUTINE FOR X,Y ADDRESSING
- IF SMOOTH
- JMP WCUR
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET ; NOTHING, SINCE IT WORKS AS IS.
- ENDIF
- ;
- IF SMOOTH
- ORG OUTCHR ; SUBROUTINE ADDRESS TO OUTPUT CHARACTER
- ; ; MUST BE COMMENTED OUT IF NOT USED <<<<<
- DW IOUT ; NORMALLY COMPILED IN WORDSTAR
- ENDIF
- ;
- ORG ERAEOL ; ERASE TO END OF LINE
- DB 2,ESCAPE,54H
- ;
- ORG LINDEL ; DELETE LINE
- DB 2,ESCAPE,52H
- ;
- ORG LININS ; INSERT LINE
- DB 4,ESCAPE,45H,ESCAPE,54H
- ;
- ORG IVON ; INVERSE VIDEO, OR FORMS MODE ON
- DB 2,ESCAPE,29H
- ;
- ORG IVOFF ; INVERSE VIDEO OFF
- DB 2,ESCAPE,28H
- ;
- ORG TRMINI ; INITIALIZE TERMINAL (UP TO 8 BYTES)
- DB 8,'O C C -1'
- ;
- ORG TRMUNI ; UN-INITIALIZE TERMINAL (UP TO 8 BYTES)
- DB 8,'O C C -1'
- ;
- ORG INISUB ; INITIALIZE SUBROUTINE
- IF SMOOTH
- JMP ITERM
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET
- ENDIF
- ;
- ORG UNISUB ; DE-INITIALIZATION SUBROUTINE
- IF SMOOTH
- JMP XTERM
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET
- ENDIF
- ;
- ORG USELST ; USE LAST COLUMN ON DISPLAY
- DB 1
- ;
- ORG DELCUS ; DELAY BETWEEN CURSOR ADDRESSING
- DB 0
- ;
- ORG DELMIS ; DELAY AFTER OTHER FUNCTIONS
- DB 0
- ;
- ;
- ;
- ; The following section contains the primary code which implements
- ; smooth scrolling on the Osborne 1. Be careful when modifying this
- ; section.
- ;
- ORG MEMAPV
- IF SMOOTH
- DB 1 ;Use memory-mapped video
- ENDIF
- IF NOT SMOOTH
- DB 0
- ENDIF
- ;
- ORG MEMADR
- IF SMOOTH
- DW SCREEN ;Screen location
- ENDIF
- IF NOT SMOOTH
- DB 0,0 ;No memory address needed
- ENDIF
- ;
- ORG HIBIV
- IF HILITE
- DB 80h ;Use underline
- ENDIF
- IF NOT HILITE
- DB 00h ;No highlighting
- ENDIF
- ;
- ORG HIBCUR
- DB 80h ;cursor set on self
- ;
- ORG CRBLIV
- DB 0FFh ;blink cursor on self
- ;
- ORG ZAFCIN
- DW 0 ;Not needed for Osborne 1
- ;
- ORG RUBFXF
- DB 0 ;Not needed for Osborne 1
- ;
- ORG PFIXER
- DB 0 ;Not needed for Osborne 1
- ;
- ORG UCNSTA
- IF SMOOTH
- BIOS06: JMP 06h ;*******;get console status from BIOS
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET
- ENDIF
- ;
- ORG UCONI
- IF SMOOTH
- BIOS09: JMP 09h ;*******;get a character and return
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET
- ENDIF
- ;
- ORG UCONO
- IF SMOOTH
- JMP OUTCON ;send console output
- ENDIF
- IF NOT SMOOTH
- NOP
- NOP
- RET
- ENDIF
- ;
- ORG SWIN ;special before video routine
- NOP
- NOP
- RET
- NOP
- NOP
- NOP
- ;
- ORG SWOUT ;special after video routine
- NOP
- NOP
- RET
- NOP
- NOP
- NOP
- ;
- ORG DEL1
- DB 3 ;short delay
- ;
- ORG DEL2
- DB 9 ;medium-short delay
- ;
- ORG DEL3
- DB 25 ;medium-long delay
- ;
- ORG DEL4
- DB 64 ;long delay
- ;
- ; --------------------------------------------------
- ;
- ; SPECIAL ROUTINES FOR OSBORNE I
- ; Not part of MicroPro patch items
- ;
- IF SMOOTH
-
- ORG MORPAT ;origin of special patch area
- ;
- ; Initialization of terminal routine
- ;
- ITERM
- ;
- ; --------------- W A R N I N G ---------------------------------------
- ;
- ; The following instructions modify skeleton CALL/load target addresses
- ; in order to adapt to virtually any Osborne I BIOS start page. Along
- ; with this run-time convenience comes the potential for damaging the
- ; harmony between this section of code and those it modifies. As a
- ; result, please be careful out there if you change or add to the BIOS
- ; access routines.
- ;
- LDA 02h ;get BIOS starting page
- STA BIOS06+2 ;update console status routine jump
- STA BIOS09+2 ;update console input routine call
- STA BIOS0C+2 ;update console output routine call
- STA SCROL1+2 ;update address of smooth scroll flag
- STA SCROL2+2 ;ditto
- ; ---------------------------------------------------------------------
- MVI A,26 ;clear screen code in A
- CALL UCONO ;send it
- SCROL1: LXI D,AHSENB;*******;get address of scroll flag in BIOS
- LDAX D ;get old scroll flag
- STA SCROLSV ;save it for resurrection at exit
- MVI A,00h ;get new (scroll off) flag
- STAX D ;and set it in BIOS
- RET ;done
-
- SCROLSV DB 0 ;save for AHSENB
-
- ;
- ; Finalization of terminal routine
- ;
- XTERM
- LDA SCROLSV ;retrieve scroll flag
- SCROL2: LXI D,AHSENB;*******;get address of scroll flag in BIOS
- STAX D ;replace flag in BIOS
- RET ;just get out
- ;
- ; Output to console routine
- ;
- OUTCON
- MOV C,A ;get it in C where CP/M can use it
- BIOS0C: JMP 0Ch ;*******;send it and return directly
- ;
- ; Position cursor by brute force in BMRAM
- ;
- WCUR
- LHLD MEMADR ;put screen start in HL register
- DAD D ;add position of cursor in DE to HL
- SHLD CURSOR ;save new cursor position
- RET
- ;
- ;---------------------------------------------------
- ;
- ; (the following 3 lines are here only for easier use should the
- ; size of the mods ever get higher than allowed in MORPAT)
- ;
- ; ORG PBGMEM ;start of free memory
- ; DW LEN+MEM ;update free memory pointer
- ; ORG MEM ;point to free memory
- ;
- ;
- ; Special automatic scrolling routines
- ;
- SPEC1
- PUSH H ;save HL pair (needed for 1.4)
- DB 0D9H ;z80 EXX instruction
- XRA A ;reset bias
- JMP TAG2 ;and go output a character
- SPEC2
- PUSH H ;save HL pair (needed for 1.4)
- DB 0D9H ;z80 EXX instruction
- LDA WSCOL ;get WordStar column
- SUI SCRWID-10 ;see if past width-10
- JNC TAG1 ;if past width-10
- XRA A ;reset to far left
- TAG1
- CPI 128-SCRWID ;if way before right edge
- JC TAG2 ;use derived position
- MVI A,128-SCRWID ;otherwise, only rightmost SCRWID cols
- TAG2
- ADI ' ' ;position bias
- STA TAGX ;save x position (column)
- LXI H,TAGS ;get address of positioning string
- CALL OSTR ;output screen positioning
- DB 0D9H ;z80 EXX instruction
- POP H ;restore HL pair (needed for 1.4)
- JMP SCRRET ;back to WordStar
- TAGS
- DB ESCAPE,'S' ;screen positioning leadin
- DB ' ' ;y position
- TAGX
- DB ' ' ;x position
- DB 0 ;end of sequence
- OSTR
- MOV A,M ;get next byte of string
- ORA A ;if EOS character (zero)
- RZ ;all done, return
- INX H ;increment string pointer
- PUSH H ;save pointer around output
- CALL OUTCON ;output a byte
- POP H ;restore string pointer
- JMP OSTR ;do it till done
-
- LEN EQU $-SPEC1 ;length of special scroll code
-
- ; Update WordStar internal character get routines to use ours
-
- ORG CMDADDR ;input prompt/command response in WordStar
- CALL SPEC1
-
- ORG DATADDR ;input data character
- JMP SPEC2
-
- ENDIF
-
- END
-