Create a bio.s program of your own that tells me a little about yourself. Make s
ID: 3781549 • Letter: C
Question
Create a bio.s program of your own that tells me a little about yourself. Make sure that your program is documented using a style similar to that used in hello.s. Submit a separate file called bio.s a.
Here is what bio.s output should look like:
My name is John Smith
I was born in Seattle, Washington
I am a expert swimmer at Swimletics
I enjoy movies, dancing and water sports
Here's an example of hello.s which bio.s should be similar to.
# John Smith -- 01/01/10
# hello.s -- a traditional "Hello World" first program
# Register use:
# $v0 syscall parameter and return value
# $a0 syscall parameter .text
.globl main
main:
la $a0, msg # address of "Hello World" message
li $v0, 4 # this is the print_string option
syscall # perform the system call
li $v0, 10 # this is the exit option
syscall # perform the system call
# Here is the data for the program
.data
msg: .asciiz "Hello World "
# end hello.s
Explanation / Answer
.globl main
main:
la $a0, msg # address of "Name" message
li $v0, 4 # this is the print_string option
syscall # perform the system call
li $v0, 10 # this is the exit option
syscall # perform the system call
la $a0, msg1 # address of "born place" message
li $v0, 4 # this is the print_string option
syscall # perform the system call
li $v0, 10 # this is the exit option
syscall # perform the system call
la $a0, msg2 # address of "Expert at" message
li $v0, 4 # this is the print_string option
syscall # perform the system call
li $v0, 10 # this is the exit option
syscall # perform the system call
la $a0, msg3 # address of "Enjoys doing" message
li $v0, 4 # this is the print_string option
syscall # perform the system call
li $v0, 10 # this is the exit option
syscall # perform the system call
# Here is the data for the program
.data
msg: .asciiz "My name is John Smith "
msg1: .asciiz "I was born in Seattle, Washington "
msg2: .asciiz "I am a expert swimmer at Swimletics "
msg3: .asciiz "I enjoy movies, dancing and water sports "