Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help making a program in mips assembly. It is suppoosed to be a drawing program where we use the Keypad and LED Display
I need help making a program in mips assembly. It is suppoosed to be a drawing program where we use the Keypad and LED Display MMIO simulator version The cursor part is really stumping me and chatgpt and all of those other AI chatbots are no hlep because they dont end up working. He have a few files to help us but the flow of the program is where Im getting stuck. I would love if you could help me with the drawcursor function and heko me start the others but I am only providing the outline for drawcursor so that is the only one i need help with in full Please helpThere are two variables for getting the mouse position:
displaymousex
displaymousey
If you from them, you will get the coordinates of the mouse measured from the topleft of the display. Both and
range However, if the mouse cursor is outside of the display, both variables will instead be You only have
to check one: either they're both or neither is
There is a minor bug that happens when you click and drag on the display, which allows the displaymousexy
variables to go outside the range if you drag the cursor off the edges of the display. Im not sure why it
happens, but it's easy to work around. Failing to work around it can cause strange crashes if you aren't careful with what
you do with those invalid coordinates.
For getting the mouse buttons, it works a little differently from keyboard input. Since there are only three buttons, you can
get their state all at once, and use bitwise AND to extract the state of just one. For example:
lw to displaymousepressed # get the state of buttons
and t t MOUSELBUTTON # use bitwise AND to extract just the left button
beq tendiflbutton # means not pressed, not means pressedThere are two variables for getting the mouse position:
displaymousex
displaymousey
If you from them, you will get the coordinates of the mouse measured from the topleft of the display. Both and
range However, if the mouse cursor is outside of the display, both variables will instead be You only have
to check one: either they're both or neither is
There is a minor bug that happens when you click and drag on the display, which allows the displaymousexy
variables to go outside the range if you drag the cursor off the edges of the display. Im not sure why it
happens, but it's easy to work around. Failing to work around it can cause strange crashes if you aren't careful with what
you do with those invalid coordinates.
For getting the mouse buttons, it works a little differently from keyboard input. Since there are only three buttons, you can
get their state all at once, and use bitwise AND to extract the state of just one. For example:
lw to displaymousepressed # get the state of buttons
and t t MOUSELBUTTON # use bitwise AND to extract just the left button
beq tendiflbutton # means not pressed, not means pressed
# here, the left mouse button is pressed. respond to it
endiflbutton:
The mouse button variables are:
displaymousepressed to check if a button went from notheld to held this frame just pressed it
displaymouseheld to check if a button is being held down or not
displaymousereleased to check if a button went from held to notheld this frame just let go
And the constants you use in the bitwise AND are:
MOUSELBUTTON left button trackpad normal click
MOUSERBUTTON right button trackpad twofinger click or bottomright click
MOUSEMBUTTON middle button scroll wheel click; trackpad threefinger click sometimes
# here, the left mouse button is pressed. respond to it
endiflbutton:
The mouse button variables are:
displaymousepressed to check if a button went from notheld to held this frame just pressed it
displaymouseheld to check if a button is being held down or not
displaymousereleased to check if a button went from held to notheld this frame just let go
And the constants you use in the bitwise AND are:
MOUSELBUTTON left button trackpad normal click
MOUSERBUTTON right button trackpad twofinger click or bottomright click
MOUSEMBUTTON middle button scroll wheel click; trackpad threefinger click sometimes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started