fix sieve example

This commit is contained in:
Irmen de Jong 2024-04-18 22:22:29 +02:00
parent 054b4636e0
commit a1ebc7090d
3 changed files with 3 additions and 6 deletions

View File

@ -119,7 +119,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
%import textio %import textio
%zeropage basicsafe %zeropage basicsafe
main { main {
bool[256] sieve bool[256] sieve
ubyte candidate_prime = 2 ; is increased in the loop ubyte candidate_prime = 2 ; is increased in the loop

View File

@ -120,7 +120,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
%zeropage basicsafe %zeropage basicsafe
main { main {
ubyte[256] sieve bool[256] sieve
ubyte candidate_prime = 2 ; is increased in the loop ubyte candidate_prime = 2 ; is increased in the loop
sub start() { sub start() {

View File

@ -4,12 +4,11 @@
; Note: this program can be compiled for multiple target systems. ; Note: this program can be compiled for multiple target systems.
main { main {
bool[256] sieve bool[256] sieve
ubyte candidate_prime = 2 ; is increased in the loop ubyte candidate_prime = 2 ; is increased in the loop
sub start() { sub start() {
sys.memset(sieve, 256, 0) ; clear the sieve, to reset starting situation on subsequent runs sys.memset(sieve, 256, 0) ; clear the sieve
; calculate primes ; calculate primes
txt.print("prime numbers up to 255:\n\n") txt.print("prime numbers up to 255:\n\n")
@ -26,8 +25,6 @@ main {
txt.print("number of primes (expected 54): ") txt.print("number of primes (expected 54): ")
txt.print_ub(amount) txt.print_ub(amount)
txt.nl() txt.nl()
; test_stack.test()
} }