ssDimensionss 0 Newbie Poster

ok i know this is the command for reading an integer but where does it read the integer from? I got a factorial program, heres the beginning of it:

.data
prompt: .asciiz "you want n! for which value of n?\n"
.align 4
n: .space4
i: .word 1
fact: .word 1

.text
.globl main

main:
li $v0, 4  #syscall code: print string
la $a0, prompt
syscall
li $v0, 5  #syscall code: read int
syscall
sw $v0, n

from my understanding, the program is meant to prompt u for a number and u enter a number and then the read int function will read tht integer and store it to address n. But how do i enter this number? i tried running this on SPIM(simulator for MIPS) and it just came out with a 0 everytime because apparently the read int is reading a 0?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.