
; Asks user for number to be entered, adds 3 and displays to the output

	.data
title:  .asciiz "Please enter a number n = "

CONTROL: .word32 0x10000
DATA:    .word32 0x10008

	.text
main:
     
	lwu r21,CONTROL(r0)	; specifying the control register for I/O
        lwu r22,DATA(r0)	; specifying the data register for I/O

				; ascii output to screen

	daddi r24,r0,4		; Set DATA to address of string to be output
        daddi r1,r0,title	; adding the address of "title" into r1 register   
        sd r1,(r22)		; r1 to output 
        sd r24,(r21)		; to screen

				; read the input variable

	daddi r24,r0,8		; read the DATA (either an integer or a floating-point) from the keyboard
        sd r24,(r21)		; from screen
        ld r1,(r22)		; from input into r1 to be used for computation

				; some simple computation, num = num + 3

	daddi r10,r1,3

				; integer output

        daddi r24,r0,1		; Set DATA to Unsigned Integer to be output
        sd r10,(r22)		; storing the content of r10 into data register
        sd r24,(r21)		; to screen
	
	halt