MIPS Assembly Language Code To Use ASCII Values For Name

1.3k Views Asked by At

I am new to MIPS and this assignment is a little confusing for me because the requirement is to calculate the ASCII values of each character in one's name, and to print the name in Last, First format, along with one's student ID number, whose digits must be stored as integers. Here is the question: 1. The digit part of the ID must be printed using the integer-printing system call, the rest must be printed using the single-character-printing system call. 2. The value in $a0 must be calculated based on the old value in $a0, except for loading a value into $a0 at the beginning

Please help me get started with this. Thanks!


.text

main:

jal myLetter

li $v0, 10 

syscall  

myLetter:

li $v0, 4

la $a0, 'A'

syscall  


jal mySecondLetter

li $v0, 10 

syscall  

mySecondLetter:

li $a0, $a0

addi $a0, $a0, 34

sw $a0, $a0

syscall  


jal myThirdLetter

li $v0, 10 

syscall  

myThirdLetter:

li $a0, $a0

addi $a0, $a0, 5

sw $a0, $a0

syscall

jal myFourthLetter

li $v0, 10 

syscall  

myFourthLetter:

li $a0, $a0

addi $a0, $a0, 1

sw $a0, $a0

syscall

jal myFifthLetter

li $v0, 10 

syscall  

myFifthLetter:

li $a0, $a0

addi $a0, $a0, 4

sw $a0, $a0

syscall

jal myCommaOne

li $v0, 10 

syscall  

myCommaOne:

li $a0, $a0

sub $a0, $a0, 65

sw $a0, $a0

syscall

jal mySpace

li $v0, 10 

syscall  

mySpace:

li $a0, $a0

sub $a0, $a0, 12

sw $a0, $a0

syscall

jal myFirstNameLetterOne

li $v0, 10 

syscall  

myFirstNameLetterOne:

li $a0, $a0

addi $a0, $a0, 37

sw $a0, $a0

syscall


jal myFirstNameLetterTwo

li $v0, 10 

syscall  

myFirstNameLetterTwo:

li $a0, $a0

addi $a0, $a0, 49

sw $a0, $a0

syscall


jal myFirstNameLetterThree

li $v0, 10 

syscall  

myFirstNameLetterThree:

li $a0, $a0

sub $a0, $a0, 12

sw $a0, $a0

syscall

jr $ra
0

There are 0 best solutions below