You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,13 @@ What does Prog8 provide?
33
33
- conditional branches
34
34
- floating point operations (requires the C64 Basic ROM routines for this)
35
35
- 'when' statement to provide a concise jump table alternative to if/elseif chains
36
-
- many built-in functions such as ``sin``, ``cos``, ``rnd``, ``abs``, ``min``, ``max``, ``sqrt``, ``msb``, ``rol``, ``ror``, ``swap``, ``memset``, ``memcopy``, ``sort`` and ``reverse``
37
36
- structs to group together sets of variables and manipulate them at once
37
+
- many built-in functions such as ``sin``, ``cos``, ``rnd``, ``abs``, ``min``, ``max``, ``sqrt``, ``msb``, ``rol``, ``ror``, ``swap``, ``sort`` and ``reverse``
38
+
- various powerful built-in libraries to do I/O, number conversions, graphics and more
38
39
- convenience abstractions for low level aspects such as ZeroPage handling, program startup, explicit memory addresses
39
40
- fast execution speed due to compilation to native assembly code
40
41
- inline assembly allows you to have full control when every cycle or byte matters
41
-
- supports the sixteen 'virtual' 16-bit registers R0 .. R15 from the Commander X16, also on the C64.
42
+
- supports the sixteen 'virtual' 16-bit registers R0 .. R15 from the Commander X16, and provides them also on the C64.
42
43
43
44
*Rapid edit-compile-run-debug cycle:*
44
45
@@ -49,8 +50,8 @@ What does Prog8 provide?
49
50
50
51
*Two supported compiler targets* (contributions to improve these or to add support for other machines are welcome!):
51
52
52
-
- "c64": Commodore-64 (6510 CPU = almost a 6502), the main target.
- If you only use standard kernel and prog8 library routines, it is possible to compile the *exact same program* for both machines (just change the compiler target flag)!
55
56
56
57
@@ -85,9 +86,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
85
86
ubyte candidate_prime = 2 ; is increased in the loop
86
87
87
88
sub start() {
88
-
; clear the sieve, to reset starting situation on subsequent runs
89
-
memset(sieve, 256, false)
90
-
; calculate primes
89
+
sys.memset(sieve, 256, false) ; clear the sieve
91
90
txt.print("prime numbers up to 255:\n\n")
92
91
ubyte amount=0
93
92
repeat {
@@ -98,17 +97,17 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
98
97
txt.print(", ")
99
98
amount++
100
99
}
101
-
txt.chrout('\n')
100
+
txt.nl()
102
101
txt.print("number of primes (expected 54): ")
103
102
txt.print_ub(amount)
104
-
txt.chrout('\n')
103
+
txt.nl()
105
104
}
106
105
107
106
sub find_next_prime() -> ubyte {
108
107
while sieve[candidate_prime] {
109
108
candidate_prime++
110
109
if candidate_prime==0
111
-
return 0 ; we wrapped; no more primes available in the sieve
110
+
return 0 ; we wrapped; no more primes
112
111
}
113
112
114
113
; found next one, mark the multiples and return it.
@@ -125,6 +124,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
0 commit comments