VOGONS


First post, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

As I am (again) getting back to DOS programming in C/asm, I have stumbled upon a delicate mouse problem. After initializing the mouse, using interrupt 0x33 service 3 I read the registers to get the mouse status.
Registers CX and DX work fine, but BX acts weird. I have a simple loop waiting for left button click to finish the program. It works okay the first time I run it, every other run it immediatelly finishes. After some debuggins sessions I found out that BX & 0x01 just stays set after the first cycle, even though the mouse was initialized again and int 0x33 was called again too.

It does work fine after compiling the program and running it from the command line. I thought it could be the Borland IDE so I installed a VMWare MS-DOS 6.22 machine and tried my source code there. It not only works from the command line, but also from the IDE itself. It seems there is some problem with Borland C++ vs DOSBox, has anyone else noticed that? Is there any trick/setting to fix it? I also noticed that Borland C++ in DOSBox keeps repeating that the source code changed every time I compile it, even though there was no change, but I guess thats probably not related.

Everything is fine when run on my retro PC too, but I have access to it only a few times per year. I really really like the Borland C++ IDE and would like to be able to use it with DOSBox.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 2 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Thank you for your reply. I am using 0.74-2 actually so will try the latest one. The SVN one if I can find it.
EDIT: In 0.74-3 the problem persists.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 3 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Not sure if thats what you meant, but I tried this SVN DOSBox-X v0.84.0 (2022/05/31) and it does solve the mouse problem, thank you!
I would prefer to stay with the official version, hopefully the fix will find itw way into 0.74-4 when its out.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 4 of 16, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

No, that is an unofficial fork -- it does not represent SVN, and it does not indicate if the issue is resolved in official source.
You can get an SVN build here: https://yesterplay.net/dosboxece/
Use the most recent non-ECE build, which as of today is: "DOSBox r4477.7z"

Reply 5 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Nice, this build does solve the issue too. Alas for some reason it completely broke my mouse routines (and its just the basic stuff of INT 0x33). The cursor now goes haywire in weird directions.
Was there a change of the built-in mouse driver? It seems to either jump off the screen (the default sensitivity 100) or slowly change direction after moving the mouse like a meter on my table (sensitivity 5). And does not work at all when the mouse is locked.
It does work much better in the unofficial build with sensitivity 100 so I dont want to bother you unnecessarily. Unless you want to solve the issue, then I can of course test and report.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 6 of 16, by root42

User metadata
Rank l33t
Rank
l33t

It would help if you maybe could share the code that you wrote? I doubt that DOSBox is so broken that int 0x33 doesn't work anymore, as that is how 99% of the software will use the mouse...

YouTube and Bonus
80486DX@33 MHz, 16 MiB RAM, Tseng ET4000 1 MiB, SnarkBarker & GUSar Lite, PC MIDI Card+X2+SC55+MT32, OSSC

Reply 7 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Of course, I can share the code. Its just that the code works compiled and both on a real pc and virtual pc even in the IDE. And also in the unofficial build of DOSBox.

#include <stdio.h>
#include "mouse.h"

typedef struct {
int x, y;
unsigned char lmb, rmb, mmb;
} MOUSE;

MOUSE Mouse;

int MOUSE_Detect(void)
{
asm {
mov ax, 0x00
int 0x33
}

Mouse.lmb = 0;
Mouse.rmb = 0;
Mouse.mmb = 0;
Mouse.x = 0;
Mouse.y = 0;

if (_AX == 0) return(0);
else return(1);
}

void MOUSE_Update(void)
{
asm {
mov ax, 0x03
int 0x33
mov [Mouse.x], cx
mov [Mouse.y], dx
mov [Mouse.lmb], bx
and [Mouse.lmb], 0x01
mov [Mouse.rmb], bx
and [Mouse.rmb], 0x02
mov [Mouse.mmb], bx
and [Mouse.mmb], 0x04
}
}

void MOUSE_SetPosition(int x, int y)
{
asm {
mov ax, 0x04
mov cx, [x]
mov dx, [y]
int 0x33
}
}

void MOUSE_SetRange(int x1, int y1, int x2, int y2)
{
asm {
mov ax, 0x07
mov cx, [x1]
mov dx, [x2]
int 0x33
Show last 9 lines

mov ax, 0x08
mov cx, [y1]
mov dx, [y2]
int 0x33
}
}

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 8 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Then I simply draw a bitmap on the mouse coordinates with

VESA_DrawImage640(Mouse.x, Mouse.y, image, 20, 20);

not even erasing it afterwards so I can see how it travels.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 9 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Its not easy to explain. The code is the same. I tried about the same mouse moves in official DOSBox and then in the unofficial build (the second image):
https://imgur.com/a/mfW9enO
https://imgur.com/a/olgxS9g

Both have mouse sensitivity 100.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 11 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

I tried a version of SDL.dll from 2010 which is about 1/3 smaller than the one that comes with the SVN build and no dice, its the same. Can't test with the one that comes with the unofficial build as the file is not there, its probably linked with the main .exe.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 13 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Sure, I tested the executable now on my home PC with DOSBox 0.74-3 and it works perfectly. It must be something with my computer at work I guess. I will try again on Monday.

Attachments

  • Filename
    SVGA.EXE
    File size
    21.45 KiB
    Downloads
    50 downloads
    File license
    Fair use/fair dealing exception

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 14 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Just tested again on my work PC, the movement is no longer jerky, I dont get it. The BX problem is still somewhat active, the program works just for the first time (when executed from the IDE), the following runs it just ends immediatelly (the LMB is still acting as if pressed). But when I have a pause after initializing the mouse and click at that time, it seems to reset the BX register or something and it sometimes works then, for one run again. I guess thats as far as I can get. Will have to see how it behaves on the real DOS machine when I get there in a few weeks.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)

Reply 15 of 16, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

SVN has a fix to ignore button press and release events that are out of sequence, and a fix for clearing the button press and release counters when the reset function is called, which could relate to what you refer to as "the BX problem", and that is why I suggest using SVN. I do not know if the fixes were adopted and correctly implemented in unofficial forks.

As for the strange coordinate behavior you described, I don't know what might cause that. I have seen instances where certain apps running in the task tray caused odd mouse behavior in DOSBox, so you could try removing anything like that from the equation.

Reply 16 of 16, by WhiteFalcon

User metadata
Rank Newbie
Rank
Newbie

Sorry for teh confusion, the erratic movement was due to using remote desktop on my laptop and running the program on my work PC this way. I know, I know, but when running it in the virtual box the same way it worked okay, so it did not occur to me as the possible cause.

I tried it on my real old PC and it works without a hitch there so it must be the out of sequence clicks you describe.

Olivetti M4 P75, 32MB RAM, 4GB HDD, SoundBlaster AWE 64, Gravis Ultrasound MAX, Roland SCC-1, Roland MT-32, Roland CM-64
Intel 486DX2/66Mhz, 8MB RAM, VGA Trident 512kB, 264MB HDD Quantum, SoundBlaster 16 Pro (CT2910)