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 / ENTERPRS / CPM / UTILS / S / WS4MOD.ARC / WSMOD4.ASM < prev    next >
Assembly Source File  |  1993-03-30  |  12KB  |  519 lines

  1. ;    WordStar Terminal definitions and smooth
  2. ;         scroll code for the Osborne I
  3. ;
  4. ;      Portions from WordStar manual,
  5. ;            INSTALL program,
  6. ;            Portable Companion,
  7. ;            and George Peace.
  8. ;
  9. ;        future revisions:
  10. ;    (Try to) implement low intensity with memory mapped video.
  11. ;    (Try to) use arrow key definitions from BIOS
  12. ;
  13. ;        revision 4 - 3/28/83
  14. ;    Add code to set the auto horiontal scroll flag in BIOS
  15. ;    to allow operation without regard for disk setup option.
  16. ;
  17. ;        revision 3 - 3/26/83
  18. ;    Upgrade of WSMODS.ASM to include the features listed above.
  19. ;
  20. ;        revision 2 - 2/21/83
  21. ;    First field release - did not work with 1.4+ machines.
  22. ;    This release was withdrawn soon thereafter.
  23. ;
  24. ;        revision 1 - ???????
  25. ;    Internal development version - never released
  26. ;    
  27. ;-----------------------------------------------------------------------
  28. ;
  29. ;    Direct comments, additions, and corrections to:
  30. ;
  31. ;        George F Peace
  32. ;        1703 Headwaters Road
  33. ;        Midlothian, Virginia  23113
  34. ;
  35. ;        CompuServe id 71555,1501
  36. ;
  37. ;        (Please keep me up to date)
  38. ;
  39. ;
  40. ; This file is a major rework of the Thom Hogan WordStar modification
  41. ; which appeared in an early issue of the Portable Companion.  This
  42. ; file is an effort to correct the problems in the original version
  43. ; and provide a path for BIOS 1.4 and WS 3.0 upgrades.  Most notable
  44. ; is that the Osborne I BIOS level is transparent to these routines
  45. ; whereas the original routines contained hard-coded references to version
  46. ; 1.3 BIOS. The terminal initialization routine has been expanded to use
  47. ; the addresses of the installed BIOS rather than values assumed by the
  48. ; author.  Another change is that all hard-coded references to WordStar
  49. ; internal addresses have been replaced with configuration EQUates. In
  50. ; addition, I have provided code to allow user customization of several
  51. ; other WordStar terminal-related parameters.
  52. ;
  53. ;
  54. ;
  55. ;    Installation Procedure:
  56. ;
  57. ;
  58. ;    Put WS.COM, etc. on A:
  59. ;    Put ASM, DDT, and WSMOD3.ASM on B:
  60. ;
  61. ;    B:
  62. ;    ERA B:WS.COM
  63. ;    ERA B:WSMOD3.HEX
  64. ;    ASM WSMOD3.BBZ
  65. ;    DDT A:WS.COM
  66. ;    IWSMOD3.HEX
  67. ;    R
  68. ;    G0
  69. ;    SAVE 62 B:WS.COM   for WordStar level 3.0
  70. ;    SAVE 56 B:WS.COM   for WordStar level 2.26
  71. ;    B:WS    (test, then copy to A:)
  72. ;
  73. ;
  74. FALSE    EQU    0
  75. TRUE    EQU    NOT FALSE
  76. ;
  77. ESCAPE    EQU    27    ;ASCII code of <ESC>
  78. ;
  79. ;
  80. ; C O N F I G U R A T I O N   S E C T I O N
  81. ;
  82. ;
  83. SMOOTH    EQU    TRUE    ;if TRUE, smooth scrolling implemented
  84. HILITE    EQU    FALSE    ;if TRUE, underlined video selected for hilite
  85. WIDE    EQU    TRUE    ;if TRUE, wide character width set
  86. WS226    EQU    TRUE    ;if TRUE, use WS 2.26 addresses
  87. WS30    EQU    FALSE    ;if TRUE, use WS 3.0  addresses
  88. ;
  89. ;
  90. ; Osborne-specific constants
  91. ;
  92. SCRWID    EQU    52    ;number of columns displayed on CRT. For example,
  93.             ;if 80Plus is installed and you are running
  94.             ;with 80 columns displayed, set SCRWID to 80.
  95. CURSOR    EQU    0EF5Ah    ;location of cursor position in BMRAM
  96.             ;(same in 1.3 and 1.4)
  97. SCREEN    EQU    0F000h    ;location of screen in RAM
  98. AHSENB    EQU    00068h    ;offset of AHSENB in BIOS (scroll flag)
  99. ;
  100. ;
  101. ; Now for the WordStar constants
  102. ;
  103.     IF    WS226
  104. IOUT    EQU    00106h    ;location of output routine in WordStar
  105. WSCOL    EQU    0371Eh    ;location of WordStar column pointer
  106. SCRRET    EQU    01BBBh    ;address to return to from screen scroll
  107. CMDADDR    EQU    01BB4h    ;address to intercept prompt/command
  108. DATADDR    EQU    030D2h    ;address to intercept data character
  109. MEM    EQU    07400h    ;address PBGMEM points to in release
  110.     ENDIF
  111.     IF    WS30
  112. IOUT    EQU    00106h    ;location of output routine in WordStar
  113. WSCOL    EQU    03561h    ;location of WordStar column pointer
  114. SCRRET    EQU    01BEAh    ;address to return to from screen scroll
  115. CMDADDR    EQU    01BE3h    ;address to intercept prompt/command
  116. DATADDR    EQU    02ED2h    ;address to intercept data character
  117. MEM    EQU    07900h    ;address PBGMEM points to in release
  118.     ENDIF
  119. ;
  120. ;
  121. ALABEL    EQU    035EH
  122. ASCUR    EQU    0260H
  123. CB4LFG    EQU    025DH
  124. CLEAD1    EQU    024AH
  125. CLEAD2    EQU    0253H
  126. COLOFF    EQU    025FH
  127. CRBLIV    EQU    02B5H
  128. CTRAIL    EQU    0258H
  129. DEL1    EQU    02CFH
  130. DEL2    EQU    02D0H
  131. DEL3    EQU    02D1H
  132. DEL4    EQU    02D2H
  133. DELCUS    EQU    02AEH
  134. DELMIS    EQU    02AFH
  135. ERAEOL    EQU    026DH
  136. HETHBS    EQU    02D5H
  137. HIBCUR    EQU    02B4H
  138. HIBIV    EQU    02B3H
  139. HITE    EQU    0248H
  140. INISUB    EQU    02A4H
  141. IVOFF    EQU    028BH
  142. IVON    EQU    0284H
  143. LINDEL    EQU    0274H
  144. LININS    EQU    027BH
  145. LINOFF    EQU    025EH
  146. MEMADR    EQU    02B1H
  147. MEMAPV    EQU    02B0H
  148. MEMORY    EQU    035CH
  149. MORPAT    EQU    02E0H
  150. OUTCHR    EQU    0267H
  151. PBGMEM    EQU    035CH
  152. PFIXER    EQU    02B9H
  153. RUBFXF    EQU    02B8H
  154. SWIN    EQU    02C3H
  155. SWOUT    EQU    02C9H
  156. TBASE    EQU    0100H
  157. TRMINI    EQU    0292H
  158. TRMUNI    EQU    029BH
  159.     IF    WS226
  160. TRSCIF    EQU    02D4H
  161. TRSCRS    EQU    02D3H
  162.     ENDIF
  163.     IF    WS30
  164. TRSCIF    EQU    02D5H
  165. TRSCRS    EQU    02D4H
  166.     ENDIF
  167. UCNSTA    EQU    02BAH
  168. UCONI    EQU    02BDH
  169. UCONO    EQU    02C0H
  170. UCRPOS    EQU    0264H
  171. UNISUB    EQU    02A7H
  172. USELST    EQU    02AAH
  173. WID    EQU    0249H
  174. ZAFCIN    EQU    02B6H
  175. TERNAM    EQU    0190H
  176. ;
  177. ;******************************************************************
  178. ;
  179.     ORG    TERNAM  ; CONFIGURED TERMINAL NAME FOR SIGNON
  180.     DB    'Osborne I (with WSMOD4 changes)  '
  181. ;        '----------.---------.---------.--'
  182. ;         32 CHARACTER LIMIT
  183. ;
  184. ;******************************************************************
  185. ;
  186. ;    START OF DATA.  SEE WORDSTAR MANUAL FOR LENGTH OF EACH
  187. ;    FIELD AND FULL EXPLANATION.
  188. ;
  189. ;
  190.     ORG    HITE    ; NUMBER OF LINES ON THE SCREEN
  191.     DB    24
  192. ;
  193.     ORG    WID    ; WIDTH OF TERMINAL IN CHARACTERS
  194.     IF    WIDE OR SMOOTH
  195.     DB    128
  196.     ENDIF
  197.     IF    (NOT WIDE) AND (NOT SMOOTH)
  198.     DB    80
  199.     ENDIF
  200. ;
  201.     ORG    CLEAD1    ; LEAD IN FOR RANDOM CURSOR ADDRESSING
  202.     DB    2,ESCAPE,'='
  203. ;
  204.     ORG    CLEAD2    ; LEAD IN BETWEEN X AND Y (OR Y AND X)
  205.     DB    0
  206. ;
  207.     ORG    CTRAIL    ; TRAIL CHARACTERS AFTER X AND Y
  208.     DB    0
  209. ;
  210.     ORG    CB4LFG    ; SEND X BEFORE Y IF NON-ZERO
  211.     DB    0
  212. ;
  213.     ORG    LINOFF    ; ADD THIS TO Y BEFORE SENDING
  214.     DB    20H
  215. ;
  216.     ORG    COLOFF    ; ADD THIS TO Y BEFORE SENDING
  217.     DB    20H
  218. ;
  219.     ORG    ASCUR    ; SEND X AND Y IN BINARY
  220.     DB    0
  221. ;
  222.     ORG    UCRPOS    ; SPECIAL SUBROUTINE FOR X,Y ADDRESSING
  223.     IF    SMOOTH
  224.     JMP    WCUR
  225.     ENDIF
  226.     IF    NOT SMOOTH
  227.     NOP
  228.     NOP
  229.     RET        ; NOTHING, SINCE IT WORKS AS IS.
  230.     ENDIF
  231. ;
  232.     IF    SMOOTH
  233.     ORG    OUTCHR    ; SUBROUTINE ADDRESS TO OUTPUT CHARACTER
  234. ;            ; MUST BE COMMENTED OUT IF NOT USED <<<<<
  235.     DW    IOUT    ; NORMALLY COMPILED IN WORDSTAR
  236.     ENDIF
  237. ;
  238.     ORG    ERAEOL    ; ERASE TO END OF LINE
  239.     DB    2,ESCAPE,54H
  240. ;
  241.     ORG    LINDEL    ; DELETE LINE
  242.     DB    2,ESCAPE,52H
  243. ;
  244.     ORG    LININS    ; INSERT LINE
  245.     DB    4,ESCAPE,45H,ESCAPE,54H
  246. ;
  247.     ORG    IVON    ; INVERSE VIDEO, OR FORMS MODE ON
  248.     DB    2,ESCAPE,29H
  249. ;
  250.     ORG    IVOFF    ; INVERSE VIDEO OFF
  251.     DB    2,ESCAPE,28H
  252. ;
  253.     ORG    TRMINI    ; INITIALIZE TERMINAL (UP TO 8 BYTES)
  254.     DB    8,'O C C -1'
  255. ;
  256.     ORG    TRMUNI    ; UN-INITIALIZE TERMINAL (UP TO 8 BYTES)
  257.     DB    8,'O C C -1'
  258. ;
  259.     ORG    INISUB    ; INITIALIZE SUBROUTINE
  260.     IF    SMOOTH
  261.     JMP    ITERM
  262.     ENDIF
  263.     IF    NOT SMOOTH
  264.     NOP
  265.     NOP
  266.     RET
  267.     ENDIF
  268. ;
  269.     ORG    UNISUB    ; DE-INITIALIZATION SUBROUTINE
  270.     IF    SMOOTH
  271.     JMP    XTERM
  272.     ENDIF
  273.     IF    NOT SMOOTH
  274.     NOP
  275.     NOP
  276.     RET
  277.     ENDIF
  278. ;
  279.     ORG    USELST    ; USE LAST COLUMN ON DISPLAY
  280.     DB    1
  281. ;
  282.     ORG    DELCUS    ; DELAY BETWEEN CURSOR ADDRESSING
  283.     DB    0
  284. ;
  285.     ORG    DELMIS    ; DELAY AFTER OTHER FUNCTIONS
  286.     DB    0
  287. ;
  288. ;
  289. ;
  290. ; The following section contains the primary code which implements
  291. ; smooth scrolling on the Osborne 1.  Be careful when modifying this
  292. ; section.
  293. ;
  294.     ORG    MEMAPV
  295.     IF    SMOOTH
  296.     DB    1        ;Use memory-mapped video
  297.     ENDIF
  298.     IF    NOT SMOOTH
  299.     DB    0
  300.     ENDIF
  301. ;
  302.     ORG    MEMADR
  303.     IF    SMOOTH
  304.     DW    SCREEN        ;Screen location
  305.     ENDIF
  306.     IF    NOT SMOOTH
  307.     DB    0,0        ;No memory address needed
  308.     ENDIF
  309. ;
  310.     ORG    HIBIV
  311.     IF    HILITE
  312.     DB    80h        ;Use underline
  313.     ENDIF
  314.     IF    NOT HILITE
  315.     DB    00h        ;No highlighting
  316.     ENDIF
  317. ;
  318.     ORG    HIBCUR
  319.     DB    80h        ;cursor set on self
  320. ;
  321.     ORG    CRBLIV
  322.     DB    0FFh        ;blink cursor on self
  323. ;
  324.     ORG    ZAFCIN
  325.     DW    0        ;Not needed for Osborne 1
  326. ;
  327.     ORG    RUBFXF
  328.     DB    0        ;Not needed for Osborne 1
  329. ;
  330.     ORG    PFIXER
  331.     DB    0        ;Not needed for Osborne 1
  332. ;
  333.     ORG    UCNSTA
  334.     IF    SMOOTH
  335. BIOS06:    JMP    06h    ;*******;get console status from BIOS
  336.     ENDIF
  337.     IF    NOT SMOOTH
  338.     NOP
  339.     NOP
  340.     RET
  341.     ENDIF
  342. ;
  343.     ORG    UCONI
  344.     IF    SMOOTH
  345. BIOS09:    JMP    09h    ;*******;get a character and return
  346.     ENDIF
  347.     IF    NOT SMOOTH
  348.     NOP
  349.     NOP
  350.     RET
  351.     ENDIF
  352. ;
  353.     ORG    UCONO
  354.     IF    SMOOTH
  355.     JMP    OUTCON        ;send console output
  356.     ENDIF
  357.     IF    NOT SMOOTH
  358.     NOP
  359.     NOP
  360.     RET
  361.     ENDIF
  362. ;
  363.     ORG    SWIN        ;special before video routine
  364.     NOP
  365.     NOP
  366.     RET
  367.     NOP
  368.     NOP
  369.     NOP
  370. ;
  371.     ORG    SWOUT        ;special after video routine
  372.     NOP
  373.     NOP
  374.     RET
  375.     NOP
  376.     NOP
  377.     NOP
  378. ;
  379.     ORG    DEL1
  380.     DB    3        ;short delay
  381. ;
  382.     ORG    DEL2
  383.     DB    9        ;medium-short delay
  384. ;
  385.     ORG    DEL3
  386.     DB    25        ;medium-long delay
  387. ;
  388.     ORG    DEL4
  389.     DB    64        ;long delay
  390. ;
  391. ; --------------------------------------------------
  392. ;
  393. ;    SPECIAL ROUTINES FOR OSBORNE I
  394. ;    Not part of MicroPro patch items
  395. ;
  396.     IF    SMOOTH
  397.  
  398.     ORG    MORPAT        ;origin of special patch area
  399. ;
  400. ; Initialization of terminal routine
  401. ;
  402. ITERM
  403. ;
  404. ; --------------- W A R N I N G ---------------------------------------
  405. ;
  406. ; The following instructions modify skeleton CALL/load target addresses
  407. ; in order to adapt to virtually any Osborne I BIOS start page. Along
  408. ; with this run-time convenience comes the potential for damaging the
  409. ; harmony between this section of code and those it modifies. As a
  410. ; result, please be careful out there if you change or add to the BIOS
  411. ; access routines.
  412. ;
  413.     LDA    02h        ;get BIOS starting page
  414.     STA    BIOS06+2    ;update console status routine jump
  415.     STA    BIOS09+2    ;update console input routine call
  416.     STA    BIOS0C+2    ;update console output routine call
  417.     STA    SCROL1+2    ;update address of smooth scroll flag
  418.     STA    SCROL2+2    ;ditto
  419. ; ---------------------------------------------------------------------
  420.     MVI    A,26        ;clear screen code in A
  421.     CALL    UCONO        ;send it
  422. SCROL1:    LXI    D,AHSENB;*******;get address of scroll flag in BIOS
  423.     LDAX    D        ;get old scroll flag
  424.     STA    SCROLSV        ;save it for resurrection at exit
  425.     MVI    A,00h        ;get new (scroll off) flag
  426.     STAX    D        ;and set it in BIOS    
  427.     RET            ;done
  428.  
  429. SCROLSV    DB    0        ;save for AHSENB
  430.  
  431. ;
  432. ; Finalization of terminal routine
  433. ;
  434. XTERM
  435.     LDA    SCROLSV        ;retrieve scroll flag
  436. SCROL2:    LXI    D,AHSENB;*******;get address of scroll flag in BIOS
  437.     STAX    D        ;replace flag in BIOS
  438.     RET            ;just get out
  439. ;
  440. ; Output to console routine
  441. ;
  442. OUTCON
  443.     MOV    C,A        ;get it in C where CP/M can use it
  444. BIOS0C:    JMP    0Ch    ;*******;send it and return directly
  445. ;
  446. ; Position cursor by brute force in BMRAM
  447. ;
  448. WCUR
  449.     LHLD    MEMADR        ;put screen start in HL register
  450.     DAD    D        ;add position of cursor in DE to HL
  451.     SHLD    CURSOR        ;save new cursor position
  452.     RET
  453. ;
  454. ;---------------------------------------------------
  455. ;
  456. ; (the following 3 lines are here only for easier use should the
  457. ;  size of the mods ever get higher than allowed in MORPAT)
  458. ;
  459. ;    ORG    PBGMEM        ;start of free memory
  460. ;    DW    LEN+MEM        ;update free memory pointer
  461. ;    ORG    MEM        ;point to free memory
  462. ;
  463. ;
  464. ; Special automatic scrolling routines
  465. ;
  466. SPEC1
  467.     PUSH    H        ;save HL pair (needed for 1.4)
  468.     DB    0D9H        ;z80 EXX instruction
  469.     XRA    A        ;reset bias
  470.     JMP    TAG2        ;and go output a character
  471. SPEC2
  472.     PUSH    H        ;save HL pair (needed for 1.4)
  473.     DB    0D9H        ;z80 EXX instruction
  474.     LDA    WSCOL        ;get WordStar column
  475.     SUI    SCRWID-10    ;see if past width-10
  476.     JNC    TAG1        ;if past width-10
  477.     XRA    A        ;reset to far left
  478. TAG1
  479.     CPI    128-SCRWID    ;if way before right edge
  480.     JC    TAG2        ;use derived position
  481.     MVI    A,128-SCRWID    ;otherwise, only rightmost SCRWID cols
  482. TAG2
  483.     ADI    ' '        ;position bias
  484.     STA    TAGX        ;save x position (column)
  485.     LXI    H,TAGS        ;get address of positioning string
  486.     CALL    OSTR        ;output screen positioning
  487.     DB    0D9H        ;z80 EXX instruction
  488.     POP    H        ;restore HL pair (needed for 1.4)
  489.     JMP    SCRRET        ;back to WordStar
  490. TAGS
  491.     DB    ESCAPE,'S'    ;screen positioning leadin
  492.     DB    ' '        ;y position
  493. TAGX
  494.     DB    ' '        ;x position
  495.     DB    0        ;end of sequence
  496. OSTR
  497.     MOV    A,M        ;get next byte of string
  498.     ORA    A        ;if EOS character (zero)
  499.     RZ            ;all done, return
  500.     INX    H        ;increment string pointer
  501.     PUSH    H        ;save pointer around output
  502.     CALL    OUTCON        ;output a byte
  503.     POP    H        ;restore string pointer
  504.     JMP    OSTR        ;do it till done
  505.  
  506. LEN    EQU    $-SPEC1        ;length of special scroll code
  507.  
  508. ; Update WordStar internal character get routines to use ours
  509.  
  510.     ORG    CMDADDR        ;input prompt/command response in WordStar
  511.     CALL    SPEC1
  512.  
  513.     ORG    DATADDR        ;input data character
  514.     JMP    SPEC2
  515.  
  516.     ENDIF
  517.  
  518.     END
  519.