From: Alan Cox Date: Wed, 10 Jun 2015 22:24:05 +0000 (+0100) Subject: dragon-nx32: add attribute support X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0e6421b747d7815790bdc6b4df71dce6db5d1384;p=FUZIX.git dragon-nx32: add attribute support Useful as an example hopefully. Everything supported except flash, which isn't in the hardware in a practical manner. --- diff --git a/Kernel/platform-dragon-nx32/devtty.c b/Kernel/platform-dragon-nx32/devtty.c index 92d0205f..e7479e2b 100644 --- a/Kernel/platform-dragon-nx32/devtty.c +++ b/Kernel/platform-dragon-nx32/devtty.c @@ -25,6 +25,9 @@ struct s_queue ttyinq[NUM_DEV_TTY + 1] = { /* ttyinq[0] is never used */ {tbuf2, tbuf2, tbuf2, TTYSIZ, 0, TTYSIZ / 2} }; +uint8_t vtattr_cap = VTA_INVERSE|VTA_UNDERLINE|VTA_ITALIC|VTA_BOLD| + VTA_OVERSTRIKE|VTA_NOCURSOR; + /* tty1 is the screen tty2 is the serial port */ /* Output for the system console (kprintf etc) */ diff --git a/Kernel/platform-dragon-nx32/video.s b/Kernel/platform-dragon-nx32/video.s index 5791a6b0..a4b8646c 100644 --- a/Kernel/platform-dragon-nx32/video.s +++ b/Kernel/platform-dragon-nx32/video.s @@ -13,6 +13,7 @@ ; Imports ; .globl _fontdata_8x8 + .globl _vidattr include "kernel.def" include "../kernel09.def" @@ -60,6 +61,74 @@ _plot_char: rola tfr d,x leax _fontdata_8x8,x ; relative to font + ldb _vtattr + andb #0x3F ; drop the bits that don't affect our video + beq plot_fast + + ; + ; General purpose plot with attributes, we only fastpath + ; the simple case + ; + clra +plot_loop: + sta _vtrow + ldb _vtattr + cmpa #7 ; Underline only applies on the bottom row + beq ul_this + andb #0xFD +ul_this: + cmpa #3 ; italic shift right for < 3 + blt ital_1 + andb #0xFB + bra maskdone +ital_1: + cmpa #5 ; italic shift right for >= 5 + blt maskdone + bitb #0x04 + bne maskdone + orb #0x40 ; spare bit borrow for bottom of italic + andb #0xFB +maskdone: + lda ,x+ ; now throw the row away for a bit + bitb #0x10 + bne notbold + lsra + ora -1,x ; shift and or to make it bold +notbold: + bitb #0x04 ; italic by shifting top and bottom + beq notital1 + lsra +notital1: + bitb #0x40 + beq notital2 + lsla +notital2: + bitb #0x02 + beq notuline + lda #0xff ; underline by setting bottom row +notuline: + bitb #0x01 ; inverse or not: we are really in inverse + bne plot_inv ; by default so we complement except if + coma ; inverted +plot_inv: + bitb #0x20 ; overstrike or plot ? + bne overstrike + sta ,y + bra plotnext +overstrike: + anda ,y + sta ,y +plotnext: + leay 32,y + lda _vtrow + inca + cmpa #8 + bne plot_loop + puls y,pc +; +; Fast path for normal attributes +; +plot_fast: lda ,x+ ; simple 8x8 renderer for now coma sta 0,y @@ -246,6 +315,9 @@ _cursor_on: stx cursor_save ; Fall through _cursor_off: + ldb _vtattr + bitb #0x80 + bne nocursor ldx cursor_save com ,x com 32,x @@ -255,8 +327,11 @@ _cursor_off: com 160,x com 192,x com 224,x +nocursor: rts .area .data cursor_save: .dw 0 +_vtrow: + .db 0 \ No newline at end of file