Advertisement
Taschentuch9

finding primes with dcpu-16

Apr 13th, 2012
3,459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   set a,0 ;atmtocheck
  2.   set b, 0  ;current modulo
  3.   set c,100  ; border to check
  4.   set i,1 ;index of tochecking prim
  5.   set j,0 ;number of found prims
  6.   :outerloop add i,1
  7.   set a,i
  8.   :innerloop sub a,1     ;donewithchecking
  9.   ife a,1
  10.   set pc ,donewithchecking
  11.   set b,i
  12.   mod b,a
  13.   ife b,0   ;!isprim()
  14.   set pc, aftersaving
  15.   ifn b,0
  16.   set pc,innerloop
  17.   :donewithchecking set push,i;set [j],i
  18.   add j,1
  19.   :aftersaving
  20.   ;set x, 0xffff
  21.   ;sub x,sp
  22.   ifn j,c
  23.   set pc,outerloop
  24.   :crash set pc, crash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement