aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-27 01:21:20 +0200
committerJavier <dev.git@javispedro.com>2022-04-27 01:21:20 +0200
commit6faf797ee40f494e385d1d99ef2da55740326ce0 (patch)
tree21016407455221fee3ba775bb118f9d1cfd85bc8
parent13cc0921d8f9a0d488a27e2c86c1d9d013a964fe (diff)
downloadvbados-6faf797ee40f494e385d1d99ef2da55740326ce0.tar.gz
vbados-6faf797ee40f494e385d1d99ef2da55740326ce0.zip
refactor: use INTPACKW (always 16-bit) instead of INTPACKX
-rw-r--r--mousetsr.c176
-rw-r--r--sftsr.c69
-rw-r--r--sftsr.h1
-rw-r--r--utils.h3
4 files changed, 126 insertions, 123 deletions
diff --git a/mousetsr.c b/mousetsr.c
index c46089b..147ec2c 100644
--- a/mousetsr.c
+++ b/mousetsr.c
@@ -1109,17 +1109,17 @@ static void reset_mouse_state()
static void return_clear_wheel_counter(union INTPACK __far *r)
{
- r->x.cx = snap_to_grid(data.wheel_last.x, data.screen_granularity.x);
- r->x.dx = snap_to_grid(data.wheel_last.y, data.screen_granularity.y);
- r->x.bx = data.wheel_delta;
+ r->w.cx = snap_to_grid(data.wheel_last.x, data.screen_granularity.x);
+ r->w.dx = snap_to_grid(data.wheel_last.y, data.screen_granularity.y);
+ r->w.bx = data.wheel_delta;
data.wheel_delta = 0;
}
static void return_clear_button_counter(union INTPACK __far *r, struct buttoncounter *c)
{
- r->x.cx = snap_to_grid(c->last.x, data.screen_granularity.x);
- r->x.dx = snap_to_grid(c->last.y, data.screen_granularity.y);
- r->x.bx = c->count;
+ r->w.cx = snap_to_grid(c->last.x, data.screen_granularity.x);
+ r->w.dx = snap_to_grid(c->last.y, data.screen_granularity.y);
+ r->w.bx = c->count;
c->count = 0;
}
@@ -1127,15 +1127,15 @@ static void return_clear_button_counter(union INTPACK __far *r, struct buttoncou
static void int33_handler(union INTPACK r)
#pragma aux int33_handler "*" parm caller [] modify [ax bx cx dx si di es fs gs]
{
- switch (r.x.ax) {
+ switch (r.w.ax) {
case INT33_RESET_MOUSE:
dlog_puts("Mouse reset");
reload_video_info();
reset_mouse_settings();
reset_mouse_hardware();
reset_mouse_state();
- r.x.ax = INT33_MOUSE_FOUND;
- r.x.bx = NUM_BUTTONS;
+ r.w.ax = INT33_MOUSE_FOUND;
+ r.w.bx = NUM_BUTTONS;
break;
case INT33_SHOW_CURSOR:
#if TRACE_EVENTS
@@ -1155,9 +1155,9 @@ static void int33_handler(union INTPACK r)
#if TRACE_EVENTS
dlog_puts("Mouse get position");
#endif
- r.x.cx = snap_to_grid(data.pos.x, data.screen_granularity.x);
- r.x.dx = snap_to_grid(data.pos.y, data.screen_granularity.y);
- r.x.bx = data.buttons;
+ r.w.cx = snap_to_grid(data.pos.x, data.screen_granularity.x);
+ r.w.dx = snap_to_grid(data.pos.y, data.screen_granularity.y);
+ r.w.bx = data.buttons;
#if USE_WHEEL
if (data.haswheel) {
r.h.bh = data.wheel_delta;
@@ -1169,8 +1169,8 @@ static void int33_handler(union INTPACK r)
#if TRACE_EVENTS
dlog_puts("Mouse set position");
#endif
- data.pos.x = r.x.cx;
- data.pos.y = r.x.dx;
+ data.pos.x = r.w.cx;
+ data.pos.y = r.w.dx;
data.pos_frac.x = 0;
data.pos_frac.y = 0;
data.delta.x = 0;
@@ -1183,11 +1183,11 @@ static void int33_handler(union INTPACK r)
#if TRACE_EVENTS
dlog_puts("Mouse get button pressed counter");
#endif
- r.x.ax = data.buttons;
+ r.w.ax = data.buttons;
#if USE_WHEEL
if (data.haswheel) {
r.h.bh = data.wheel_delta;
- if (r.x.bx == -1) {
+ if (r.w.bx == -1) {
// Asked for wheel information
return_clear_wheel_counter(&r);
break;
@@ -1196,17 +1196,17 @@ static void int33_handler(union INTPACK r)
#endif
// Regular button information
return_clear_button_counter(&r,
- &data.button[MIN(r.x.bx, NUM_BUTTONS - 1)].pressed);
+ &data.button[MIN(r.w.bx, NUM_BUTTONS - 1)].pressed);
break;
case INT33_GET_BUTTON_RELEASED_COUNTER:
#if TRACE_EVENTS
dlog_puts("Mouse get button released counter");
#endif
- r.x.ax = data.buttons;
+ r.w.ax = data.buttons;
#if USE_WHEEL
if (data.haswheel) {
r.h.bh = data.wheel_delta;
- if (r.x.bx == -1) {
+ if (r.w.bx == -1) {
// Asked for wheel information
return_clear_wheel_counter(&r);
break;
@@ -1214,129 +1214,129 @@ static void int33_handler(union INTPACK r)
}
#endif
return_clear_button_counter(&r,
- &data.button[MIN(r.x.bx, NUM_BUTTONS - 1)].released);
+ &data.button[MIN(r.w.bx, NUM_BUTTONS - 1)].released);
break;
case INT33_SET_HORIZONTAL_WINDOW:
dlog_print("Mouse set horizontal window [");
- dlog_printd(r.x.cx);
+ dlog_printd(r.w.cx);
dlog_putc(',');
- dlog_printd(r.x.dx);
+ dlog_printd(r.w.dx);
dlog_puts("]");
// Recheck in case someone changed the video mode
refresh_video_info();
- data.min.x = r.x.cx;
- data.max.x = r.x.dx;
+ data.min.x = r.w.cx;
+ data.max.x = r.w.dx;
bound_position_to_window();
break;
case INT33_SET_VERTICAL_WINDOW:
dlog_print("Mouse set vertical window [");
- dlog_printd(r.x.cx);
+ dlog_printd(r.w.cx);
dlog_putc(',');
- dlog_printd(r.x.dx);
+ dlog_printd(r.w.dx);
dlog_puts("]");
refresh_video_info();
- data.min.y = r.x.cx;
- data.max.y = r.x.dx;
+ data.min.y = r.w.cx;
+ data.max.y = r.w.dx;
bound_position_to_window();
break;
case INT33_SET_GRAPHICS_CURSOR:
dlog_puts("Mouse set graphics cursor");
hide_cursor();
- data.cursor_hotspot.x = r.x.bx;
- data.cursor_hotspot.y = r.x.cx;
- _fmemcpy(data.cursor_graphic, MK_FP(r.x.es, r.x.dx), sizeof(data.cursor_graphic));
+ data.cursor_hotspot.x = r.w.bx;
+ data.cursor_hotspot.y = r.w.cx;
+ _fmemcpy(data.cursor_graphic, MK_FP(r.w.es, r.w.dx), sizeof(data.cursor_graphic));
load_cursor();
refresh_cursor();
break;
case INT33_SET_TEXT_CURSOR:
dlog_print("Mouse set text cursor ");
- dlog_printd(r.x.bx);
+ dlog_printd(r.w.bx);
dlog_endline();
hide_cursor();
- data.cursor_text_type = r.x.bx;
- data.cursor_text_and_mask = r.x.cx;
- data.cursor_text_xor_mask = r.x.dx;
+ data.cursor_text_type = r.w.bx;
+ data.cursor_text_and_mask = r.w.cx;
+ data.cursor_text_xor_mask = r.w.dx;
refresh_cursor();
break;
case INT33_GET_MOUSE_MOTION:
#if TRACE_EVENTS
dlog_puts("Mouse get motion");
#endif
- r.x.cx = data.delta.x;
- r.x.dx = data.delta.y;
+ r.w.cx = data.delta.x;
+ r.w.dx = data.delta.y;
data.delta.x = 0;
data.delta.y = 0;
break;
case INT33_SET_EVENT_HANDLER:
dlog_puts("Mouse set event handler");
- data.event_mask = r.x.cx;
- data.event_handler = MK_FP(r.x.es, r.x.dx);
+ data.event_mask = r.w.cx;
+ data.event_handler = MK_FP(r.w.es, r.w.dx);
break;
case INT33_SET_MOUSE_SPEED:
dlog_print("Mouse set speed x=");
- dlog_printd(r.x.cx);
+ dlog_printd(r.w.cx);
dlog_print(" y=");
- dlog_printd(r.x.dx);
+ dlog_printd(r.w.dx);
dlog_endline();
- data.mickeysPerLine.x = r.x.cx;
- data.mickeysPerLine.y = r.x.dx;
+ data.mickeysPerLine.x = r.w.cx;
+ data.mickeysPerLine.y = r.w.dx;
break;
case INT33_SET_SPEED_DOUBLE_THRESHOLD:
dlog_print("Mouse set speed double threshold=");
- dlog_printd(r.x.dx);
+ dlog_printd(r.w.dx);
dlog_endline();
- data.doubleSpeedThreshold = r.x.dx;
+ data.doubleSpeedThreshold = r.w.dx;
break;
case INT33_EXCHANGE_EVENT_HANDLER:
dlog_puts("Mouse exchange event handler");
- data.event_mask = r.x.cx;
+ data.event_mask = r.w.cx;
{
void (__far *prev_event_handler)() = data.event_handler;
- data.event_handler = MK_FP(r.x.es, r.x.dx);
- r.x.es = FP_SEG(prev_event_handler);
- r.x.dx = FP_OFF(prev_event_handler);
+ data.event_handler = MK_FP(r.w.es, r.w.dx);
+ r.w.es = FP_SEG(prev_event_handler);
+ r.w.dx = FP_OFF(prev_event_handler);
}
break;
case INT33_GET_MOUSE_STATUS_SIZE:
dlog_puts("Mouse get status size");
- r.x.bx = sizeof(TSRDATA);
+ r.w.bx = sizeof(TSRDATA);
break;
case INT33_SAVE_MOUSE_STATUS:
dlog_puts("Mouse save status");
- _fmemcpy(MK_FP(r.x.es, r.x.dx), &data, sizeof(TSRDATA));
+ _fmemcpy(MK_FP(r.w.es, r.w.dx), &data, sizeof(TSRDATA));
break;
case INT33_LOAD_MOUSE_STATUS:
dlog_puts("Mouse load status");
- _fmemcpy(&data, MK_FP(r.x.es, r.x.dx), sizeof(TSRDATA));
+ _fmemcpy(&data, MK_FP(r.w.es, r.w.dx), sizeof(TSRDATA));
break;
case INT33_SET_MOUSE_SENSITIVITY:
dlog_print("Mouse set sensitivity x=");
- dlog_printd(r.x.bx);
+ dlog_printd(r.w.bx);
dlog_print(" y=");
- dlog_printd(r.x.cx);
+ dlog_printd(r.w.cx);
dlog_print(" threshold=");
- dlog_printd(r.x.dx);
+ dlog_printd(r.w.dx);
dlog_endline();
// TODO According to cutemouse, sensitivity != mickeysPerLine
- data.mickeysPerLine.x = r.x.bx;
- data.mickeysPerLine.y = r.x.cx;
- data.doubleSpeedThreshold = r.x.dx;
+ data.mickeysPerLine.x = r.w.bx;
+ data.mickeysPerLine.y = r.w.cx;
+ data.doubleSpeedThreshold = r.w.dx;
break;
case INT33_GET_MOUSE_SENSITIVITY:
- r.x.bx = data.mickeysPerLine.x;
- r.x.cx = data.mickeysPerLine.y;
- r.x.dx = data.doubleSpeedThreshold;
+ r.w.bx = data.mickeysPerLine.x;
+ r.w.cx = data.mickeysPerLine.y;
+ r.w.dx = data.doubleSpeedThreshold;
break;
case INT33_RESET_SETTINGS:
dlog_puts("Mouse reset settings");
reload_video_info();
reset_mouse_settings();
reset_mouse_state();
- r.x.ax = INT33_MOUSE_FOUND;
- r.x.bx = NUM_BUTTONS;
+ r.w.ax = INT33_MOUSE_FOUND;
+ r.w.bx = NUM_BUTTONS;
break;
case INT33_GET_LANGUAGE:
- r.x.bx = 0;
+ r.w.bx = 0;
break;
case INT33_GET_DRIVER_INFO:
dlog_puts("Mouse get driver info");
@@ -1346,35 +1346,35 @@ static void int33_handler(union INTPACK r)
r.h.cl = 0;
break;
case INT33_GET_MAX_COORDINATES:
- r.x.bx = 0;
- r.x.cx = MAX(data.screen_max.x, data.max.x);
- r.x.dx = MAX(data.screen_max.y, data.max.y);
+ r.w.bx = 0;
+ r.w.cx = MAX(data.screen_max.x, data.max.x);
+ r.w.dx = MAX(data.screen_max.y, data.max.y);
break;
case INT33_GET_WINDOW:
- r.x.ax = data.min.x;
- r.x.bx = data.min.y;
- r.x.cx = data.max.x;
- r.x.dx = data.max.y;
+ r.w.ax = data.min.x;
+ r.w.bx = data.min.y;
+ r.w.cx = data.max.x;
+ r.w.dx = data.max.y;
break;
#if USE_WHEEL
// Wheel API extensions:
case INT33_GET_CAPABILITIES:
dlog_puts("Mouse get capabitilies");
- r.x.ax = INT33_WHEEL_API_MAGIC; // Driver supports wheel API
- r.x.bx = 0;
- r.x.cx = data.haswheel ? INT33_CAPABILITY_MOUSE_API : 0;
+ r.w.ax = INT33_WHEEL_API_MAGIC; // Driver supports wheel API
+ r.w.bx = 0;
+ r.w.cx = data.haswheel ? INT33_CAPABILITY_MOUSE_API : 0;
data.usewheelapi = true; // Someone calling this function likely wants to use wheel API
break;
#endif
// Our internal API extensions:
case INT33_GET_TSR_DATA:
dlog_puts("Get TSR data");
- r.x.es = FP_SEG(&data);
- r.x.di = FP_OFF(&data);
+ r.w.es = FP_SEG(&data);
+ r.w.di = FP_OFF(&data);
break;
default:
dlog_print("Unknown mouse function ax=");
- dlog_printx(r.x.ax);
+ dlog_printx(r.w.ax);
dlog_endline();
break;
}
@@ -1457,13 +1457,13 @@ void __declspec(naked) __far windows_mouse_callback()
static void int2f_handler(union INTPACK r)
#pragma aux int2f_handler "*" parm caller [] modify [ax bx cx dx es]
{
- switch (r.x.ax) {
+ switch (r.w.ax) {
case INT2F_NOTIFY_WIN386_STARTUP:
dlog_print("Windows is starting, version=");
- dlog_printx(r.x.di);
+ dlog_printx(r.w.di);
dlog_endline();
data.w386_startup.version = 3;
- data.w386_startup.next = MK_FP(r.x.es, r.x.bx);
+ data.w386_startup.next = MK_FP(r.w.es, r.w.bx);
data.w386_startup.device_driver = 0;
data.w386_startup.device_driver_data = 0;
data.w386_startup.instance_data = &data.w386_instance;
@@ -1471,8 +1471,8 @@ static void int2f_handler(union INTPACK r)
data.w386_instance[0].size = sizeof(data);
data.w386_instance[1].ptr = 0;
data.w386_instance[1].size = 0;
- r.x.es = FP_SEG(&data.w386_startup);
- r.x.bx = FP_OFF(&data.w386_startup);
+ r.w.es = FP_SEG(&data.w386_startup);
+ r.w.bx = FP_OFF(&data.w386_startup);
data.haswin386 = true;
break;
case INT2F_NOTIFY_WIN386_SHUTDOWN:
@@ -1481,17 +1481,17 @@ static void int2f_handler(union INTPACK r)
data.w386cursor = false;
break;
case INT2F_NOTIFY_DEVICE_CALLOUT:
- switch (r.x.bx) {
+ switch (r.w.bx) {
case VMD_DEVICE_ID:
- switch (r.x.cx) {
+ switch (r.w.cx) {
case VMD_CALLOUT_TEST:
- r.x.cx = 1; // Yes, we are here!
+ r.w.cx = 1; // Yes, we are here!
break;
case VMD_CALLOUT_GET_DOS_MOUSE_API:
// Windows is asking our mouse driver for the hook function address
- r.x.ds = get_cs();
- r.x.si = FP_OFF(windows_mouse_callback);
- r.x.ax = 0; // Yes, we are here!
+ r.w.ds = get_cs();
+ r.w.si = FP_OFF(windows_mouse_callback);
+ r.w.ax = 0; // Yes, we are here!
break;
}
break;
diff --git a/sftsr.c b/sftsr.c
index 62e1734..8555ac3 100644
--- a/sftsr.c
+++ b/sftsr.c
@@ -66,10 +66,10 @@ static void map_shfl_info_to_dosdir(DOSDIR __far *dir, SHFLFSOBJINFO *i)
static void map_shfl_info_to_getattr(union INTPACK __far *r, SHFLFSOBJINFO *i)
{
- r->x.ax = map_shfl_attr_to_dosattr(&i->Attr);
- r->x.bx = ((uint32_t)i->cbObject) >> 16;
- r->x.di = ((uint16_t)i->cbObject);
- timestampns_to_dos_time(&r->x.cx, &r->x.dx, i->ModificationTime, data.tz_offset);
+ r->w.ax = map_shfl_attr_to_dosattr(&i->Attr);
+ r->w.bx = ((uint32_t)i->cbObject) >> 16;
+ r->w.di = ((uint16_t)i->cbObject);
+ timestampns_to_dos_time(&r->w.cx, &r->w.dx, i->ModificationTime, data.tz_offset);
}
static bool is_valid_dos_file(SHFLFSOBJINFO *i)
@@ -95,7 +95,7 @@ static int get_op_drive_num(union INTPACK __far *r)
case DOS_FN_UNLOCK:
case DOS_FN_SEEK_END:
// Some operations use an SFT and we directly get the drive from it
- sft = MK_FP(r->x.es, r->x.di);
+ sft = MK_FP(r->w.es, r->w.di);
return sft->dev_info & 0x1F;
case DOS_FN_RMDIR:
@@ -139,7 +139,7 @@ static bool is_call_for_mounted_drive(union INTPACK __far *r)
static void clear_dos_err(union INTPACK __far *r)
{
dlog_puts("->ok");
- r->x.flags &= ~INTR_CF;
+ r->w.flags &= ~INTR_CF;
}
static void set_dos_err(union INTPACK __far *r, int err)
@@ -147,8 +147,8 @@ static void set_dos_err(union INTPACK __far *r, int err)
dlog_print("->dos error ");
dlog_printd(err);
dlog_endline();
- r->x.flags |= INTR_CF;
- r->x.ax = err;
+ r->w.flags |= INTR_CF;
+ r->w.ax = err;
}
static int vbox_err_to_dos(vboxerr err)
@@ -345,7 +345,7 @@ static void handle_create_open_ex(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned int action, mode;
unsigned openfile;
bool save_result;
@@ -438,13 +438,13 @@ static void handle_create_open_ex(union INTPACK __far *r)
set_dos_err(r, DOS_ERROR_FILE_NOT_FOUND);
return;
case SHFL_FILE_EXISTS:
- if (save_result) r->x.cx = OPENEX_FILE_OPENED;
+ if (save_result) r->w.cx = OPENEX_FILE_OPENED;
break;
case SHFL_FILE_CREATED:
- if (save_result) r->x.cx = OPENEX_FILE_CREATED;
+ if (save_result) r->w.cx = OPENEX_FILE_CREATED;
break;
case SHFL_FILE_REPLACED:
- if (save_result) r->x.cx = OPENEX_FILE_REPLACED;
+ if (save_result) r->w.cx = OPENEX_FILE_REPLACED;
break;
}
@@ -468,7 +468,7 @@ static void handle_create_open_ex(union INTPACK __far *r)
static void handle_close(union INTPACK __far *r)
{
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned openfile = get_sft_openfile_index(sft);
vboxerr err;
@@ -503,11 +503,11 @@ static void handle_close(union INTPACK __far *r)
static void handle_read(union INTPACK __far *r)
{
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned openfile = get_sft_openfile_index(sft);
uint8_t __far *buffer = data.dossda->cur_dta;
unsigned long offset = sft->f_pos;
- unsigned bytes = r->x.cx;
+ unsigned bytes = r->w.cx;
vboxerr err;
dlog_print("handle_read openfile=");
@@ -536,17 +536,17 @@ static void handle_read(union INTPACK __far *r)
// Advance the file position
sft->f_pos += bytes;
- r->x.cx = bytes;
+ r->w.cx = bytes;
clear_dos_err(r);
}
static void handle_write(union INTPACK __far *r)
{
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned openfile = get_sft_openfile_index(sft);
uint8_t __far *buffer = data.dossda->cur_dta;
unsigned long offset = sft->f_pos;
- unsigned bytes = r->x.cx;
+ unsigned bytes = r->w.cx;
vboxerr err;
dlog_print("handle_write openfile=");
@@ -578,19 +578,19 @@ static void handle_write(union INTPACK __far *r)
// Assume the file has grown if we've written past the end
if (sft->f_pos > sft->f_size) sft->f_size = sft->f_pos;
- r->x.cx = bytes;
+ r->w.cx = bytes;
clear_dos_err(r);
}
static void handle_lock(union INTPACK __far *r)
{
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned openfile = get_sft_openfile_index(sft);
bool unlock = r->h.bl ? true : false;
- unsigned numops = r->x.cx, i;
+ unsigned numops = r->w.cx, i;
unsigned flags = (unlock ? SHFL_LOCK_CANCEL : SHFL_LOCK_EXCLUSIVE)
| SHFL_LOCK_WAIT | SHFL_LOCK_PARTIAL;
- DOSLOCK __far *ops = MK_FP(r->x.ds, r->x.dx);
+ DOSLOCK __far *ops = MK_FP(r->w.ds, r->w.dx);
vboxerr err;
dlog_print("handle_lock ");
@@ -614,10 +614,10 @@ static void handle_lock(union INTPACK __far *r)
static void handle_seek_end(union INTPACK __far *r)
{
- DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
+ DOSSFT __far *sft = MK_FP(r->w.es, r->w.di);
unsigned openfile = get_sft_openfile_index(sft);
uint8_t __far *buffer = data.dossda->cur_dta;
- long offset = ((uint32_t)(r->x.cx) << 16) | (uint32_t)(r->x.dx);
+ long offset = ((uint32_t)(r->w.cx) << 16) | (uint32_t)(r->w.dx);
unsigned buf_size = sizeof(SHFLFSOBJINFO);
vboxerr err;
@@ -678,8 +678,8 @@ static void handle_seek_end(union INTPACK __far *r)
dlog_endline();
// Return new file position in dx:ax
- r->x.dx = sft->f_pos >> 16;
- r->x.ax = sft->f_pos ;
+ r->w.dx = sft->f_pos >> 16;
+ r->w.ax = sft->f_pos ;
clear_dos_err(r);
}
@@ -809,7 +809,6 @@ static void handle_getattr(union INTPACK __far *r)
clear_dos_err(r);
}
-
static vboxerr open_search_dir(SHFLROOT root, const char __far *path)
{
vboxerr err;
@@ -1209,9 +1208,9 @@ static void handle_get_disk_free(union INTPACK __far *r)
r->h.ah = 0; // media ID byte
r->h.al = SECTORS_PER_CLUSTER;
- r->x.cx = BYTES_PER_SECTOR;
- r->x.bx = disk_bytes_to_clusters(parms.volinfo.ullTotalAllocationBytes);
- r->x.dx = disk_bytes_to_clusters(parms.volinfo.ullAvailableAllocationBytes);
+ r->w.cx = BYTES_PER_SECTOR;
+ r->w.bx = disk_bytes_to_clusters(parms.volinfo.ullTotalAllocationBytes);
+ r->w.dx = disk_bytes_to_clusters(parms.volinfo.ullAvailableAllocationBytes);
clear_dos_err(r);
}
@@ -1220,13 +1219,13 @@ static bool int2f_11_handler(union INTPACK r)
#pragma aux int2f_11_handler "*" parm caller [] value [al] modify [ax bx cx dx si di es gs fs]
{
if (r.h.ah != 0x11) return false; // Only interested in network redirector functions
- if (r.h.al == 0xff && r.x.bx == 0x5742 && r.x.cx == 0x5346) {
+ if (r.h.al == 0xff && r.w.bx == 0x5742 && r.w.cx == 0x5346) {
// These are the magic numbers to our private "Get TSR data" function
dlog_puts("Get TSR data");
- r.x.es = get_ds();
- r.x.di = FP_OFF(&data);
- r.x.bx = 0x5444;
- r.x.cx = 1;
+ r.w.es = get_ds();
+ r.w.di = FP_OFF(&data);
+ r.w.bx = 0x5444;
+ r.w.cx = 1;
return true;
}
diff --git a/sftsr.h b/sftsr.h
index 6161757..7c8802f 100644
--- a/sftsr.h
+++ b/sftsr.h
@@ -26,6 +26,7 @@
#include "vbox.h"
#include "int21dos.h"
+/** Trace all int2F calls into dlog */
#define TRACE_CALLS 0
#define LASTDRIVE 'Z'
diff --git a/utils.h b/utils.h
index 16ad7fb..e207b44 100644
--- a/utils.h
+++ b/utils.h
@@ -39,6 +39,9 @@ static inline __segment get_cs(void);
static inline __segment get_ds(void);
#pragma aux get_ds = "mov ax, ds" value [ax] modify exact [];
+static inline __segment get_ss(void);
+#pragma aux get_ss = "mov ax, ss" value [ax] modify exact [];
+
/** Converts a far pointer into equivalent linear address.
* Note that under protected mode linear != physical (for that, need VDS). */
static inline uint32_t linear_addr(const void __far * ptr)