Write an Assembly language program titled\"YourLastName_Program1\" that prints o
ID: 3876189 • Letter: W
Question
Write an Assembly language program titled"YourLastName_Program1" that prints out "Hello world", your name, the name of your favorite video game, the name of your favorite film, and the name of your favorite song and the artist(s) who play it. Remember, this course will use the SPIM emulator for MIPS processors. Make sure your programs work on these emulated machines.
My current program below only prints out "Hello World" currently. My assignment is to print four other strings that refer to a video game, film, song, and the artist, each in a different line. No user input is needed; the program should just print the five strings when run, thanks!
# helloworld.s
#
# Print out "Hello World"
.data
msg: .asciiz "Hello World"
.extern foobar 4
.text
.globl main
main: li $v0, 4 # syscall 4 (print_str)
la $a0, msg # argument: string
syscall # print the string
lw $t1, foobar
jr $ra # retrun to caller
Explanation / Answer
Given below is the completed code. Please change the values that are display according to your requirements - your name and your favorites. Hope it was helpful.
# helloworld.s
#
# Print out Name, favorite video game, movie and song
.data
name: .asciiz "My name is John"
game: .asciiz " My favorite video game is Super Mario"
movie: .asciiz " My favorite movie is Home Alone"
song: .asciiz " My favorite song is Heal the World from Dangerous by Michael Jackson"
.text
.globl main
main:
#print name
li $v0, 4 # syscall 4 (print_str)
la $a0, name # argument: string
syscall # print the string
#print video game
li $v0, 4 # syscall 4 (print_str)
la $a0, game # argument: string
syscall # print the string
#print movie
li $v0, 4 # syscall 4 (print_str)
la $a0, movie # argument: string
syscall # print the string
#print song
li $v0, 4 # syscall 4 (print_str)
la $a0, song # argument: string
syscall # print the string
jr $ra # retrun to caller
output
My name is John
My favorite video game is Super Mario
My favorite movie is Home Alone
My favorite song is Heal the World from Dangerous by Michael Jackson
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.