vt: add cursor hiding support
authorAlan Cox <alan@linux.intel.com>
Fri, 11 May 2018 14:44:28 +0000 (15:44 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 11 May 2018 14:44:28 +0000 (15:44 +0100)
12 files changed:
Kernel/include/vt.h
Kernel/platform-amstradnc/nc100.s
Kernel/platform-coco3/video.c
Kernel/platform-dragon-nx32/video.s
Kernel/platform-msx1/vdp.s
Kernel/platform-msx2/vdp.c
Kernel/platform-mtx/vdp.s
Kernel/platform-pcw8256/pcw8256.s
Kernel/platform-trs80/devtty.c
Kernel/platform-ubee/ubee.s
Kernel/platform-v65c816/v65.s
Kernel/vt.c

index ee8154e..eb445be 100644 (file)
@@ -31,6 +31,7 @@ struct vt_switch {
   signed char cursorx;
   signed char cursory;
   signed char ncursory;
+  uint8_t cursorhide;
 };
 
 struct vt_repeat {
@@ -49,6 +50,7 @@ void clear_lines(int8_t y, int8_t ct);
 void clear_across(int8_t y, int8_t x, int16_t l);
 void cursor_off(void);
 void cursor_on(int8_t y, int8_t x);
+void cursor_disable(void);
 void scroll_up(void);
 void scroll_down(void);
 void plot_char(int8_t y, int8_t x, uint16_t c);
index f405767..ca5a2c0 100644 (file)
@@ -26,6 +26,7 @@
            .globl _clear_across
            .globl _cursor_on
            .globl _cursor_off
+           .globl _cursor_disable
            .globl _cursorpos
            ; need the font
            .globl _font4x6
@@ -469,6 +470,7 @@ vtdone:         pop af
            ret po
            ei
 _vtattr_notify:
+_cursor_disable:
            ret
 
 ;
index fe4f029..da391a6 100644 (file)
@@ -51,6 +51,10 @@ void cursor_on(int8_t y, int8_t x)
        map_for_kernel();
 }
 
+void cursor_disable(void)
+{
+}
+
 void plot_char(int8_t y, int8_t x, uint16_t c)
 {
        unsigned char *p=char_addr(y,x);
index bc55a00..0ab694f 100644 (file)
@@ -9,6 +9,7 @@
        .globl _clear_lines
        .globl _cursor_on
        .globl _cursor_off
+       .globl _cursor_disable
        .globl _vtattr_notify
 
        .globl _video_read
@@ -334,6 +335,7 @@ _cursor_off:
        com 192,x
        com 224,x
 nocursor:
+_cursor_disable:
 _vtattr_notify:
        rts
 ;
index 1d9fbb6..409eca0 100644 (file)
@@ -14,6 +14,7 @@
            .globl _scroll_up
            .globl _scroll_down
            .globl _plot_char
+           .globl _cursor_disable
 
 ;
 ; VDP routines are directly hooked into the vt layer
@@ -30,4 +31,5 @@ VDP_DIRECT    .equ    1
 platform_interrupt_all:
            ld c, #0x99
            in a, (c)
+_cursor_disable:
            ret
index 124955a..327b7f2 100644 (file)
@@ -75,6 +75,10 @@ void cursor_on(int8_t y, int8_t x)
     cur_blink_addr = blink_addr;
 }
 
+void cursor_disable(void)
+{
+}
+
 void memcpy_vram(uint16_t dst, uint16_t src, uint16_t size)
 {
     uint16_t i;
index 7245d88..59d7a14 100644 (file)
@@ -12,6 +12,7 @@
            .globl _clear_lines
            .globl _cursor_off
            .globl _cursor_on
+           .globl _cursor_disable
            .globl _plot_char
            .globl vdpload
 
@@ -105,6 +106,7 @@ _cursor_on:  ld a, (_curtty)
 _cursor_off: ld a, (_curtty)
             or a
             jp nz, cursor_off          ; VDP
+_cursor_disable:
             ret
 
 _clear_across:
index 6eb9179..1742cf7 100644 (file)
@@ -29,6 +29,7 @@
            .globl _scroll_down
            .globl _cursor_on
            .globl _cursor_off
+           .globl _cursor_disable
            .globl _plot_char
            .globl _do_beep
            .globl _clear_lines
@@ -416,6 +417,7 @@ _cursor_off:
            ld de, (cursorpos)
            jr cursordo
 
+_cursor_disable:
 _do_beep:
            ret
 
index 5095297..018a092 100644 (file)
@@ -88,7 +88,8 @@ void vtexchange(void)
                 ret
         __endasm;
         /* Cursor back */
-        cursor_on(ttysave[inputtty].cursory, ttysave[inputtty].cursorx);
+        if (!ttysave[inputtty].cursorhide)
+            cursor_on(ttysave[inputtty].cursory, ttysave[inputtty].cursorx);
 }
 
 void tty_putc(uint8_t minor, unsigned char c)
@@ -107,7 +108,8 @@ void tty_putc(uint8_t minor, unsigned char c)
             curtty = minor - 1;
             vt_load(&ttysave[curtty]);
             /* Fix up the cursor */
-            cursor_on(ttysave[curtty].cursory, ttysave[curtty].cursorx);
+            if (!ttysave[curtty].cursorhide)
+                cursor_on(ttysave[curtty].cursory, ttysave[curtty].cursorx);
        }
        vtoutput(&c, 1);
        irqrestore(irq);
index 1e29286..dac959f 100644 (file)
@@ -566,6 +566,7 @@ scanner_done:
            .area _VIDEO
 
            .globl _cursor_off
+           .globl _cursor_disable
            .globl _do_cursor_on
            .globl _scroll_up
            .globl _scroll_down
@@ -585,6 +586,15 @@ scanner_done:
 ;
 _cursor_off:
            ret
+_cursor_disable:
+           call ___hard_di
+           push af
+           ld bc,#0x0e0c       ; Address register
+           out (c),b
+           ld bc,#0x000d       ; Set to 0 will hide cursor nicely
+                               ; as the 6545 sees video RAM as 0x2000+
+           out (c),b
+           jr popout
 _do_cursor_on:
            ; ld a,i handling is buggy on NMOS Z80
            call ___hard_di
index 5fc23c1..cd7cf80 100644 (file)
@@ -233,6 +233,7 @@ hd_wpatch:
        .export _scroll_down
        .export _do_clear_bytes
        .export _cursor_off
+       .export _cursor_disable
        .export _do_cursor_on
 
 _charprint:
@@ -395,6 +396,7 @@ cursormod:
        plb
        sep #$10
        .i8
+_cursor_disable:
        rts
 
        .data
index d9c6916..cbfa7ca 100644 (file)
@@ -80,6 +80,7 @@ uint8_t vtpaper;
 static signed char cursorx;
 static signed char cursory = VT_INITIAL_LINE;
 static signed char ncursory;
+static uint8_t cursorhide;
 static uint8_t vtpend;
 static uint8_t vtbusy;
 
@@ -186,6 +187,15 @@ static int escout(unsigned char c)
                clear_across(cursory, cursorx, VT_RIGHT - cursorx + 1);
                return 0;
        }
+       if (c == '_') {
+               cursorhide = 0;
+               return 0;
+       }
+       if (c == ' ') {
+               cursorhide = 1;
+               cursor_disable();
+               return 0;
+       }
        if (c == 'Y')
                return 2;
        if (c == 'a')
@@ -220,7 +230,8 @@ void vtoutput(unsigned char *p, unsigned int len)
        }
        vtbusy = 1;
        irqrestore(irq);
-       cursor_off();
+       if (!cursorhide)
+               cursor_off();
        /* FIXME: do we ever get called with len > 1, if not we could strip
           this right down */
        do {
@@ -270,8 +281,8 @@ void vtoutput(unsigned char *p, unsigned int len)
                len = 1;
                /* Until we don't get interrupted */
        } while(cq);
-
-       cursor_on(cursory, cursorx);
+       if (!cursorhide)
+               cursor_on(cursory, cursorx);
        vtbusy = 0;
 }
 
@@ -357,6 +368,7 @@ void vt_save(struct vt_switch *vt)
        vt->cursorx = cursorx;
        vt->cursory = cursory;
        vt->ncursory = ncursory;
+       vt->cursorhide = cursorhide;
 }
 
 void vt_load(struct vt_switch *vt)
@@ -366,6 +378,7 @@ void vt_load(struct vt_switch *vt)
        cursorx = vt->cursorx;
        cursory = vt->cursory;
        ncursory = vt->ncursory;
+       cursorhide = vt->cursorhide;
        vtattr_notify();
 }
 #endif
@@ -388,6 +401,11 @@ void cursor_off(void)
                *cpos = csave;
 }
 
+/* Only needed for hardware cursors */
+void cursor_disable(void)
+{
+}
+
 void cursor_on(int8_t y, int8_t x)
 {
        cpos = char_addr(y, x);