From f185ac1e39abd281ebeafe31b32f5d98fbb721a9 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 11 May 2018 15:44:28 +0100 Subject: [PATCH] vt: add cursor hiding support --- Kernel/include/vt.h | 2 ++ Kernel/platform-amstradnc/nc100.s | 2 ++ Kernel/platform-coco3/video.c | 4 ++++ Kernel/platform-dragon-nx32/video.s | 2 ++ Kernel/platform-msx1/vdp.s | 2 ++ Kernel/platform-msx2/vdp.c | 4 ++++ Kernel/platform-mtx/vdp.s | 2 ++ Kernel/platform-pcw8256/pcw8256.s | 2 ++ Kernel/platform-trs80/devtty.c | 6 ++++-- Kernel/platform-ubee/ubee.s | 10 ++++++++++ Kernel/platform-v65c816/v65.s | 2 ++ Kernel/vt.c | 24 +++++++++++++++++++++--- 12 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Kernel/include/vt.h b/Kernel/include/vt.h index ee8154ec..eb445beb 100644 --- a/Kernel/include/vt.h +++ b/Kernel/include/vt.h @@ -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); diff --git a/Kernel/platform-amstradnc/nc100.s b/Kernel/platform-amstradnc/nc100.s index f4057678..ca5a2c04 100644 --- a/Kernel/platform-amstradnc/nc100.s +++ b/Kernel/platform-amstradnc/nc100.s @@ -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 ; diff --git a/Kernel/platform-coco3/video.c b/Kernel/platform-coco3/video.c index fe4f0297..da391a60 100644 --- a/Kernel/platform-coco3/video.c +++ b/Kernel/platform-coco3/video.c @@ -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); diff --git a/Kernel/platform-dragon-nx32/video.s b/Kernel/platform-dragon-nx32/video.s index bc55a003..0ab694f2 100644 --- a/Kernel/platform-dragon-nx32/video.s +++ b/Kernel/platform-dragon-nx32/video.s @@ -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 ; diff --git a/Kernel/platform-msx1/vdp.s b/Kernel/platform-msx1/vdp.s index 1d9fbb6d..409eca0b 100644 --- a/Kernel/platform-msx1/vdp.s +++ b/Kernel/platform-msx1/vdp.s @@ -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 diff --git a/Kernel/platform-msx2/vdp.c b/Kernel/platform-msx2/vdp.c index 124955a7..327b7f21 100644 --- a/Kernel/platform-msx2/vdp.c +++ b/Kernel/platform-msx2/vdp.c @@ -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; diff --git a/Kernel/platform-mtx/vdp.s b/Kernel/platform-mtx/vdp.s index 7245d886..59d7a140 100644 --- a/Kernel/platform-mtx/vdp.s +++ b/Kernel/platform-mtx/vdp.s @@ -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: diff --git a/Kernel/platform-pcw8256/pcw8256.s b/Kernel/platform-pcw8256/pcw8256.s index 6eb91791..1742cf72 100644 --- a/Kernel/platform-pcw8256/pcw8256.s +++ b/Kernel/platform-pcw8256/pcw8256.s @@ -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 diff --git a/Kernel/platform-trs80/devtty.c b/Kernel/platform-trs80/devtty.c index 5095297c..018a092f 100644 --- a/Kernel/platform-trs80/devtty.c +++ b/Kernel/platform-trs80/devtty.c @@ -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); diff --git a/Kernel/platform-ubee/ubee.s b/Kernel/platform-ubee/ubee.s index 1e29286c..dac959fc 100644 --- a/Kernel/platform-ubee/ubee.s +++ b/Kernel/platform-ubee/ubee.s @@ -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 diff --git a/Kernel/platform-v65c816/v65.s b/Kernel/platform-v65c816/v65.s index 5fc23c17..cd7cf802 100644 --- a/Kernel/platform-v65c816/v65.s +++ b/Kernel/platform-v65c816/v65.s @@ -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 diff --git a/Kernel/vt.c b/Kernel/vt.c index d9c69167..cbfa7ca9 100644 --- a/Kernel/vt.c +++ b/Kernel/vt.c @@ -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); -- 2.34.1