Argc and Argv (cont)
Code to print the program's name (argv[0] ):
# assume argc is $s0, argv is $s1
addi $t0, $s1, 0
lw $a0, ($t0)
li $v0, 4
syscall
|
Code to print the first cmd-line arg (argv[1] )
# assume argc is $s0, argv is $s1
addi $t0, $s1, 4
lw $a0, ($t0)
li $v0, 4
syscall
|
|