Answered step by step
Verified Expert Solution
Link Copied!

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 2). 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 I'm getting stuck. I would love if you could help me with the draw_cursor function and heko me start the others but I am only providing the outline for draw_cursor so that is the only one i need help with in full Please helpThere are two variables for getting the mouse position:
display_mouse_x
display_mouse_y
If you lw from them, you will get the coordinates of the mouse measured from the top-left of the display. Both x and Y
range 0,127. However, if the mouse cursor is outside of the display, both variables will instead be -1. You only have
to check one: either they're both -1 or neither is.
There is a minor bug that happens when you click and drag on the display, which allows the display_mouse_x/y
variables to go outside the range 0,127 if you drag the cursor off the edges of the display. I'm not 100% 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, display_mouse_pressed # get the state of buttons
and t0, t0, MOUSE_LBUTTON # use bitwise AND to extract just the left button
beq t0,0,_endif_lbutton #0 means not pressed, not-0 means pressedThere are two variables for getting the mouse position:
display_mouse_x
display_mouse_y
If you lw from them, you will get the coordinates of the mouse measured from the top-left of the display. Both x and Y
range 0,127. However, if the mouse cursor is outside of the display, both variables will instead be -1. You only have
to check one: either they're both -1 or neither is.
There is a minor bug that happens when you click and drag on the display, which allows the display_mouse_x/y
variables to go outside the range 0,127 if you drag the cursor off the edges of the display. I'm not 100% 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, display_mouse_pressed # get the state of buttons
and t0, t0, MOUSE_LBUTTON # use bitwise AND to extract just the left button
beq t0,0,_endif_lbutton #0 means not pressed, not-0 means pressed
# here, the left mouse button is pressed. respond to it!
_endif_lbutton:
The mouse button variables are:
display_mouse_pressed - to check if a button went from not-held to held this frame (just pressed it)
display_mouse_held - to check if a button is being held down or not
display_mouse_released - to check if a button went from held to not-held this frame (just let go)
And the constants you use in the bitwise AND are:
MOUSE_LBUTTON - left button (trackpad normal click)
MOUSE_RBUTTON - right button (trackpad two-finger click or bottom-right click)
MOUSE_MBUTTON - middle button (scroll wheel click; trackpad three-finger click sometimes)
# here, the left mouse button is pressed. respond to it!
_endif_lbutton:
The mouse button variables are:
display_mouse_pressed - to check if a button went from not-held to held this frame (just pressed it)
display_mouse_held - to check if a button is being held down or not
display_mouse_released - to check if a button went from held to not-held this frame (just let go)
And the constants you use in the bitwise AND are:
MOUSE_LBUTTON - left button (trackpad normal click)
MOUSE_RBUTTON - right button (trackpad two-finger click or bottom-right click)
MOUSE_MBUTTON - middle button (scroll wheel click; trackpad three-finger click sometimes)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data And Hadoop Fundamentals Tools And Techniques For Data Driven Success

Authors: Mayank Bhushan

2nd Edition

9355516665, 978-9355516664

More Books

Students also viewed these Databases questions

Question

Give five examples of items which are liabilities?

Answered: 1 week ago

Question

4. Describe the training and development process C)-cle.

Answered: 1 week ago

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago