ps6pr5.txt - ps6pr5(Problem Set 6 Problem 5 Computing a...

This preview shows page 1 out of 1 page.

# # ps6pr5.txt (Problem Set 6, Problem 5) # # Computing a power using recursion. # 00 read r1 # get # from user and store it in r1 01 read r2 # get # from user and store it in r2 02 setn r15 100 # Set r15= 100 03 call r14 07 # copy the next address into r14 and then jump to line 07 04 write r13 # print contents of register r13 05 halt # stop 06 nop 07 jnez r2 10 # if r2 !=0, then jump to line 10 08 setn r13 1 # Set register r13 to the integer 1 09 jumpr r14 # Set program counter to address in r14 10 addn r15 1 # add integer 1 to register r15 11 storer r1 r15 # store contents of register r1 into memory address location in r15 12 addn r15 1

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture