VOGONS


First post, by cambalinho

User metadata
Rank Member
Rank
Member

Turbo Pascal it's an IDE for creating programs using Pascal code.
i can enter on IDE normaly and use it normaly. i compile the program and i then execute it. we go outside of IDE for test our program and then we came back to IDE. the problem now happens: i lose the mouse click.
please test these problem.
tip: when we execute the DosBox it's the best that the drive mount will be done automatic(at least let the user decide it)... good for the beginners
thanks for all and continue with nice work

Reply 1 of 2, by vytra

User metadata
Rank Newbie
Rank
Newbie
cambalinho wrote:

Turbo Pascal it's an IDE for creating programs using Pascal code...
Thanks for all and continue with nice work.

- I sometimes in the DOSBox work with Turbo C, any problem with mouse handling was not found. Maybe you are using the wrong mouse handling code?


/* MOUSE.C
* (C) 1990 by VytRa
* Kaunas, Lithuania
*/

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

char ScreenHeight,ScreenWidth,MouseInstalled,MouseCursorOn,
MouseXLo,MouseXHi,MouseYLo,MouseYHi,MouseEvent,
MouseStatus,MouseLastX,MouseLastY;

struct{
unsigned Segm;
unsigned Ofst;}MouseRoutine;

void
InitializeMouse(void){
union REGS regs;
struct SREGS sregs;
disable();
MouseCursorOn=MouseInstalled=0;
regs.x.ax=0x3533;
int86x(0x21,&regs,&regs,&sregs);
if((sregs.es | regs.x.bx)==NULL)
goto ret;
regs.x.ax=0;
int86(0x33,&regs,&regs);
if(regs.x.ax == 0)
goto ret;
MouseInstalled++;
MouseRoutine.Segm=MouseRoutine.Ofst=MouseStatus=MouseEvent=0;
ScreenHeight=25,ScreenWidth=80;
ret: enable();
}

void
ShowMousePrim(void){
union REGS regs;
if(MouseInstalled==0) return;
disable();
regs.x.ax=1;
int86(0x33,&regs,&regs);
MouseCursorOn++;
enable();
}

void
HideMousePrim(void){
union REGS regs;
if(MouseInstalled==0) return;
disable();
MouseCursorOn=0;
if(MouseInstalled){
regs.x.ax=2;
int86(0x33,&regs,&regs);}
enable();
Show last 126 lines
}

short
ScaleDownX(short x){
if(ScreenWidth==39)
x>>=4;
else x>>=3;
return(x-=MouseXLo);
}

short
ScaleDownY(short y){
y>>=3;
return(y-=MouseYLo);
}

short
ScaleUpX(short x){
if(ScreenWidth==39)
return((x<<4)+7);
else return((x<<3)+3);
}

short
ScaleUpY(short y){
return((y<<3)+3);
}

void
MouseWindow(short XLo,short YLo,short XHi,short YHi){
union REGS regs;
if(MouseInstalled==0) return;
if(XLo>XHi || XHi>ScreenWidth || YLo>YHi || YHi>ScreenHeight)
return;
disable();
MouseXLo=XLo,MouseYLo=YLo,MouseXHi=XHi,MouseYHi=YHi;
regs.x.cx=ScaleUpX(XLo);
regs.x.dx=ScaleUpX(XHi);
regs.x.ax=0x7;
int86(0x33,&regs,&regs);
regs.x.cx=ScaleUpY(YLo);
regs.x.dx=ScaleUpY(YHi);
regs.x.ax=0x8;
int86(0x33,&regs,&regs);
enable();
}

void
MouseGotoXY(char MouseX,char MouseY){
union REGS regs;
char x,y;
if(MouseInstalled==0) return;
if((y=MouseY+MouseYLo)>MouseYHi || (x=MouseX+MouseXLo)>MouseXHi)
return;
disable();
regs.x.cx=ScaleUpX(x);
regs.x.dx=ScaleUpY(y);
regs.x.ax=4;
int86(0x33,&regs,&regs);
enable();
}

short
MouseButtonReleased(char Button,char *LastX, char *LastY){
union REGS regs;
if(MouseInstalled==0) return(0);
disable();
regs.x.bx=Button;
regs.x.ax=6;
int86(0x33,&regs,&regs);
*LastX=ScaleDownX(regs.x.cx);
*LastY=ScaleDownY(regs.x.dx);
enable();
return(regs.x.bx);
}

void
SetMickeyToPixelRatio(short Horizontal,short Vertical){
union REGS regs;
if(MouseInstalled==0) return;
disable();
regs.x.cx=Horizontal;
regs.x.dx=Vertical&0x7fff;
regs.x.ax=15;
int86(0x33,&regs,&regs);
enable();
}

short
MouseWhereX(void){
union REGS regs;
if(MouseInstalled==0) return(wherex());
disable();
regs.x.ax=3;
int86(0x33,&regs,&regs);
enable();
return(ScaleDownX(regs.x.cx));
}

short
MouseWhereY(void){
union REGS regs;
if(MouseInstalled==0) return(wherex());
disable();
regs.x.ax=3;
int86(0x33,&regs,&regs);
enable();
return(ScaleDownX(regs.x.dx));
}

short
MouseWhereXY(char *MouseXvar,char *MouseYvar){
union REGS regs;
if(MouseInstalled==0){
*MouseXvar=wherex();
*MouseYvar=wherey();
return(NULL);}
disable();
regs.x.ax=3;
int86(0x33,&regs,&regs);
*MouseXvar=ScaleDownX(regs.x.cx);
*MouseYvar=ScaleDownY(regs.x.dx);
enable();
return(regs.x.bx);
}

😊