From 5fc2534453bfadb0ec0075d38980a0423137ab26 Mon Sep 17 00:00:00 2001 From: Javier Date: Sat, 10 Dec 2022 15:17:09 +0100 Subject: fix issue with borlandc, bump to 0.64 --- README.md | 4 +++- mousetsr.c | 33 +++++++++++++++++++++++++++------ mousetsr.h | 10 +++++----- version.h | 2 +- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6136653..87009ea 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The VB stands for "Very Basic" :) # Downloads -The current release is _0.63_. +The current release is _0.64_. You can get a recent build from the ready-to-go floppy disk image: [💾 VBADOS.FLP](https://depot.javispedro.com/vbox/vbados/vbados.flp) @@ -40,6 +40,8 @@ For the source code, you can check out [this git repository](..). ## Version history +* _0.64_: Reduce memory requirements of int33h driver status save/restore APIs. + This helps compatibility with Borland IDEs, which seem to allocate around 1K max. * _0.63_: Localization support using [Kitten](http://wiki.freedos.org/wiki/index.php/Kitten); currently only Spanish is available (`set lang=es`). Non-fully-uppercase but still 8.3 filenames are no longer "shortened" by default. Introduced per-mount options. diff --git a/mousetsr.c b/mousetsr.c index ff03499..8fed8cb 100644 --- a/mousetsr.c +++ b/mousetsr.c @@ -1057,6 +1057,7 @@ static void reset_mouse_state() memset(data.cursor_prev_graphic, 0, sizeof(data.cursor_prev_graphic)); } +/** Return (in the appropiate registers) the wheel movement counter and afterwards reset it. */ static void return_clear_wheel_counter(union INTPACK __far *r) { r->w.cx = snap_to_grid(data.wheel_last.x, data.screen_granularity.x); @@ -1065,6 +1066,7 @@ static void return_clear_wheel_counter(union INTPACK __far *r) data.wheel_delta = 0; } +/** Return (in the appropiate registers) the desired button press counter and afterwards reset it. */ static void return_clear_button_counter(union INTPACK __far *r, struct buttoncounter *c) { r->w.cx = snap_to_grid(c->last.x, data.screen_granularity.x); @@ -1073,6 +1075,20 @@ static void return_clear_button_counter(union INTPACK __far *r, struct buttoncou c->count = 0; } +/** Get the size of the initial part of TSRDATA that should be saved/restored + * by programs who want to preserve the mouse driver status. */ +static unsigned int get_mouse_status_size() +{ +#if USE_VIRTUALBOX + // Programs don't have to preserve the contents of the VirtualBox buffer. + // It only needs to be preserved if we are going to be preempted in the middle + // of a VirtualBox call, and that may only happen under Windows 386. + return sizeof(data) - VBOX_BUFFER_SIZE; +#else + return sizeof(data); +#endif +} + /** Entry point for our int33 API. */ static void int33_handler(union INTPACK r) #pragma aux int33_handler "*" parm caller [] modify [ax bx cx dx si di es fs gs] @@ -1232,16 +1248,21 @@ static void int33_handler(union INTPACK r) } break; case INT33_GET_MOUSE_STATUS_SIZE: - dputs("Mouse get status size"); - r.w.bx = sizeof(TSRDATA); + dprintf("Mouse get status size required=%u\n", get_mouse_status_size()); + r.w.bx = get_mouse_status_size(); break; case INT33_SAVE_MOUSE_STATUS: - dputs("Mouse save status"); - _fmemcpy(MK_FP(r.w.es, r.w.dx), &data, sizeof(TSRDATA)); + dprintf("Mouse save status size=%u/required=%u\n", r.w.bx, get_mouse_status_size()); + hide_cursor(); + _fmemcpy(MK_FP(r.w.es, r.w.dx), &data, get_mouse_status_size()); + refresh_cursor(); break; case INT33_LOAD_MOUSE_STATUS: - dputs("Mouse load status"); - _fmemcpy(&data, MK_FP(r.w.es, r.w.dx), sizeof(TSRDATA)); + dprintf("Mouse load status size=%u/required=%u\n", r.w.bx, get_mouse_status_size()); + _fmemcpy(&data, MK_FP(r.w.es, r.w.dx), get_mouse_status_size()); + refresh_video_info(); + load_cursor(); + refresh_cursor(); break; case INT33_SET_MOUSE_SENSITIVITY: dprintf("Mouse set sensitivity x=%d y=%d threshold=%d\n", diff --git a/mousetsr.h b/mousetsr.h index 68377ab..181e949 100644 --- a/mousetsr.h +++ b/mousetsr.h @@ -204,6 +204,11 @@ typedef struct tsrdata { bool w386cursor : 1; #endif +#if USE_VMWARE + /** VMware is available. */ + bool vmwavail : 1; +#endif + #if USE_VIRTUALBOX /** VirtualBox is available. */ bool vbavail : 1; @@ -214,11 +219,6 @@ typedef struct tsrdata { struct vboxcomm vb; char vbbuf[VBOX_BUFFER_SIZE]; #endif - -#if USE_VMWARE - /** VMware is available. */ - bool vmwavail; -#endif } TSRDATA; typedef TSRDATA * PTSRDATA; diff --git a/version.h b/version.h index 2fbde00..a72de8e 100644 --- a/version.h +++ b/version.h @@ -2,6 +2,6 @@ #define VERSION_H #define VERSION_MAJOR 0 -#define VERSION_MINOR 0x63 +#define VERSION_MINOR 0x64 #endif // VERSION_H -- cgit v1.2.3