Created
April 15, 2020 21:29
-
-
Save Crest/67bee2f2a95cfd6e76fec954fb895181 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
: ?# ( d -- d ) 2dup or 0= if bl hold else # then ; | |
: .padded ( n -- ) >r 0 <# r> 0 do ?# loop #> type ; | |
20 1024 * constant ram-size | |
$1FFFF7E0 h@ 1024 * constant flash-size | |
: compiletoram! ( ? -- ) if compiletoram else compiletoflash then ; | |
: flash-free ( -- n ) | |
compiletoram? | |
compiletoflash flash-size here - | |
swap compiletoram! ; | |
: ram-free ( -- n ) | |
compiletoram? compiletoram | |
flashvar-here 1 cells - here - | |
swap compiletoram! ; | |
: .free ( avail free -- ) | |
." Total: " over 6 .padded | |
." Free: " dup 6 .padded | |
." Used: " - 6 .padded ; | |
: .flash-free ( -- ) flash-size flash-free .free ; | |
: .ram-free ( -- ) ram-size ram-free .free ; | |
: free ( -- ) | |
cr | |
." FLASH: " .flash-free cr | |
." RAM: " .ram-free cr ; | |
free |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment