Re: Contest #2... Example Programs
- Posted by PeteE Dec 09, 2010
- 3038 views
201 r0=1 *** count to 100 *** 215 r1=5 611 r1+=r1 (10) 711 r1*=r1 (100) 901 [r1]=r0 (1) 236 r3=6 (address of next line) ?0 ? r0 990 [r0]=r9 (0) 301 r0+=1 821 r2=[r1] 032 goto r3 if r2 100 halt
201 r0=1 *** print fibonacci sequence *** 215 r1=5 711 r1*=r1 (25) 901 [r1]=r0 (1) 240 r4=0 251 r5=1 ?5 ? r5 237 r3=8 (address of next line) 564 r6=r4 665 r6+=r5 ?6 ? r6 545 r4=r5 556 r5=r6 990 [r0]=r9 (0) 301 r0+=1 821 r2=[r1] 032 goto r3 if r2edit: Dec 11
866 r6=[r6] (-1) *** primes up to 1000 *** 278 r7=8 475 r7*=5 (40) 475 r7*=5 (200) 475 r7*=5 (1000) 776 r7*=r6 (-1000) 202 r0=2 (2 is first prime) 810 r1=[r0] (is prime when r1=0) 295 r9=5 494 r9*=4 (20) 091 if r1 not_prime ?0 (print prime) 530 r3=r0 (init counter) 540 r4=r0 (init index) 341 r4+=1 554 r5=r4 (label2:) 657 r5+=r7 (subtract 1000) 299 r9=9 493 r9*=3 (27) 095 if r5 label3 301 r0+=1 550 r5=r0 657 r5+=r7 (subtract 1000) 297 r9=7 095 if r5 main_loop 100 halt 300 nop 636 r3+=r6 (subtract 1) 299 r9=9 398 r9+=8 (17) 492 r9*=2 (34) 093 if r3 label4 904 [r4]=r0 (write nonzero to ram) 530 r3=r0 (reset counter) 341 r4+=1 295 r9=5 493 r9*=3 (15) 094 if r4 label2