Skip to content

Instantly share code, notes, and snippets.

@codl
Last active July 28, 2017 21:42
Show Gist options
  • Save codl/d134074e09da58aa70bb54e4b4015cb1 to your computer and use it in GitHub Desktop.
Save codl/d134074e09da58aa70bb54e4b4015cb1 to your computer and use it in GitHub Desktop.
let pico8_gpio = Array(128);
(() => {
let clock_start = Date.now();
function update_clock(){
let t = Date.now() - clock_start;
for(let i = 0; i < 6; i++){
pico8_gpio[i] = Math.floor(((t / 100) % Math.pow(256, i+1)) / Math.pow(256, i))
}
requestAnimationFrame(update_clock);
}
update_clock();
})();

demo

clicky

usage

in your cart

peek(0x5f80)
peek(0x5f81)
# ... thru
peek(0x5f85)
# will have the values you crave

in your export

put

<script src="https://cdn.rawgit.com/codl/d134074e09da58aa70bb54e4b4015cb1/raw/0d99aeb20591ceed0b097644b161634c2e824f0a/pico8-rtc.js"></script>

in your html file

or download pico8-rtc.js above and put

<script src="pico8-rtc.js"></script>

in your html file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment