Received: by NDSUVM1 (Mailer R2.07) id 0342; Tue, 21 Aug 90 21:20:02 CDT
Date:         Tue, 21 Aug 90 22:16:39 EDT
Reply-To:     Apple II List <APPLE2-L@BROWNVM.BITNET>
Sender:       Apple II List <APPLE2-L@BROWNVM.BITNET>
From:         "Comp.Binaries.Apple2 Forwarding" <delaneyg@wnre.aecl.ca>
Subject:      PIDGIN SIEVE
To:           "Steven E. Nelson" <CMDSENPG@UIAMVS.BITNET>
 
Demo Pidgin program
 
 
;
; Sieve benchmark
;
 
top;
 
byte FL(10001);
 
int IIN;
byte NU;
int ICO;
int IPR;
int IRE;
 
byte AA;
byte CR;
int ITH;
byte TN;
int ISI;
byte ZE;
 
byte SP;
 
;
; main code
;
 
beginmain(AC,IAV);
 
    CR=+013;
    SP=+032;
 
    ZE=+000;
 
    ITH=+00003;
    TN=+010;
    ISI=+10000;
 
    ms 'Sieve x 1'
    ms '0...     '
    write CR;
 
    NU=+255;
        while;
            NU++;
            AA=NU<!TN;
        on AA;
 
            ICO=+00000;             Set number of primes to zero
 
            IIN=+00000;
                while;              Clear flags array to one
                    IIN++;
                    AA=IIN<=ISI;
                on AA;
                    FL(IIN)=+001;
                endwhile;
 
            IIN=+00000;
                while;
                    IIN++;
                    AA=IIN<=ISI;
                on AA;
                    AA=FL(IIN);
                        if AA;
                            IPR=IIN+IIN;
                            IPR=IPR+ITH;
;                            decprt IPR;
;                            write SP;
                            IRE=IIN+IPR;
 
                                while;
                                    AA=IRE<!ISI;
                                on AA;
                                    FL(IRE)=ZE;
                                    IRE=IRE+IPR;
                                endwhile;
 
                            ICO++;
                        endif;
                endwhile;
 
        endwhile;
 
    ms '...done. ';
    write CR;
    decprt ICO;
    ms ' primes. ';
 
endmain;
 
bottom;
 
  
