In: Computer Science
7) Write a program to open an input dialog box and read a string
value. Write the string back to
the user using a message box.
USING MIPS ASSEMBLY LANGUAGE
# Code:
.data
# prompt message for user
prompt: .asciiz "Please write a string: "
# space to store user response
userResponse: .space 100
.text
.globl main
main:
# Getting user input in dialog box
la $a0, prompt # loads address of the prompt
message
la $a1, userResponse # loads address of the
space
li $a2, 100 # the limit of user response
li $v0, 54 # syscall code for
InputDialogBox
syscall
# Printing the string back on message box
la $a0, userResponse # address of string to be
displayed
li $a1, 1 # type of message 1 means
"Informational message"
li $v0, 55 # syscall code for
messageBox
syscall
# Exit the program
li $v0, 10
syscall
OUTPUT:
# Input Box
# Output box