define(a1, 5)
most probably does a simple text substitution, as such add %o1, %a1, %o1
will be assembled as add %o1, %5, %o1
whereby %5
will resolve to register number 5 which is %g5
and not what you want. Solution: just use add %o1, 5, %o1
or give some other symbolic name to the constant and use that without a %
sign. The rest looks about right, except for the extra, but harmless, argument you pass to scanf
(set nl, %o2
).
Hint: saying "urgent" won't get you any faster replies, but providing more details, such as what the exact problem is, could.