# Initialize any registers you will be using here. li $s0, 0xf0000000 # Command Register UART li $s1, 0x1 # mask for bit 0 li $s2, 0x2 # mask for bit 1 li $s3, 0x0030 # number 0
# It can be helpful to include a comment about a register's purpose
# next to an initialization at the start of the program for reference.
main: # TODO: write your primary program within this loop
new_input: li $t1, 0xA # new line call put_char_p3 li $a1, 1 li $v0, 0 # cross reference for invalid character li $v1, 0 # store string new_char: jal get-character # the new character is saved in $t1 nop beq $v0, $zero, Character-check
continue-print: li $t0, 59 # if the new bit is a semicolon, print the existing number …show more content…
beq $t1, $t0, print_number nop li $t0, 48 subu $t1, $t1, $t0 andi $t1,$t1, 0x0f sll $v1, $v1, 4 or $v1, $v1, $t1 j new_char nop return
get-character: lw $t0, 4($s0) # load UART Status Register and $t0, $t0, $s2 # mask for ready bit bne $t0, $s2, get-character nop lw $t1, 8($s0) # load Recieve Buffer sw $s2, 0($s0) # clear command register jr $ra print_number: # displays numbers on UART move $a1, $v0 call project3_print bne $v0, $zero, new_input nop andi $a1, $v1,