1010
1111#include "../common/acs_defs.h"
1212#include "../common/pdccolor.h"
13+ #include "../common/blink.c"
1314
1415#ifdef __DJGPP__
1516#include <go32.h>
@@ -41,15 +42,6 @@ static void _video_read(void *data, unsigned long addr, size_t size);
4142static void _video_write (unsigned long addr , const void * data , size_t size );
4243static unsigned _set_window (unsigned window , unsigned long addr );
4344
44- /* position hardware cursor at (y, x) */
45-
46- void PDC_gotoyx (int row , int col )
47- {
48- if (PDC_state .cursor_visible )
49- PDC_private_cursor_off ();
50- PDC_private_cursor_on (row , col );
51- }
52-
5345/* Draw a run of characters with the same colors */
5446/* Used with 4 bit pixels only */
5547
@@ -76,6 +68,21 @@ static void _new_packet(unsigned long colors, int lineno, int x, int len, const
7668
7769 /* Which plane we're writing */
7870 unsigned plane ;
71+ unsigned cursor_line = PDC_state .font_height ;
72+
73+ if ( 1 == SP -> drawing_cursor ) /* cursor is bottom quarter of glyph */
74+ cursor_line -= cursor_line / 4 ;
75+ else if ( 2 == SP -> drawing_cursor ) /* cursor is full block */
76+ cursor_line = 0 ;
77+ else if ( 5 == SP -> drawing_cursor ) /* cursor is bottom half of glyph */
78+ cursor_line /= 2 ;
79+
80+ if ( (* srcp & A_BLINK ) && SP -> blink_state && (SP -> termattrs & A_BLINK ))
81+ {
82+ fore ^= back ;
83+ back ^= fore ;
84+ fore ^= back ;
85+ }
7986
8087 /* Compute these just once */
8188 for (i = 0 ; i < len ; ++ i )
@@ -125,6 +132,8 @@ static void _new_packet(unsigned long colors, int lineno, int x, int len, const
125132 unsigned num_bytes = 0 ;
126133 int col ;
127134
135+ if ( line == cursor_line )
136+ invert ^= 0xff ;
128137 /* Loop once per column */
129138 cp = addr ;
130139 for (col = 0 ; col < len ; ++ col )
@@ -378,7 +387,7 @@ we need to swap bits 0-7 with those in 16-23. */
378387
379388/* PDC_transform_line for 8, 15, 16, 24 and 32 bit pixels */
380389
381- static void _transform_line_8 (int lineno , int x , int len , const chtype * srcp )
390+ static void _transform_line_8 ( const int lineno , const int x , const int len , const chtype * srcp )
382391{
383392 unsigned char bytes [1024 ];
384393 unsigned long addr = _address_8 (lineno , x );
@@ -399,7 +408,14 @@ static void _transform_line_8(int lineno, int x, int len, const chtype *srcp)
399408 unsigned char r_mask = 0x80 >> ((PDC_state .font_width - 1 ) % 8 );
400409
401410 int col ;
402- unsigned line ;
411+ unsigned line , cursor_line = PDC_state .font_height ;
412+
413+ if ( 1 == SP -> drawing_cursor ) /* cursor is bottom quarter of glyph */
414+ cursor_line -= cursor_line / 4 ;
415+ else if ( 2 == SP -> drawing_cursor ) /* cursor is full block */
416+ cursor_line = 0 ;
417+ else if ( 5 == SP -> drawing_cursor ) /* cursor is bottom half of glyph */
418+ cursor_line /= 2 ;
403419
404420 /* Compute basic glyph data only once per character */
405421 for (col = 0 ; col < len ; col ++ )
@@ -472,10 +488,7 @@ static void _transform_line_8(int lineno, int x, int len, const chtype *srcp)
472488 byte |= r_mask ;
473489 if (line == PDC_state .underline )
474490 byte |= glyphs [col ].ul_mask ;
475- if (PDC_state .cursor_visible
476- && lineno == PDC_state .cursor_row
477- && col + x == PDC_state .cursor_col
478- && PDC_state .cursor_start <= line && line <= PDC_state .cursor_end )
491+ if ( line > cursor_line )
479492 byte ^= 0xFF ;
480493
481494 /* Number of pixels to render on this pass */
@@ -544,7 +557,7 @@ static unsigned long _get_colors(chtype glyph)
544557
545558 if ((attr & A_BOLD ) != 0 && fore < 16 )
546559 fore |= 8 ;
547- if ((attr & A_BLINK ) != 0 && back < 16 )
560+ if ((attr & A_BLINK ) != 0 && back < 16 && !( SP -> termattrs & A_BLINK ) )
548561 back |= 8 ;
549562
550563 if (attr & A_REVERSE )
@@ -558,41 +571,6 @@ static unsigned long _get_colors(chtype glyph)
558571 return ((unsigned long )back << 16 ) | fore ;
559572}
560573
561- void PDC_private_cursor_off (void )
562- {
563- /* This gets called before atrtab is set up; avoid a null dereference */
564- if (!SP || !SP -> pairs )
565- return ;
566-
567- PDC_state .cursor_visible = FALSE;
568- if (PDC_state .cursor_row < LINES
569- && PDC_state .cursor_col < COLS )
570- {
571- static const chtype space = ' ' ;
572-
573- PDC_transform_line (PDC_state .cursor_row , PDC_state .cursor_col , 1 ,
574- (curscr && curscr -> _y )
575- ? & curscr -> _y [PDC_state .cursor_row ][PDC_state .cursor_col ]
576- : & space );
577- }
578- }
579-
580- void PDC_private_cursor_on (int row , int col )
581- {
582- PDC_state .cursor_visible = TRUE;
583- PDC_state .cursor_row = row ;
584- PDC_state .cursor_col = col ;
585- if (row < LINES && col < COLS )
586- {
587- static const chtype space = ' ' ;
588-
589- PDC_transform_line (PDC_state .cursor_row , PDC_state .cursor_col , 1 ,
590- (curscr && curscr -> _y )
591- ? & curscr -> _y [PDC_state .cursor_row ][PDC_state .cursor_col ]
592- : & space );
593- }
594- }
595-
596574static unsigned long _address_4 (int row , int col )
597575{
598576 return (unsigned long )row * PDC_state .bytes_per_line * PDC_state .font_height + col ;
0 commit comments