Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using mouse in assembly

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
HI all,
i am a newbie in this forum..
i had a kinda of weird question...

i wanted to know how to get the mouse to work the way i want in assembly..

i have a program which asks to create a calculator that adds and subtracts, and be able to click on the buttons with the mouse..

i have the calculator drawn, and have kind of figured out how to enable the mouse and click, but how would i get the program to save the number and be able to do the arithmetic when the buttons are clicked??

the restrictions are that the user can enter up to 3 digit for each number, like 345 + 234....

how would i be able to make the program save the numbers and have it know that when i click 345, its saving it as 345 and not 3, 4, 5??

any help would be appreciated...
 
Use a variable.
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Use a variable.

Do something like this:
displaynum=displaynum*10 + clickednum

when the user does a backspace:
displaynum=displaynum/10 "Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Straiph

Assuming you are using DOS you can use the mouse action vector to execute a routine. This routine is supplied with the mouse X,Y and buttons pressed etc.

Using X,Y as a grid reference you can have as many buttons as you like and each executes a different routine.

You need to write a string value to binary convertion routine for when the user presses a function button (finished entering numbers) the number is stored as a binary value.

When a function like '+' is pressed the number should be stored into an array along with its terminating function. When the equals sign is pressed each value in the array is loaded and its terminating function will be performed with the next value and so on with the result displayed in the box. For this you need to write a convert binary to string value routine.

0000:0000:0000:0000h
The people who have nothing to say and say it too loud have little knowledge, It's the quiet ones you need to worry about!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top