mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:49:22 +02:00
* Fixes from Gabor (merged)
This commit is contained in:
parent
e1a81165ac
commit
03b63234e4
@ -12,6 +12,7 @@ var
|
|||||||
RealOfs : Word; { Real mode offset }
|
RealOfs : Word; { Real mode offset }
|
||||||
CurrentMask : word;
|
CurrentMask : word;
|
||||||
MouseCallback : Pointer; { Mouse call back ptr }
|
MouseCallback : Pointer; { Mouse call back ptr }
|
||||||
|
UnderNT: boolean;
|
||||||
{$ifdef DEBUG}
|
{$ifdef DEBUG}
|
||||||
EntryEDI,EntryESI : longint;
|
EntryEDI,EntryESI : longint;
|
||||||
EntryDS,EntryES : word;
|
EntryDS,EntryES : word;
|
||||||
@ -188,6 +189,57 @@ ASM
|
|||||||
IRET; { Interrupt return }
|
IRET; { Interrupt return }
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
PROCEDURE Mouse_Trap_NT; ASSEMBLER;
|
||||||
|
ASM
|
||||||
|
PUSH %ES; { Save ES register }
|
||||||
|
PUSH %DS; { Save DS register }
|
||||||
|
PUSHL %EDI; { Save register }
|
||||||
|
PUSHL %ESI; { Save register }
|
||||||
|
{ ; caution : ds is not the selector for our data !! }
|
||||||
|
{$ifdef DEBUG}
|
||||||
|
MOVL %EDI,%ES:EntryEDI
|
||||||
|
MOVL %ESI,%ES:EntryESI
|
||||||
|
MOVW %DS,%AX
|
||||||
|
MOVW %AX,%ES:EntryDS
|
||||||
|
MOVW %ES,%AX
|
||||||
|
MOVW %AX,%ES:EntryES
|
||||||
|
{$endif DEBUG}
|
||||||
|
{ movw %cs:v2prt0_ds_alias,%ax v2prt0 is not locked !!
|
||||||
|
movw %ax,%ds
|
||||||
|
movw %ax,%es }
|
||||||
|
PUSH %ES; { Push data seg }
|
||||||
|
POP %DS; { Load data seg }
|
||||||
|
{$ifdef DEBUG}
|
||||||
|
incl callcounter
|
||||||
|
CMPL $ACTIONREGS,%edi
|
||||||
|
JE .L_ActionRegsOK
|
||||||
|
INCL MouseError
|
||||||
|
JMP .L_NoCallBack
|
||||||
|
.L_ActionRegsOK:
|
||||||
|
{$endif DEBUG}
|
||||||
|
MOVL MOUSECALLBACK, %EAX; { Fetch callback addr }
|
||||||
|
CMPL $0, %EAX; { Check for nil ptr }
|
||||||
|
JZ .L_NoCallBack; { Ignore if nil }
|
||||||
|
MOVL %EDI,%EAX; { %EAX = @actionregs }
|
||||||
|
MOVL (%EAX), %EDI; { EDI from actionregs }
|
||||||
|
MOVL 4(%EAX), %ESI; { ESI from actionregs }
|
||||||
|
MOVL 16(%EAX), %EBX; { EBX from actionregs }
|
||||||
|
MOVL 20(%EAX), %EDX; { EDX from actionregs }
|
||||||
|
MOVL 24(%EAX), %ECX; { ECX from actionregs }
|
||||||
|
MOVL 28(%EAX), %EAX; { EAX from actionregs }
|
||||||
|
CALL *MOUSECALLBACK; { Call callback proc }
|
||||||
|
.L_NoCallBack:
|
||||||
|
POPL %ESI; { Recover register }
|
||||||
|
POPL %EDI; { Recover register }
|
||||||
|
POP %DS; { Restore DS register }
|
||||||
|
POP %ES; { Restore ES register }
|
||||||
|
movzwl %si,%eax
|
||||||
|
MOVL %ds:(%Eax), %EAX;
|
||||||
|
MOVL %EAX, %ES:42(%EDI); { Set as return addr }
|
||||||
|
ADDW $4, %ES:46(%EDI); { adjust stack }
|
||||||
|
IRET; { Interrupt return }
|
||||||
|
END;
|
||||||
|
|
||||||
Function Allocate_mouse_bridge : boolean;
|
Function Allocate_mouse_bridge : boolean;
|
||||||
var
|
var
|
||||||
error : word;
|
error : word;
|
||||||
@ -195,6 +247,10 @@ begin
|
|||||||
ASM
|
ASM
|
||||||
LEAL ACTIONREGS, %EDI; { Addr of actionregs }
|
LEAL ACTIONREGS, %EDI; { Addr of actionregs }
|
||||||
LEAL MOUSE_TRAP, %ESI; { Procedure address }
|
LEAL MOUSE_TRAP, %ESI; { Procedure address }
|
||||||
|
CMPB $0, UnderNT
|
||||||
|
JZ .LGo32
|
||||||
|
LEAL MOUSE_TRAP_NT, %ESI; { Procedure address }
|
||||||
|
.LGo32:
|
||||||
PUSH %DS; { Save DS segment }
|
PUSH %DS; { Save DS segment }
|
||||||
PUSH %ES; { Save ES segment }
|
PUSH %ES; { Save ES segment }
|
||||||
MOVW v2prt0_ds_alias,%ES; { ES now has dataseg alias that is never invalid }
|
MOVW v2prt0_ds_alias,%ES; { ES now has dataseg alias that is never invalid }
|
||||||
@ -305,6 +361,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
FirstMouseInitDone:=false;
|
FirstMouseInitDone:=false;
|
||||||
Unlock_Code(Pointer(@Mouse_Trap), 400); { Release trap code }
|
Unlock_Code(Pointer(@Mouse_Trap), 400); { Release trap code }
|
||||||
|
Unlock_Code(Pointer(@Mouse_Trap_NT), 400); { Release trap code }
|
||||||
Unlock_Code(Pointer(@MouseInt), 400); { Lock MouseInt code }
|
Unlock_Code(Pointer(@MouseInt), 400); { Lock MouseInt code }
|
||||||
Unlock_Data(ActionRegs, SizeOf(TRealRegs)); { Release registers }
|
Unlock_Data(ActionRegs, SizeOf(TRealRegs)); { Release registers }
|
||||||
UnLock_Data(MouseCallBack,SizeOf(Pointer));
|
UnLock_Data(MouseCallBack,SizeOf(Pointer));
|
||||||
@ -335,9 +392,18 @@ begin
|
|||||||
Release_mouse_bridge;
|
Release_mouse_bridge;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function RunningUnderWINNT: boolean;
|
||||||
|
var r: trealregs;
|
||||||
|
begin
|
||||||
|
fillchar(r,sizeof(r),0);
|
||||||
|
r.ax:=$3306;
|
||||||
|
realintr($21,r);
|
||||||
|
RunningUnderWINNT:=(r.bx=$3205);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure InitMouse;
|
procedure InitMouse;
|
||||||
begin
|
begin
|
||||||
|
UnderNT:=RunningUnderWINNT;
|
||||||
if not MousePresent then
|
if not MousePresent then
|
||||||
begin
|
begin
|
||||||
if DetectMouse=0 then
|
if DetectMouse=0 then
|
||||||
@ -360,6 +426,7 @@ begin
|
|||||||
StoredExit:=ExitProc;
|
StoredExit:=ExitProc;
|
||||||
ExitProc:=@MouseSafeExit;
|
ExitProc:=@MouseSafeExit;
|
||||||
Lock_Code(Pointer(@Mouse_Trap), 400); { Lock trap code }
|
Lock_Code(Pointer(@Mouse_Trap), 400); { Lock trap code }
|
||||||
|
Lock_Code(Pointer(@Mouse_Trap_NT), 400); { Lock trap code }
|
||||||
Lock_Code(Pointer(@MouseInt), 400); { Lock MouseInt code }
|
Lock_Code(Pointer(@MouseInt), 400); { Lock MouseInt code }
|
||||||
Lock_Data(ActionRegs, SizeOf(TRealRegs)); { Lock registers }
|
Lock_Data(ActionRegs, SizeOf(TRealRegs)); { Lock registers }
|
||||||
Lock_Data(MouseCallBack, SizeOf(pointer));
|
Lock_Data(MouseCallBack, SizeOf(pointer));
|
||||||
@ -642,7 +709,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2000-07-13 11:32:24 michael
|
Revision 1.3 2000-08-16 18:51:57 peter
|
||||||
|
* Fixes from Gabor (merged)
|
||||||
|
|
||||||
|
Revision 1.2 2000/07/13 11:32:24 michael
|
||||||
+ removed logs
|
+ removed logs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,33 @@ begin
|
|||||||
realintr($10,regs);
|
realintr($10,regs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function BIOSGetScreenMode(var Cols,Rows: word; var Color: boolean): boolean;
|
||||||
|
var r: trealregs;
|
||||||
|
L: longint;
|
||||||
|
LSel,LSeg: word;
|
||||||
|
B: array[0..63] of byte;
|
||||||
|
type TWord = word; PWord = ^TWord;
|
||||||
|
var Size: word;
|
||||||
|
OK: boolean;
|
||||||
|
begin
|
||||||
|
L:=global_dos_alloc(64);
|
||||||
|
LSeg:=(L shr 16);
|
||||||
|
LSel:=(L and $ffff);
|
||||||
|
|
||||||
|
r.ah:=$1b; r.bx:=0;
|
||||||
|
r.es:=LSeg; r.di:=0;
|
||||||
|
realintr($10,r);
|
||||||
|
OK:=(r.al=$1b);
|
||||||
|
if OK then
|
||||||
|
begin
|
||||||
|
dpmi_dosmemget(LSeg,0,B,64);
|
||||||
|
Cols:=PWord(@B[5])^; Rows:=B[$22];
|
||||||
|
Color:=PWord(@B[$27])^<>0;
|
||||||
|
end;
|
||||||
|
global_dos_free(LSel);
|
||||||
|
BIOSGetScreenMode:=OK;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure InitVideo;
|
procedure InitVideo;
|
||||||
var
|
var
|
||||||
regs : trealregs;
|
regs : trealregs;
|
||||||
@ -54,6 +81,7 @@ begin
|
|||||||
regs.bx:=0;
|
regs.bx:=0;
|
||||||
realintr($10,regs);
|
realintr($10,regs);
|
||||||
ScreenHeight:=regs.dl+1;
|
ScreenHeight:=regs.dl+1;
|
||||||
|
BIOSGetScreenMode(ScreenWidth,ScreenHeight,ScreenColor);
|
||||||
end;
|
end;
|
||||||
regs.ah:=$03;
|
regs.ah:=$03;
|
||||||
regs.bh:=0;
|
regs.bh:=0;
|
||||||
@ -75,7 +103,6 @@ begin
|
|||||||
SetCursorType(LastCursorType);
|
SetCursorType(LastCursorType);
|
||||||
{ ClearScreen; removed here
|
{ ClearScreen; removed here
|
||||||
to be able to catch the content of the monitor }
|
to be able to catch the content of the monitor }
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +293,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2000-07-13 11:32:24 michael
|
Revision 1.3 2000-08-16 18:51:57 peter
|
||||||
|
* Fixes from Gabor (merged)
|
||||||
|
|
||||||
|
Revision 1.2 2000/07/13 11:32:24 michael
|
||||||
+ removed logs
|
+ removed logs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user