changeset 2966:e84a638d1c16

cohr: Support both COVDG control codes and COHR Esc codes $0B is the only control character that is used by both protocols. I decided to keep the the COVDG command as this protocol is more common. So far I've been able to find only 3 OS9 applications that are using the CoHR drivers, all by Dragon Data: Stylograph, Dynacalc and RMS. Only RMS seems to use the $0B (Home) control code, but it is easy to patch the RMS.trm file to replace $0B with the $01 CoVDG Home command. So this seems like a reasonable sacrifice.
author Ken H. <dragon.atv@gmail.com>
date Mon, 10 Feb 2014 10:10:40 +0200
parents 9edca3e61b66
children 1c81c87c77d4
files level1/modules/cohr.asm level1/modules/vtio.asm
diffstat 2 files changed, 66 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/cohr.asm	Mon Feb 10 01:36:20 2014 +0100
+++ b/level1/modules/cohr.asm	Mon Feb 10 10:10:40 2014 +0200
@@ -96,6 +96,8 @@
 InitSaveExit                 
          stb   V.COLoad,u
          clrb            
+         lda   #$FF
+         sta   V.CColr,u  * Flag Cursor as not hidden
                          
 InitExit                 
          puls  pc,u,a    
@@ -521,10 +523,13 @@
          bne   L0380     
          puls  pc,b      
                          
+DelLine
+         clrb
+         stb   V.51XPos,u
+         lbsr  DoDisplayCursor
 *
 * $1b42 - clear to end of line
 *
-                         
 DoClrEOL                 
          inc   V.51CursorChanged,u
          bsr   L03BA     
@@ -599,6 +604,42 @@
          clr   V.51XPos,u
          clr   V.51YPos,u
          lbsr  DoDisplayCursor
+         lbra  L02A6
+
+*
+* $05 XX - set cursor off/on/color per XX-32 from COVDG (only on/off supported)
+*
+SetCrsr  ldb   #$01		need additional byte
+         leax  <CrsrSw,pcr	
+         bra   L01E5V
+CrsrSw   lda   <V.NChr2,u 	get next char
+         suba  #C$SPAC		take out ASCII space
+         bne   L01BBV		branch if not zero - show cursor
+         clr   V.CColr,u
+         lbra  CancelEscSequence
+L01BBV
+         ldb   #$FF
+         stb   V.CColr,u
+         lbra  CancelEscSequence
+
+*
+* $02 XX YY - move cursor to col XX-32, row YY-32 from COVDG
+*
+CurXY    ldb   #$02		we want to claim next two chars
+         leax  <DoCurXY,pcr	point to processing routine
+L01E5V   stx   <V.RTAdd,u	store routine to return to
+         stb   <V.NGChr,u	get two more chars
+         clrb
+         rts
+
+DoCurXY  lbsr  DoEraseCursor	hide cursor
+         ldb   <V.NChr2,u 	get ASCII Y-pos
+         subb  #C$SPAC		take out ASCII space
+         stb   V.51YPos,u
+         ldb   <V.NChar,u 	get X-pos
+         subb  #C$SPAC		take out ASCII space
+         stb   V.51XPos,u
+         lbsr  DoDisplayCursor
          lbra  L02A6     
                          
 *
@@ -704,6 +745,8 @@
 * Display Cursor.
 *
 DoDisplayCursor                 
+         tst   V.CColr,u
+         beq   NoCrsr
          inc   V.NoFlash,u * Flag in flash
          tst   V.51CursorOn,u * Get cursor on flag
          bne   DoCursorOnEnd * Yes : don't re-display
@@ -711,7 +754,7 @@
          inc   V.51CursorOn,u * Flag cursor on
 DoCursorOnEnd                 
          dec   V.NoFlash,u * Flag flash done
-         rts             
+NoCrsr   rts
 *
 * Erase cursor
 *
@@ -767,10 +810,24 @@
                          
 * control characters dispatch table
 CtrlCharDispatch                 
+         fcb   $01
+         fdb   DoHome-CtrlCharDispatch		* COVDG CurHome
+         fcb   $02
+         fdb   CurXY-CtrlCharDispatch		* COVDG CURSOR XY
+         fcb   $03
+         fdb   DelLine-CtrlCharDispatch		* COVDG ERASE LINE
+         fcb   $04
+         fdb   DoClrEOL-CtrlCharDispatch	* COVDG ErEOLine
+         fcb   $05
+         fdb   SetCrsr-CtrlCharDispatch		* COVDG CURSOR ON/OFF
+         fcb   $06
+         fdb   DoCursorRight-CtrlCharDispatch	* COVDG CurRght
          fcb   $07        BEL 		* (beep)
          fdb   DoBell-CtrlCharDispatch $FC0B
          fcb   $08        BS 		* (left arrow)
          fdb   DoBackspace-CtrlCharDispatch * $FC23
+         fcb   $09
+         fdb   DoCursorUp-CtrlCharDispatch	* COVDG CurUp
          fcb   $0A        LF 		* (down arrow)
          fdb   DoLineFeed-CtrlCharDispatch * $FC3E
          fcb   $0D        CR 		* (return)
@@ -778,7 +835,9 @@
          fcb   $0C        FF 		* (clear screen)
          fdb   DoCLS-CtrlCharDispatch $FC55
          fcb   $0B        * (cursor home)
-         fdb   DoHome-CtrlCharDispatch $FDC2
+* Since few applications use CoHR $0B, support COVDG $0B instead
+*        fdb   DoHome-CtrlCharDispatch $FDC2    * Was CoHR DoHome
+         fdb   DoClearEOS-CtrlCharDispatch	* COVDG ErEOScrn
          fcb   $00       
                          
 * escape sequences dispatch table
--- a/level1/modules/vtio.asm	Mon Feb 10 01:36:20 2014 +0100
+++ b/level1/modules/vtio.asm	Mon Feb 10 10:10:40 2014 +0200
@@ -603,8 +603,12 @@
 Write    ldb   <V.NGChr,u are we in the process of getting parameters?
          bne   PrmHandl   yes, go process
          sta   <V.WrChr,u save character to write
+         ldb   V.51EscSeq,u     * in Escape sequence?
+         bne   GoCo             * yes, send to COHR
          cmpa  #C$SPAC    space or higher?
          bcc   GoCo       yes, normal write
+         cmpa  #$1B             * COHR Escape Code?
+         beq   GoCo
          cmpa  #$1E       escape sequence $1E or $1F?
          bcc   Escape     yes, go process
          cmpa  #$0F       GFX codes?