Advertisement
STANAANDREY

fact rec

Oct 28th, 2024
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         BRA main
  2. main    INP R0
  3.         MOV R1, #1
  4.         PSH {R0, R1}
  5.         MOV R2, PC
  6.         ADD R2, #2
  7.         JMS fact
  8.         OUT R1
  9.         HLT
  10. fact    POP {R0, R1}
  11.         CMP R0, #0
  12.         BEQ doneFact
  13.         MUL R1, R0
  14.         SUB R0, #1
  15.         PSH {R0, R1}
  16.         JMS fact
  17. doneFact MOV PC, R2
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement