I am trying to store the number of times a user of a program ive written clicks the 'left' or 'right' mouse button. To see whether or not the user presses a mouse button I am using the following code:
PROGRAM Mouze;
USES Crt;
VAR MouseX, MouseY: Word;
MouseB: Byte;
key: char;
PROCEDURE GetMouse(VAR MouseX, MouseY : Word; VAR MouseB : Byte); Assembler;
ASM
Mov Ax, $0003 { Function 3 = Get Mouse X,Y & Buttons }
Int $33 { Int $33 = Mouse Functions }
Shr Cx, 1 { Divide MouseX by 2 }
Les Di, MouseX { ES:DI = @MouseX }
Mov Es:[Di], Cx { MouseX is returned as 0-639, I want 0-319 }
Les Di, MouseY { ES:DI = @MouseY }
Mov Es:[Di], Dx { MouseY is returned as 0-199 }
Les Di, MouseB { ES:DI = @MouseB }
Mov Es:[Di], Bl { Mouse Buttons }
End;
BEGIN
begin
repeat
GetMouse(MouseX, MouseY, MouseB); { Sets the variables }
GotoXY(1, 1);
writeln(MouseX, MouseY); { Uses the location }
until MouseB > 0; { Checks if the user clicks to end the program }
end;
END.
Now Ive integrated this code into a larger program which is probably too much of a hassle to post here. Part of this program is designed to store anything the user puts into the computer (ie the mouse click) and stores this in a .DAT file. Part of the code I use to store anything in these DAT files requires me to assign "MouseB" to "Answer[runs]" Answer[runs]:=MouseB;
Pascal will not accept this calling it a type mismatch... What do I need to change???