Question: I need help to get the input from the keypad using the in built MARS ( MIPS ) tool Digital lab sim. I cannot get

I need help to get the input from the keypad using the in built MARS (MIPS) tool Digital lab sim. I cannot get my scan function working. Here is the skeleton code so far: .text # Start generating instructions
.globl start # This label should be globally known
start:
li $t0,0xFFFF0010 # Load location of number pad scan register (aligned to word boundary)
li $t1,0xFFFF0014 # Load location of number pad value register
li $t2,0x10010000 # Load base memory address of input values array
li $t3,0xFFFF0010 # Load location of seven seg display (aligned to word boundary)
li $t4,0x10010010 # Load base memory address of 7-seg values array
li $a0,0xa # Initialise value to write to display
jal draw_num # Call the draw_num function using 'jump and link'
scan:
# Load the value of the number pad scan register into $t5
lw $t5,0($t0)
decode_input:
draw_num:
add $t5, $t4, $a0 # Calculate address of element in array to access
lbu $t6,0($t5) # Load decoder value byte from memory into $t6
sb $t6,0($t3) # Write decoder value to seven segment display
jr $ra # Return from function using 'jump register' and $ra
end:
b end # End at infinite loop
.data # Items below this line will be stored in the
# .data section of memory
# Store the listed value(s) as 8-bit values at the next available locations
.byte 0x11,0x21,0x41,0x81,0x12,0x22,0x42,0x82,0x14,0x24,0x44,0x84,0x18,0x28,0x48,0x88
.byte 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!