Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. CmdPrint
  2. add R4,R1,R0 ; R6 := p
  3. load R4,1[R4] ; p := p.next
  4.  
  5. PrintLoop
  6. cmp R4,R0 ; compares p to nil
  7. jumpeq PrintDone[R0] ; if p = nil then goto PrintDone
  8. load R1,0[R4] ; R1 := p
  9.  
  10. store R14,1[R14] ; point to current frame
  11. lea R14,1[R14] ; push stack frame
  12. jal R13,WriteValChar[R0] ; writes a character
  13.  
  14. store R14,1[R14] ; point to current frame
  15. lea R14,1[R14] ; push stack frame
  16. jal R13,WriteSpace[R0] ; writes a space
  17.  
  18. load R4,1[R4] ; ; p := p.next
  19. jump PrintLoop[R0] ; go back to the start of loop
  20.  
  21. PrintDone
  22. store R14,1[R14] ; point to current frame
  23. lea R14,1[R14] ; push stack frame
  24. jal R13,WriteNewLine[R0] ; writes new line
  25.  
  26. jump CmdDone[R0] ; go to finish command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement