Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CmdPrint
- add R4,R1,R0 ; R6 := p
- load R4,1[R4] ; p := p.next
- PrintLoop
- cmp R4,R0 ; compares p to nil
- jumpeq PrintDone[R0] ; if p = nil then goto PrintDone
- load R1,0[R4] ; R1 := p
- store R14,1[R14] ; point to current frame
- lea R14,1[R14] ; push stack frame
- jal R13,WriteValChar[R0] ; writes a character
- store R14,1[R14] ; point to current frame
- lea R14,1[R14] ; push stack frame
- jal R13,WriteSpace[R0] ; writes a space
- load R4,1[R4] ; ; p := p.next
- jump PrintLoop[R0] ; go back to the start of loop
- PrintDone
- store R14,1[R14] ; point to current frame
- lea R14,1[R14] ; push stack frame
- jal R13,WriteNewLine[R0] ; writes new line
- jump CmdDone[R0] ; go to finish command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement