-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added math.lerpw() a LERP routine for words (to complement the existing math.lerp() for bytes) Described the LERP routines in the library chapter in the docs.
- Loading branch information
Showing
4 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
%import math | ||
%import textio | ||
%option no_sysinit | ||
%zeropage basicsafe | ||
|
||
main { | ||
sub start() { | ||
defer initial() | ||
if allocate() { | ||
txt.print("1") | ||
defer deallocate() | ||
txt.print("2") | ||
return | ||
} | ||
txt.print("3") | ||
} | ||
|
||
sub allocate() -> bool { | ||
txt.print("allocate\n") | ||
return true | ||
} | ||
uword v0 = 4000 | ||
uword v1 = 60000 | ||
|
||
sub initial() { | ||
txt.print("initial\n") | ||
} | ||
sub deallocate() { | ||
txt.print("deallocate\n") | ||
for cx16.r1 in 65400 to 65535 { | ||
txt.print_uw(cx16.r1) | ||
txt.spc() | ||
txt.spc() | ||
txt.print_uw(math.lerpw(v0, v1, cx16.r1)) | ||
txt.nl() | ||
} | ||
} | ||
} |