FIXME: This needs to be updated. Sorry.
#include "initcode.h" void prim(int max, int startadr) { int prim, teiler, *adr, teilt; adr = (void*) startadr; *adr = 2; for (prim = 3; prim < max; prim += 2) { teiler = 3; teilt = 0; while (teiler * teiler <= prim) { if (prim % teiler == 0) { teilt = 1; teiler = prim; } else { teiler += 2; } } if (teilt == 0) { adr++; *adr = prim; } } } void waitloop( void ) { int i, *ptr; ptr = (void*) (0x0400 - 32); for( i=0;; i++ ) { *(ptr) = i; } } int main(void) { prim(0x400, 0x400); waitloop(); }
Run the applet | Run the editor (via Webstart)