Reputation: 9570
The instructions to read and store string input from the keyboard is not clear in MIPS. How is the read string put into the label namespace?
.data
namespace: .space 20
.txt
li $v0,8
la $a0,namespace
li $a1,20
syscall
Upvotes: 0
Views: 177
Reputation: 364532
The kernel can use user-space memory mappings and addresses, and you passed it the address in $a0
. You also passed the buffer length in $a1
, so it knows how many bytes it's allowed to store.
So the kernel gets data from an I/O device and then uses sw
or sb
instructions to store it into the buffer you passed.
(Or if you're using MARS / SPIM, syscall
traps to the interpreter / emulator / simulator code, and isn't running MIPS instructions at all. Unlike a real MIPS machine running Linux or whatever.)
Upvotes: 1