Skip to content

Commit

Permalink
fix sieve example
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Apr 18, 2024
1 parent 054b463 commit a1ebc70
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 1 addition & 4 deletions examples/primes.p8
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -26,8 +25,6 @@ main {
txt.print("number of primes (expected 54): ")
txt.print_ub(amount)
txt.nl()

; test_stack.test()
}


Expand Down

0 comments on commit a1ebc70

Please sign in to comment.