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
%zeropage basicsafe
main {
bool[256] sieve
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
main {
ubyte[256] sieve
bool[256] sieve
ubyte candidate_prime = 2 ; is increased in the loop
sub start() {

View File

@ -4,12 +4,11 @@
; Note: this program can be compiled for multiple target systems.
main {
bool[256] sieve
ubyte candidate_prime = 2 ; is increased in the loop
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
txt.print("prime numbers up to 255:\n\n")
@ -26,8 +25,6 @@ main {
txt.print("number of primes (expected 54): ")
txt.print_ub(amount)
txt.nl()
; test_stack.test()
}