10

Assuming that R0 is a constant zero, as in the example in the last tutorial (I'll also accept CLR Rn) (also, various spellings of "MOV#" are fine, and I'll also accept an immediate add instruction):

      MOV# 1001, R1
      MOV# 1, R2
      ADD R0, R0, R3   ; (R3 <- 0)
LOOP: SUB R1, R2, R1
      BGT LOOP
      ADD R3, R1, R3   ; (delayed branch slot)
      HALT
The result will be in R3.


[exam] [main course page]