aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2026-09-05 01:05:36 +0200
committerJavier <dev.git@javispedro.com>2026-09-05 01:05:36 +0200
commit51d19f9e8b844c1ba4ebd044ee4307ec0d8078c3 (patch)
tree762bac22953722e8c3f5190ab045eacf722f42af
parenta8a4256bca568f328d7d19ed0ed6456df582d1e6 (diff)
downloadvbados-51d19f9e8b844c1ba4ebd044ee4307ec0d8078c3.tar.gz
vbados-51d19f9e8b844c1ba4ebd044ee4307ec0d8078c3.zip
moustest: allow changing speed/sensitivityHEADmaster
-rw-r--r--int33.h2
-rw-r--r--moustest.c71
2 files changed, 71 insertions, 2 deletions
diff --git a/int33.h b/int33.h
index b36b8f4..df870be 100644
--- a/int33.h
+++ b/int33.h
@@ -319,7 +319,7 @@ static void int33_get_sensitivity(uint16_t *sens_x, uint16_t *sens_y, uint16_t *
"pop bx" \
"mov [bx], dx" \
__parm [si] [di] [dx] \
- __modify [ax]
+ __modify [ax bx cx dx]
static uint16_t int33_get_driver_version(void);
#pragma aux int33_get_driver_version = \
diff --git a/moustest.c b/moustest.c
index cca2b63..3270c9c 100644
--- a/moustest.c
+++ b/moustest.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#include <ctype.h>
#include <dos.h>
#include <conio.h>
@@ -141,7 +142,7 @@ void gui_draw_title()
const int cols = vidconf.numtextcols;
gui_draw_textwindow(1, 1, 1, cols, GUI_COLOR_BAR);
- gui_print(GUI_COLOR_BAR, "MOUSTEST ESC to exit, 'm' mode, 'r' reset, 's' show, 'h' hide");
+ gui_print(GUI_COLOR_BAR, "MOUSTEST ESC to exit, 'm'ode, 'r'eset, 's'how, 'h'ide, s'p'eed");
}
void gui_draw_status()
@@ -302,6 +303,34 @@ void console_printf(const char *format, ...)
console_print(buffer);
}
+int console_getline(char *buffer, int maxlen)
+{
+ int bufpos = 0;
+
+ while (bufpos < maxlen) {
+ int c = getch();
+ switch (c) {
+ case 0: // Extended: consume and ignore
+ c = getch();
+ break;
+ case 27: // ESC
+ console_print("\n");
+ return -1;
+ case '\r':
+ buffer[bufpos] = '\0';
+ console_print("\n");
+ return bufpos;
+ default:
+ if (isalnum(c) || isspace(c)) {
+ buffer[bufpos++] = c;
+ console_printf("%c", c); // Echo
+ }
+ }
+ }
+
+ return bufpos;
+}
+
struct modeentry {
char *name;
int modenum;
@@ -554,6 +583,44 @@ void mouse_report()
console_printf("Number of wheels: %u\n", num_wheels);
}
+void mouse_speed()
+{
+ uint16_t speed_x, speed_y, double_speed_threshold;
+ bool update = false;
+ char buffer[16] = {'\0'};
+ int ret;
+
+ int33_get_sensitivity(&speed_x, &speed_y, &double_speed_threshold);
+
+ console_printf("X speed [default=8, current=%u] ? ", speed_x);
+ ret = console_getline(buffer, sizeof(buffer)-1);
+ if (ret > 0) {
+ speed_x = atoi(buffer);
+ update = true;
+ }
+
+ console_printf("Y speed [default=16, current=%u] ? ", speed_y);
+ ret = console_getline(buffer, sizeof(buffer)-1);
+ if (ret > 0) {
+ speed_y = atoi(buffer);
+ update = true;
+ }
+
+ console_printf("Double speed threshold [default=64, current=%u] ? ", double_speed_threshold);
+ ret = console_getline(buffer, sizeof(buffer)-1);
+ if (ret > 0) {
+ double_speed_threshold = atoi(buffer);
+ update = true;
+ }
+
+ if (update) {
+ int33_set_sensitivity(speed_x, speed_y, double_speed_threshold);
+ console_printf("Values updated: %u %u %u\n", speed_x, speed_y, double_speed_threshold);
+ } else {
+ console_printf("No values changed\n");
+ }
+}
+
void mouse_quit()
{
int33_reset();
@@ -728,6 +795,8 @@ int main(int argc, const char *argv[])
}
}
break;
+ case 'p':
+ mouse_speed();
case 'd':
mouse_debug();
break;