#reverse10.sim5 - input 10 integers and output them in reverse order 000 5010 start: lda 10 for (%r0=10;%r0!=0;%r0--) { 001 8001 inloop: in %r1 %r1 = input() 002 8801 push %r1 push(%r1) 003 8400 dec %r0 004 7100 skeq %r0 005 6001 jmp inloop } 006 5010 lda 10 for (%r0=10;%r0!=0;%r0--) { 007 8901 outloop: pop %r1 %r1 = pop() 008 8101 out %r1 output(%r1) 009 8400 dec %r0 010 7100 skeq %r0 011 6007 jmp outloop } 012 0000 halt return; 000 .end start 1 2 3 4 5 6 7 8 9 10