From 7ae2f1b10c1b3b6cbe6be690fa410bab1d2f607e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 22 Jan 2025 00:15:33 -0500
Subject: [PATCH] Add C64/C128 blinking... 1.5Hz Blinking text is opposite of
 the cursor

---
 src/conio/bitmap_con.c | 103 ++++++++++++++++++++++++-----------------
 1 file changed, 61 insertions(+), 42 deletions(-)

diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c
index f8276344c0..0ad00386db 100644
--- a/src/conio/bitmap_con.c
+++ b/src/conio/bitmap_con.c
@@ -981,7 +981,6 @@ static void blinker_thread(void *data)
 	struct bitmap_screen *ncscreen;
 	int lfc;
 	int blink;
-	bool prestel;
 
 	SetThreadName("Blinker");
 	while(1) {
@@ -992,52 +991,72 @@ static void blinker_thread(void *data)
 
 		assert_rwlock_wrlock(&vstatlock);
 		prestel = vstat.mode == PRESTEL_40X24;
-		if (prestel) {
-			if (next_blink < now) {
-				if (vstat.blink) {
-					vstat.blink=FALSE;
-					next_blink = now + 1000;
-				}
-				else {
-					vstat.blink=TRUE;
-					next_blink = now + 333;
-				}
-				blink_changed = 1;
-			}
-			if (next_cursor < now) {
-				curs_changed = cursor_visible_locked();
-				if (vstat.curs_blink) {
-					vstat.curs_blink=FALSE;
-				}
-				else {
-					vstat.curs_blink=TRUE;
+		switch (vstat.mode) {
+			case PRESTEL_40X24:
+				if (next_blink < now) {
+					if (vstat.blink) {
+						vstat.blink=FALSE;
+						next_blink = now + 1000;
+					}
+					else {
+						vstat.blink=TRUE;
+						next_blink = now + 333;
+					}
+					blink_changed = 1;
 				}
-				curs_changed = (curs_changed != cursor_visible_locked());
-				next_cursor = now + 320;
-			}
-		}
-		else {
-			if (next_blink < now) {
-				if (vstat.blink) {
-					vstat.blink=FALSE;
+				if (next_cursor < now) {
+					curs_changed = cursor_visible_locked();
+					if (vstat.curs_blink) {
+						vstat.curs_blink=FALSE;
+					}
+					else {
+						vstat.curs_blink=TRUE;
+					}
+					curs_changed = (curs_changed != cursor_visible_locked());
+					next_cursor = now + 320;
 				}
-				else {
-					vstat.blink=TRUE;
+				break;
+			case C64_40X25:
+			case C128_40X25:
+			case C128_80X25:
+				if (next_cursor < now) {
+					curs_changed = cursor_visible_locked();
+					if (vstat.curs_blink) {
+						vstat.curs_blink=FALSE;
+						vstat.blink=TRUE;
+					}
+					else {
+						vstat.curs_blink=TRUE;
+						vstat.blink=FALSE;
+					}
+					blink_changed = 1;
+					curs_changed = (curs_changed != cursor_visible_locked());
+					next_cursor = now + 333;
 				}
-				next_blink = now + 266;
-				blink_changed = 1;
-			}
-			if (next_cursor < now) {
-				curs_changed = cursor_visible_locked();
-				if (vstat.curs_blink) {
-					vstat.curs_blink=FALSE;
+				break;
+			default:
+				if (next_blink < now) {
+					if (vstat.blink) {
+						vstat.blink=FALSE;
+					}
+					else {
+						vstat.blink=TRUE;
+					}
+					next_blink = now + 266;
+					blink_changed = 1;
 				}
-				else {
-					vstat.curs_blink=TRUE;
+				if (next_cursor < now) {
+					curs_changed = cursor_visible_locked();
+					if (vstat.curs_blink) {
+						vstat.curs_blink=FALSE;
+					}
+					else {
+						vstat.curs_blink=TRUE;
+					}
+					curs_changed = (curs_changed != cursor_visible_locked());
+					next_cursor = now + 133;
 				}
-				curs_changed = (curs_changed != cursor_visible_locked());
-				next_cursor = now + 133;
-			}
+				break;
 		}
 		lfc = force_cursor;
 		force_cursor = 0;
-- 
GitLab