mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
Compare commits
20 Commits
v0.2.0-rc1
...
2ce91ef49c
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ce91ef49c | |||
| 7caad08b7c | |||
| 1f6de62e5d | |||
| caeaa82787 | |||
| e0450c9039 | |||
| 95d0d92a6f | |||
| 7a6dd0ab6d | |||
| e7a00dd9c6 | |||
| a02243d98c | |||
| 599873890a | |||
| 8e9bb002bc | |||
| b2b990333e | |||
| d1556f7be8 | |||
| 9f548cd6f0 | |||
| 7cea4eebd3 | |||
| 3f67e92c5c | |||
| a2714f25e4 | |||
| 7e203d93e6 | |||
| e44c87d1f6 | |||
| 614b7cf358 |
192
Cargo.lock
generated
192
Cargo.lock
generated
@@ -26,6 +26,17 @@ dependencies = [
|
||||
"const-random",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
@@ -120,7 +131,7 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"object 0.27.1",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
@@ -294,7 +305,7 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d02796e4586c6c41aeb68eae9bfb4558a522c35f1430c14b40136c3706e09e4"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -434,18 +445,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75"
|
||||
checksum = "2fa7c3188913c2d11a361e0431e135742372a2709a99b103e79758e11a0a797e"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b"
|
||||
checksum = "29285f70fd396a8f64455a15a6e1d390322e4a5f5186de513141313211b0a23e"
|
||||
dependencies = [
|
||||
"cranelift-bforest",
|
||||
"cranelift-codegen-meta",
|
||||
@@ -453,40 +464,40 @@ dependencies = [
|
||||
"cranelift-entity",
|
||||
"gimli",
|
||||
"log",
|
||||
"regalloc",
|
||||
"regalloc2",
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24"
|
||||
checksum = "057eac2f202ec95aebfd8d495e88560ac085f6a415b3c6c28529dc5eb116a141"
|
||||
dependencies = [
|
||||
"cranelift-codegen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc"
|
||||
checksum = "75d93869efd18874a9341cfd8ad66bcb08164e86357a694a0e939d29e87410b9"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf"
|
||||
checksum = "7e34bd7a1fefa902c90a921b36323f17a398b788fa56a75f07a29d83b6e28808"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce"
|
||||
checksum = "457018dd2d6ee300953978f63215b5edf3ae42dbdf8c7c038972f10394599f72"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
@@ -496,9 +507,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-native"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501241b0cdf903412ec9075385ac9f2b1eb18a89044d1538e97fab603231f70c"
|
||||
checksum = "bba027cc41bf1d0eee2ddf16caba2ee1be682d0214520fff0129d2c6557fda89"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"libc",
|
||||
@@ -507,9 +518,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-wasm"
|
||||
version = "0.82.3"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16d9e4211bbc3268042a96dd4de5bd979cda22434991d035f5f8eacba987fad2"
|
||||
checksum = "9b17639ced10b9916c9be120d38c872ea4f9888aa09248568b10056ef0559bfa"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-entity",
|
||||
@@ -517,7 +528,7 @@ dependencies = [
|
||||
"itertools",
|
||||
"log",
|
||||
"smallvec",
|
||||
"wasmparser 0.83.0",
|
||||
"wasmparser 0.84.0",
|
||||
"wasmtime-types",
|
||||
]
|
||||
|
||||
@@ -599,7 +610,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
||||
[[package]]
|
||||
name = "curlywas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=aac7bbd#aac7bbd8786a26da0dcbe8320b1afefaf6086464"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=0e7ea50#0e7ea508cd0e76836283ae68a44c9097df83c8ac"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ariadne",
|
||||
@@ -888,6 +899,15 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fxhash"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.5"
|
||||
@@ -950,6 +970,9 @@ name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
dependencies = [
|
||||
"ahash 0.7.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "headers"
|
||||
@@ -1653,8 +1676,18 @@ name = "object"
|
||||
version = "0.27.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.28.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
]
|
||||
@@ -1985,13 +2018,14 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regalloc"
|
||||
version = "0.0.34"
|
||||
name = "regalloc2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02"
|
||||
checksum = "904196c12c9f55d3aea578613219f493ced8e05b3d0c6a42d11cb4142d8b4879"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"log",
|
||||
"rustc-hash",
|
||||
"slice-group-by",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
@@ -2073,9 +2107,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.33.3"
|
||||
version = "0.33.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9466f25b92a648960ac1042fd3baa6b0bf285e60f754d7e5070770c813a177a"
|
||||
checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
@@ -2253,6 +2287,12 @@ version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
|
||||
|
||||
[[package]]
|
||||
name = "slice-group-by"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.8.0"
|
||||
@@ -2637,7 +2677,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "uw8"
|
||||
version = "0.2.0-rc1"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"anyhow",
|
||||
@@ -2655,6 +2695,7 @@ dependencies = [
|
||||
"wasmtime",
|
||||
"wat",
|
||||
"webbrowser",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2843,6 +2884,15 @@ dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31f0c17267a5ffd6ae3d897589460e21db1673c84fb7016b909c9691369a75ea"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.77.0"
|
||||
@@ -2862,10 +2912,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a"
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime"
|
||||
version = "0.35.3"
|
||||
name = "wasmparser"
|
||||
version = "0.84.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21ffb4705016d5ca91e18a72ed6822dab50e6d5ddd7045461b17ef19071cdef1"
|
||||
checksum = "77dc97c22bb5ce49a47b745bed8812d30206eff5ef3af31424f2c1820c0974b2"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfdd1101bdfa0414a19018ec0a091951a20b695d4d04f858d49f6c4cc53cd8dd"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -2876,7 +2935,7 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"object",
|
||||
"object 0.28.4",
|
||||
"once_cell",
|
||||
"paste",
|
||||
"psm",
|
||||
@@ -2884,7 +2943,7 @@ dependencies = [
|
||||
"region",
|
||||
"serde",
|
||||
"target-lexicon",
|
||||
"wasmparser 0.83.0",
|
||||
"wasmparser 0.84.0",
|
||||
"wasmtime-cache",
|
||||
"wasmtime-cranelift",
|
||||
"wasmtime-environ",
|
||||
@@ -2897,9 +2956,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-cache"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85c6ab24291fa7cb3a181f5669f6c72599b7ef781669759b45c7828c5999d0c0"
|
||||
checksum = "79da81ed0724392948ad7a0fb5088ff1bd15fa937356c8c037c6b1c8b5473cde"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
@@ -2917,9 +2976,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-cranelift"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f04c810078a491b7bc4866ebe045f714d2b95e6b539e1f64009a4a7606be11de"
|
||||
checksum = "16e78edcfb0daa9a9579ac379d00e2d5a5b2a60c0d653c8c95e8412f2166acb9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-codegen",
|
||||
@@ -2930,18 +2989,18 @@ dependencies = [
|
||||
"gimli",
|
||||
"log",
|
||||
"more-asserts",
|
||||
"object",
|
||||
"object 0.28.4",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wasmparser 0.83.0",
|
||||
"wasmparser 0.84.0",
|
||||
"wasmtime-environ",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-environ"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61448266ea164b1ac406363cdcfac81c7c44db4d94c7a81c8620ac6c5c6cdf59"
|
||||
checksum = "4201389132ec467981980549574b33fc70d493b40f2c045c8ce5c7b54fbad97e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-entity",
|
||||
@@ -2949,19 +3008,19 @@ dependencies = [
|
||||
"indexmap",
|
||||
"log",
|
||||
"more-asserts",
|
||||
"object",
|
||||
"object 0.28.4",
|
||||
"serde",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wasmparser 0.83.0",
|
||||
"wasmparser 0.84.0",
|
||||
"wasmtime-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-fiber"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaaa38c3b48822ab27044e1d4a25a1052157de4c8f27574cb00167e127e320f"
|
||||
checksum = "9ba6777a84b44f9a384b5c9d511ae3d86534438b7e25d928b8e8e858ecad5df2"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"rustix",
|
||||
@@ -2970,9 +3029,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-jit"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "156b4623c6b0d4b8c24afb846c20525922f538ef464cc024abab7ea8de2109a2"
|
||||
checksum = "1587ca7752d00862faa540d00fd28e5ccf1ac61ba19756449193f1153cb2b127"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"anyhow",
|
||||
@@ -2982,7 +3041,7 @@ dependencies = [
|
||||
"gimli",
|
||||
"ittapi-rs",
|
||||
"log",
|
||||
"object",
|
||||
"object 0.28.4",
|
||||
"region",
|
||||
"rustc-demangle",
|
||||
"rustix",
|
||||
@@ -2997,20 +3056,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-jit-debug"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5dc31f811760a6c76b2672c404866fd19b75e5fb3b0075a3e377a6846490654"
|
||||
checksum = "b27233ab6c8934b23171c64f215f902ef19d18c1712b46a0674286d1ef28d5dd"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"object",
|
||||
"object 0.28.4",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-runtime"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f907beaff69d4d920fa4688411ee4cc75c0f01859e424677f9e426e2ef749864"
|
||||
checksum = "47d3b0b8f13db47db59d616e498fe45295819d04a55f9921af29561827bdb816"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"backtrace",
|
||||
@@ -3035,32 +3094,33 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-types"
|
||||
version = "0.35.3"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514ef0e5fd197b9609dc9eb74beba0c84d5a12b2417cbae55534633329ba4852"
|
||||
checksum = "1630d9dca185299bec7f557a7e73b28742fe5590caf19df001422282a0a98ad1"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"wasmparser 0.83.0",
|
||||
"wasmparser 0.84.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "39.0.0"
|
||||
version = "42.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9bbbd53432b267421186feee3e52436531fa69a7cfee9403f5204352df3dd05"
|
||||
checksum = "badcb03f976f983ff0daf294da9697be659442f61e6b0942bb37a2b6cbfe9dd4"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
"memchr",
|
||||
"unicode-width",
|
||||
"wasm-encoder 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.0.41"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab98ed25494f97c69f28758617f27c3e92e5336040b5c3a14634f2dd3fe61830"
|
||||
checksum = "b92f20b742ac527066c8414bc0637352661b68cab07ef42586cefaba71c965cf"
|
||||
dependencies = [
|
||||
"wast",
|
||||
]
|
||||
@@ -3207,18 +3267,18 @@ checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71"
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.10.0+zstd.1.5.2"
|
||||
version = "0.11.2+zstd.1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd"
|
||||
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "4.1.4+zstd.1.5.2"
|
||||
version = "5.0.2+zstd.1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee"
|
||||
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"zstd-sys",
|
||||
@@ -3226,9 +3286,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "1.6.3+zstd.1.5.2"
|
||||
version = "2.0.1+zstd.1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8"
|
||||
checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
|
||||
11
Cargo.toml
11
Cargo.toml
@@ -1,22 +1,22 @@
|
||||
[package]
|
||||
name = "uw8"
|
||||
version = "0.2.0-rc1"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
default = ["native", "browser"]
|
||||
native = ["wasmtime", "minifb", "cpal", "rubato"]
|
||||
native = ["wasmtime", "minifb", "cpal", "rubato", "winapi" ]
|
||||
browser = ["warp", "tokio", "tokio-stream", "webbrowser"]
|
||||
|
||||
[dependencies]
|
||||
wasmtime = { version = "0.35.3", optional = true }
|
||||
wasmtime = { version = "0.37.0", optional = true }
|
||||
anyhow = "1"
|
||||
minifb = { version = "0.22", default-features = false, features = ["x11"], optional = true }
|
||||
notify = "4"
|
||||
pico-args = "0.4"
|
||||
curlywas = { git = "https://github.com/exoticorn/curlywas.git", rev = "aac7bbd" }
|
||||
curlywas = { git = "https://github.com/exoticorn/curlywas.git", rev = "0e7ea50" }
|
||||
wat = "1"
|
||||
uw8-tool = { path = "uw8-tool" }
|
||||
same-file = "1"
|
||||
@@ -26,4 +26,5 @@ tokio-stream = { version = "0.1.8", features = ["sync"], optional = true }
|
||||
webbrowser = { version = "0.6.0", optional = true }
|
||||
ansi_term = "0.12.1"
|
||||
cpal = { version = "0.13.5", optional = true }
|
||||
rubato = { version = "0.11.0", optional = true }
|
||||
rubato = { version = "0.11.0", optional = true }
|
||||
winapi = { version = "0.3.9", features = ["timeapi"], optional = true }
|
||||
|
||||
55
examples/curlywas/cracklebass.cwa
Normal file
55
examples/curlywas/cracklebass.cwa
Normal file
@@ -0,0 +1,55 @@
|
||||
// port of cracklebass by pestis (originally on TIC-80)
|
||||
|
||||
include "../include/microw8-api.cwa"
|
||||
|
||||
const MUSIC_DATA = 0x20000;
|
||||
|
||||
export fn upd() {
|
||||
let inline t = 32!32 * 6 / 100;
|
||||
let inline p = t / 1024;
|
||||
|
||||
let channel:i32;
|
||||
|
||||
loop channels {
|
||||
let inline e = t * channel?MUSIC_DATA / 8;
|
||||
let lazy pattern = (8 * channel + p)?(MUSIC_DATA + 56);
|
||||
let lazy n = !!pattern * (8 * pattern + e / 16 % 8)?MUSIC_DATA;
|
||||
let inline prev_ctrl = (channel * 6)?80;
|
||||
(channel * 6)?80 = if n {
|
||||
let inline base_note = 12 + 12 * channel?(MUSIC_DATA + 4) + n;
|
||||
let inline pitch_drop = e % 16 * channel?(MUSIC_DATA + 94);
|
||||
let inline key_pattern = p?(MUSIC_DATA + 8*4 + 56);
|
||||
let inline key = select(key_pattern, (8 * key_pattern + t / 128 % 8)?MUSIC_DATA, 1);
|
||||
(channel * 6)?83 = base_note - pitch_drop / 4 + key;
|
||||
prev_ctrl & 0xfc | (e / 8 & 2) | 1
|
||||
} else {
|
||||
prev_ctrl & 0xfe
|
||||
};
|
||||
|
||||
branch_if (channel := channel + 1) < 4: channels;
|
||||
}
|
||||
}
|
||||
|
||||
data 80 {
|
||||
i8(
|
||||
0x44, 0, 0, 0, 0x50, 0x40,
|
||||
0x4, 0x50, 0, 0, 0x80, 0x80,
|
||||
0x40, 0x80, 0, 0, 0x40, 0x40,
|
||||
0, 0, 0, 0, 0x50, 0x50
|
||||
)
|
||||
}
|
||||
|
||||
data MUSIC_DATA {
|
||||
i8(
|
||||
16, 2, 8, 8, 1, 2, 2, 3, 1, 0,
|
||||
1,13,16, 0, 1, 8, 1, 0, 1,13,
|
||||
16, 1, 1, 8, 1, 0, 8,13,13, 0,
|
||||
16,13, 1, 0, 1, 0, 1, 0, 1, 1,
|
||||
1, 0, 0, 0, 1, 0,13, 1, 1, 1,
|
||||
6, 8, 1, 1, 6, 8, 1, 1, 2, 1,
|
||||
2, 1, 2, 0, 0, 0, 0, 3, 3, 3,
|
||||
5, 0, 0, 2, 1, 2, 1, 2, 1, 2,
|
||||
0, 4, 4, 0, 4, 4, 4, 4, 0, 0,
|
||||
0, 0, 6, 6, 0, 0, 0, 8
|
||||
)
|
||||
}
|
||||
@@ -8,7 +8,7 @@ global mut f: f32 = 2.0;
|
||||
|
||||
export fn upd() {
|
||||
let y: i32;
|
||||
let inline zero = 0.0;
|
||||
let inline zero = 0_f;
|
||||
|
||||
let lazy control_speed = 0.03125;
|
||||
s = s + 0.1875 - (f + control_speed) * isButtonPressed(4 <| cls(4)) as f32;
|
||||
@@ -30,6 +30,8 @@ export fn upd() {
|
||||
|
||||
if y == 180 & py > zero {
|
||||
if x > w | x < zero {
|
||||
0?80 = 0xc3;
|
||||
3?80 = 32;
|
||||
return;
|
||||
}
|
||||
py = zero;
|
||||
@@ -43,6 +45,9 @@ export fn upd() {
|
||||
circle(160 as f32, 160 as f32 + py, 22 as f32, -28);
|
||||
circle((160 - 6) as f32, (160 - 6) as f32 + py, 6 as f32, -26);
|
||||
|
||||
0?86 = py < zero;
|
||||
3?86 = 32 - py as i32;
|
||||
|
||||
px = px + (isButtonPressed(3) - isButtonPressed(2)) as f32 * control_speed;
|
||||
py = py + s;
|
||||
pz = pz + 1;
|
||||
|
||||
74
examples/wat/tunnel_opt.wat
Normal file
74
examples/wat/tunnel_opt.wat
Normal file
@@ -0,0 +1,74 @@
|
||||
(module
|
||||
(import "env" "atan2" (func $atan2 (param f32 f32) (result f32)))
|
||||
(import "env" "time" (func $time (result f32)))
|
||||
(import "env" "memory" (memory 4))
|
||||
(func (export "upd")
|
||||
(local $y i32)
|
||||
(local $i i32)
|
||||
(local $x i32)
|
||||
|
||||
(loop $pixels
|
||||
i32.const 1
|
||||
local.get $i
|
||||
|
||||
local.get $i
|
||||
|
||||
i32.const 36928
|
||||
f32.convert_i32_s
|
||||
local.get $i
|
||||
i32.const 320
|
||||
i32.rem_s
|
||||
i32.const 160
|
||||
i32.sub
|
||||
local.tee $x
|
||||
local.get $x
|
||||
i32.mul
|
||||
local.get $i
|
||||
i32.const 320
|
||||
i32.div_s
|
||||
i32.const 120
|
||||
i32.sub
|
||||
local.tee $y
|
||||
local.get $y
|
||||
i32.mul
|
||||
i32.add
|
||||
f32.convert_i32_s
|
||||
f32.sqrt
|
||||
f32.div
|
||||
i32.const 163
|
||||
f32.convert_i32_s
|
||||
call $time
|
||||
f32.mul
|
||||
f32.add
|
||||
i32.trunc_sat_f32_s
|
||||
|
||||
i32.const 163
|
||||
f32.convert_i32_s
|
||||
local.get $x
|
||||
f32.convert_i32_s
|
||||
local.get $y
|
||||
f32.convert_i32_s
|
||||
call $atan2
|
||||
f32.mul
|
||||
i32.const 64
|
||||
f32.convert_i32_s
|
||||
call $time
|
||||
f32.mul
|
||||
f32.add
|
||||
i32.trunc_f32_s
|
||||
|
||||
i32.xor
|
||||
i32.const 4
|
||||
i32.shr_s
|
||||
i32.const 15
|
||||
i32.and
|
||||
i32.store8 offset=120
|
||||
|
||||
i32.add
|
||||
local.tee $i
|
||||
i32.const 76800
|
||||
i32.rem_s
|
||||
br_if $pixels
|
||||
)
|
||||
)
|
||||
)
|
||||
2
platform/Cargo.lock
generated
2
platform/Cargo.lock
generated
@@ -146,7 +146,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
[[package]]
|
||||
name = "curlywas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=aac7bbd#aac7bbd8786a26da0dcbe8320b1afefaf6086464"
|
||||
source = "git+https://github.com/exoticorn/curlywas.git?rev=0e7ea50#0e7ea508cd0e76836283ae68a44c9097df83c8ac"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ariadne",
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
curlywas = { git="https://github.com/exoticorn/curlywas.git", rev="aac7bbd" }
|
||||
curlywas = { git="https://github.com/exoticorn/curlywas.git", rev="0e7ea50" }
|
||||
uw8-tool = { path="../uw8-tool" }
|
||||
anyhow = "1"
|
||||
lodepng = "3.4"
|
||||
Binary file not shown.
@@ -4,6 +4,7 @@ import "env.sin" fn sin(f32) -> f32;
|
||||
import "env.cos" fn cos(f32) -> f32;
|
||||
import "env.pow" fn pow(f32, f32) -> f32;
|
||||
import "env.exp" fn exp(f32) -> f32;
|
||||
import "env.logChar" fn logChar(i32);
|
||||
|
||||
export fn time() -> f32 {
|
||||
(0!64) as f32 / 1000 as f32
|
||||
@@ -32,11 +33,9 @@ export fn random() -> i32 {
|
||||
}
|
||||
|
||||
export fn random64() -> i64 {
|
||||
let state: i64;
|
||||
randomState = (state := (
|
||||
state := randomState ^ (randomState #>> 12i64)
|
||||
) ^ (state << 25i64)
|
||||
) ^ (state #>> 27i64);
|
||||
let lazy state = randomState ^ (randomState #>> 12i64);
|
||||
let lazy state = state ^ (state << 25i64);
|
||||
randomState = state ^ (state #>> 27i64);
|
||||
randomState * 0x2545f4914f6cdd1di64
|
||||
}
|
||||
|
||||
@@ -62,12 +61,8 @@ export fn cls(col: i32) {
|
||||
let i: i32;
|
||||
textCursorX = 0;
|
||||
textCursorY = 0;
|
||||
graphicsText = 0;
|
||||
col = (col & 255) * 0x1010101;
|
||||
loop pixels {
|
||||
i!120 = col;
|
||||
branch_if (i := i + 4) < 320*240: pixels;
|
||||
}
|
||||
outputChannel = 0;
|
||||
memory.fill(120, col, 320*240);
|
||||
}
|
||||
|
||||
export fn setPixel(x: i32, y: i32, col: i32) {
|
||||
@@ -91,12 +86,70 @@ fn clamp(v: i32, min: i32, max: i32) -> i32 {
|
||||
export fn hline(x1: i32, x2: i32, y: i32, col: i32) {
|
||||
x1 = clamp(x1, 0, 320);
|
||||
x2 = clamp(x2, 0, 320);
|
||||
if x1 < x2 & y #< 240 {
|
||||
if y #>= 240 {
|
||||
return;
|
||||
}
|
||||
let word_start = (x1 + 3) & -4;
|
||||
let word_end = x2 & -4;
|
||||
if word_end > word_start {
|
||||
col = (col & 255) * 0x1010101;
|
||||
let ptr = y * 320 + x1;
|
||||
let end = ptr + word_start - x1;
|
||||
if ptr + 2 <= end {
|
||||
ptr?120 = col;
|
||||
ptr?121 = col;
|
||||
ptr += 2;
|
||||
}
|
||||
if ptr < end {
|
||||
ptr?120 = col;
|
||||
ptr += 1;
|
||||
}
|
||||
end += word_end - word_start;
|
||||
loop words {
|
||||
if ptr + 16 <= end {
|
||||
ptr!120 = col;
|
||||
ptr!124 = col;
|
||||
ptr!128 = col;
|
||||
ptr!132 = col;
|
||||
ptr += 16;
|
||||
branch words;
|
||||
}
|
||||
if ptr + 8 <= end {
|
||||
ptr!120 = col;
|
||||
ptr!124 = col;
|
||||
ptr += 8;
|
||||
}
|
||||
if ptr < end {
|
||||
ptr!120 = col;
|
||||
ptr += 4;
|
||||
}
|
||||
}
|
||||
end += x2 - word_end;
|
||||
if ptr + 2 <= end {
|
||||
ptr?120 = col;
|
||||
ptr?121 = col;
|
||||
ptr += 2;
|
||||
}
|
||||
if ptr < end {
|
||||
ptr?120 = col;
|
||||
}
|
||||
} else {
|
||||
let ptr = y * 320 + x1;
|
||||
let end = ptr + x2 - x1;
|
||||
loop pixels {
|
||||
if ptr + 4 <= end {
|
||||
ptr?120 = col;
|
||||
ptr?121 = col;
|
||||
ptr?122 = col;
|
||||
ptr?123 = col;
|
||||
ptr += 4;
|
||||
}
|
||||
if ptr + 2 <= end {
|
||||
ptr?120 = col;
|
||||
ptr?121 = col;
|
||||
ptr += 2;
|
||||
}
|
||||
if ptr < end {
|
||||
ptr?120 = col;
|
||||
branch_if (ptr := ptr + 1) < end: pixels;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,7 +360,7 @@ global mut textCursorX = 0;
|
||||
global mut textCursorY = 0;
|
||||
global mut textColor = 15;
|
||||
global mut bgColor = 0;
|
||||
global mut graphicsText = 0;
|
||||
global mut outputChannel = 0;
|
||||
|
||||
export fn printChar(char: i32) {
|
||||
loop chars {
|
||||
@@ -319,6 +372,20 @@ export fn printChar(char: i32) {
|
||||
global mut controlCodeLength = 0;
|
||||
|
||||
fn printSingleChar(char: i32) {
|
||||
if char >= 4 & char <= 6 {
|
||||
outputChannel = char - 4;
|
||||
if !outputChannel {
|
||||
textCursorX = 0;
|
||||
textCursorY = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if outputChannel >= 2 {
|
||||
logChar(char);
|
||||
return;
|
||||
}
|
||||
|
||||
controlCodeLength?0x12d20 = char;
|
||||
controlCodeLength = controlCodeLength + 1;
|
||||
char = 0x12d20?0;
|
||||
@@ -332,13 +399,6 @@ fn printSingleChar(char: i32) {
|
||||
return;
|
||||
}
|
||||
|
||||
if char == 4 | char == 5 {
|
||||
graphicsText = char == 5;
|
||||
textCursorX = 0;
|
||||
textCursorY = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if char == 7 {
|
||||
80?0 = 80?0 ^ 2;
|
||||
return;
|
||||
@@ -346,7 +406,7 @@ fn printSingleChar(char: i32) {
|
||||
|
||||
if char == 8 {
|
||||
textCursorX = textCursorX - 8;
|
||||
if !graphicsText & textCursorX < 0 {
|
||||
if !outputChannel & textCursorX < 0 {
|
||||
textCursorX = 320-8;
|
||||
printSingleChar(11);
|
||||
}
|
||||
@@ -354,7 +414,7 @@ fn printSingleChar(char: i32) {
|
||||
}
|
||||
|
||||
if char == 9 {
|
||||
if !graphicsText & textCursorX >= 320 {
|
||||
if !outputChannel & textCursorX >= 320 {
|
||||
printChar(0xd0a);
|
||||
}
|
||||
textCursorX = textCursorX + 8;
|
||||
@@ -363,7 +423,7 @@ fn printSingleChar(char: i32) {
|
||||
|
||||
if char == 10 {
|
||||
textCursorY = textCursorY + 8;
|
||||
if !graphicsText & textCursorY >= 240 {
|
||||
if !outputChannel & textCursorY >= 240 {
|
||||
textCursorY = 240 - 8;
|
||||
let i: i32;
|
||||
loop scroll_copy {
|
||||
@@ -377,7 +437,7 @@ fn printSingleChar(char: i32) {
|
||||
|
||||
if char == 11 {
|
||||
textCursorY = textCursorY - 8;
|
||||
if !graphicsText & textCursorY < 0 {
|
||||
if !outputChannel & textCursorY < 0 {
|
||||
textCursorY = 0;
|
||||
let i = 320 * (240 - 8);
|
||||
loop scroll_copy {
|
||||
@@ -417,8 +477,8 @@ fn printSingleChar(char: i32) {
|
||||
}
|
||||
|
||||
if char == 31 {
|
||||
textCursorX = 0x12d20?1 * (8 - graphicsText * 6);
|
||||
textCursorY = 0x12d20?2 * (8 - graphicsText * 7);
|
||||
textCursorX = 0x12d20?1 * (8 - outputChannel * 6);
|
||||
textCursorY = 0x12d20?2 * (8 - outputChannel * 7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -443,7 +503,7 @@ data(0x12d00) {
|
||||
}
|
||||
|
||||
fn drawChar(char: i32) {
|
||||
if !graphicsText & textCursorX >= 320 {
|
||||
if !outputChannel & textCursorX >= 320 {
|
||||
printChar(0xd0a);
|
||||
}
|
||||
|
||||
@@ -451,7 +511,7 @@ fn drawChar(char: i32) {
|
||||
loop rows {
|
||||
let bits = (char * 8 + y)?0x13400;
|
||||
let x = 0;
|
||||
if graphicsText {
|
||||
if outputChannel {
|
||||
loop pixels {
|
||||
if (bits := bits << 1) & 256 {
|
||||
setPixel(textCursorX + x, textCursorY + y, textColor);
|
||||
@@ -503,7 +563,7 @@ export fn setBackgroundColor(col: i32) {
|
||||
}
|
||||
|
||||
export fn setCursorPosition(x: i32, y: i32) {
|
||||
let lazy scale = select(graphicsText, 1, 8);
|
||||
let lazy scale = select(outputChannel, 1, 8);
|
||||
textCursorX = x * scale;
|
||||
textCursorY = y * scale;
|
||||
}
|
||||
@@ -542,13 +602,6 @@ export fn endFrame() {
|
||||
68!4 = 68!0;
|
||||
}
|
||||
|
||||
fn memclr(base: i32, size: i32) {
|
||||
loop bytes {
|
||||
(base + (size := size - 1))?0 = 0;
|
||||
branch_if size: bytes;
|
||||
}
|
||||
}
|
||||
|
||||
start fn setup() {
|
||||
let i: i32 = 12*16*3-1;
|
||||
let avg: f32;
|
||||
@@ -581,9 +634,9 @@ start fn setup() {
|
||||
branch_if (i := i - 1) >= 0: expand_sweetie;
|
||||
}
|
||||
|
||||
memclr(0, 64);
|
||||
memclr(112, 8);
|
||||
memclr(0x14000, 0x2c000);
|
||||
memory.fill(0, 0, 64);
|
||||
memory.fill(112, 0, 8);
|
||||
memory.fill(0x14000, 0, 0x2c000);
|
||||
|
||||
|
||||
cls(0);
|
||||
|
||||
@@ -15,11 +15,11 @@ The initial motivation behind MicroW8 was to explore whether there was a way to
|
||||
* Gamepad input (D-Pad + 4 Buttons)
|
||||
|
||||
## Examples
|
||||
* [Fireworks](v0.1.2#AgwvgP+M59snqjl4CMKw5sqm1Zw9yJCbSviMjeLUdHus2a3yl/a99+uiBeqZgP/2jqSjrLjRk73COMM6OSLpsxK8ugT1kuk/q4hQUqqPpGozHoa0laulzGGcahzdfdJsYaK1sIdeIYS9M5PnJx/Wk9H+PvWEPy2Zvv7I6IW7Fg==) (127 bytes): Some fireworks to welcome 2022.
|
||||
* [Skip Ahead](v0.1.2#AgyfpZ80wkW28kiUZ9VIK4v+RPnVxqjK1dz2BcDoNyQPsS2g4OgEzkTe6jyoAfFOmqKrS8SM2aRljBal9mjNn8i4fP9eBK+RehQKxxGtJa9FqftvqEnh3ez1YaYxqj7jgTdzJ/WAYVmKMovBT1myrX3FamqKSOgMsNedLhVTLAhQup3sNcYEjGNo8b0HZ5+AgMgCwYRGCe//XQOMAaAAzqDILgmpEZ/43RKHcQpHEQwbURfNQJpadJe2sz3q5FlQnTGXQ9oSMokidhlC+aR/IpNHieuBGLhFZ2GfnwVQ0geBbQpTPA==) (229 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21
|
||||
* [OhNoAnotherTunnel](v0.1.2#AgPP1oEFvPzY/rBZwTumtYn37zeMFgpir1Bkn91jsNcp26VzoUpkAOOJTtnzVBfW+/dGnnIdbq/irBUJztY5wuua80DORTYZndgdwZHcSk15ajc4nyO0g1A6kGWyW56oZk0iPYJA9WtUmoj0Plvy1CGwIZrMe57X7QZcdqc3u6zjTA41Tpiqi9vnO3xbhi8o594Vx0XPXwVzpYq1ZCTYenfAGaXKkDmAFJqiVIsiCg==) (175 bytes): A port of my [entry](http://tic80.com/play?cart=1871) in the Outline'21 bytebattle final
|
||||
* [Technotunnel](v0.1.2#AhPXpq894LaUhp5+HQf39f39/Jc8g5zUrBSc0uyKh36ivskczhY84h55zL8gWpkdvKuRQI+KIt80isKzh8jkM8nILcx0RUvyk8yjE8TgNsgkcORVI0RY5k3qE4ySjaycxa2DVZH61UWZuLsCouuwT7I80TbmmetQSbMywJ/avrrCZIAH0UzQfvOiCJNG48NI0FFY1vjB7a7dcp8Uqg==) (157 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final
|
||||
* [Font & Palette](v0.1.2#At/p39+IBnj6ry1TRe7jzVy2A4tXgBvmoW2itzoyF2aM28pGy5QDiKxqrk8l9sbWZLtnAb+jgOfU+9QhpuyCAkhN6gPOU481IUL/df96vNe3h288Dqwhd3sfFpothIVFsMwRK72kW2hiR7zWsaXyy5pNmjR6BJk4piWx9ApT1ZwoUajhk6/zij6itq/FD1U3jj/J3MOwqZ2ef8Bv6ZPQlJIYVf62icGa69wS6SI1qBpIFiF14F8PcztRVbKIxLpT4ArCS6nz6FPnyUkqATGSBNPJ): Just a simple viewer for the default font and palette.
|
||||
* [Skip Ahead](v0.2.0#AgVfq24KI2Ok2o8qVtPYj27fSuGnfeSKgbOkIOsaEQMov8TDYQ6UjdjwkZrYcM1i9alo4/+Bhm1PRFEa0YHJlJAk/PGoc2K41rejv9ZSqJqIHNjr7cappqhOR2jT+jk+0b0+U6hO+geRCTP2aufWs7L+f/Z27NFY8LKlqPSv+C6Rd6+ohoKi6sYl5Kcrlf1cyTinV7jTTnmbcXWVDBA5rRKxAGMUTDS8rHxqSztRITOaQVP1pSdYgi/BDdOJOxSOIkeaId84S+Ycls5na7EgwSfVIpgqF+tcfkUecb8t2mQrXA7pyKrh/wzHn5N6Oe5aOgmzY2YpTIct) (249 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21, now with sound
|
||||
* [Fireworks](v0.2.0#AgwvgP+M59snqjl4CMKw5sqm1Zw9yJCbSviMjeLUdHus2a3yl/a99+uiBeqZgP/2jqSjrLjRk73COMM6OSLpsxK8ugT1kuk/q4hQUqqPpGozHoa0laulzGGcahzdfdJsYaK1sIdeIYS9M5PnJx/Wk9H+PvWEPy2Zvv7I6IW7Fg==) (127 bytes): Some fireworks to welcome 2022.
|
||||
* [OhNoAnotherTunnel](v0.2.0#AgPP1oEFvPzY/rBZwTumtYn37zeMFgpir1Bkn91jsNcp26VzoUpkAOOJTtnzVBfW+/dGnnIdbq/irBUJztY5wuua80DORTYZndgdwZHcSk15ajc4nyO0g1A6kGWyW56oZk0iPYJA9WtUmoj0Plvy1CGwIZrMe57X7QZcdqc3u6zjTA41Tpiqi9vnO3xbhi8o594Vx0XPXwVzpYq1ZCTYenfAGaXKkDmAFJqiVIsiCg==) (175 bytes): A port of my [entry](http://tic80.com/play?cart=1871) in the Outline'21 bytebattle final
|
||||
* [Technotunnel](v0.2.0#AhPXpq894LaUhp5+HQf39f39/Jc8g5zUrBSc0uyKh36ivskczhY84h55zL8gWpkdvKuRQI+KIt80isKzh8jkM8nILcx0RUvyk8yjE8TgNsgkcORVI0RY5k3qE4ySjaycxa2DVZH61UWZuLsCouuwT7I80TbmmetQSbMywJ/avrrCZIAH0UzQfvOiCJNG48NI0FFY1vjB7a7dcp8Uqg==) (157 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final
|
||||
* [Font & Palette](v0.2.0#At/p39+IBnj6ry1TRe7jzVy2A4tXgBvmoW2itzoyF2aM28pGy5QDiKxqrk8l9sbWZLtnAb+jgOfU+9QhpuyCAkhN6gPOU481IUL/df96vNe3h288Dqwhd3sfFpothIVFsMwRK72kW2hiR7zWsaXyy5pNmjR6BJk4piWx9ApT1ZwoUajhk6/zij6itq/FD1U3jj/J3MOwqZ2ef8Bv6ZPQlJIYVf62icGa69wS6SI1qBpIFiF14F8PcztRVbKIxLpT4ArCS6nz6FPnyUkqATGSBNPJ): Just a simple viewer for the default font and palette.
|
||||
|
||||
Examplers for older versions:
|
||||
|
||||
@@ -29,32 +29,23 @@ Examplers for older versions:
|
||||
|
||||
## Versions
|
||||
|
||||
### v0.2.0-rc1
|
||||
### v0.2.0
|
||||
|
||||
* [Web runtime](v0.2.0-rc1)
|
||||
* [Web runtime](v0.2.0)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* [add sound support](docs#sound)
|
||||
* "integer constant cast to float" literal syntax in CurlyWas (ex. `1_f` is equivalent to `1 as f32`)
|
||||
|
||||
Known issues:
|
||||
|
||||
* timing accuracy/update frequency of sound support currently depends on sound buffer size
|
||||
|
||||
### v0.1.2
|
||||
|
||||
* [Web runtime](v0.1.2)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.1.2/microw8-0.1.2-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.1.2/microw8-0.1.2-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.1.2/microw8-0.1.2-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* add option to `uw8 run` to run the cart in the browser using the web runtime
|
||||
* CurlyWas: implement `include` support
|
||||
* CurlyWas: implement support for constants
|
||||
* fix crash when trying to draw zero sized line
|
||||
* [add sound support!](docs#sound)
|
||||
* add support to redirect text output to the console for debugging using control code 6
|
||||
* update curlywas:
|
||||
* add support for `else if`
|
||||
* add support for escape sequences in strings
|
||||
* add support for char literals
|
||||
* add support for binop-assignment, eg. `+=`, `^=`, `<<=` etc. (also support for the tee operator: `+:=`)
|
||||
* "integer constant cast to float" literal syntax in CurlyWas (ex. `1_f` is equivalent to `1 as f32`)
|
||||
|
||||
### Older versions
|
||||
|
||||
|
||||
@@ -225,30 +225,45 @@ Moving/printing past any border does not cause any special operation, the cursor
|
||||
Characters 0-31 are control characters and don't print by default. They take the next 0-2 following characters as parameters.
|
||||
Avoid the reserved control chars, they are currently NOPs but their behavior can change in later MicroW8 versions.
|
||||
|
||||
| Code | Parameters | Operation |
|
||||
| ----- | ---------- | ------------------------------------ |
|
||||
| 0 | - | Nop |
|
||||
| 1 | char | Print char (including control chars) |
|
||||
| 2-3 | - | Reserved |
|
||||
| 4 | - | Switch to normal mode |
|
||||
| 5 | - | Switch to graphics mode |
|
||||
| 6 | - | Reserved |
|
||||
| 7 | - | Bell / trigger sound channel 0 |
|
||||
| 8 | - | Move cursor left |
|
||||
| 9 | - | Move cursor right |
|
||||
| 10 | - | Move cursor down |
|
||||
| 11 | - | Move cursor up |
|
||||
| 12 | - | do `cls(background_color)` |
|
||||
| 13 | - | Move cursor to the left border |
|
||||
| 14 | color | Set the background color |
|
||||
| 15 | color | Set the text color |
|
||||
| 16-23 | - | Reserved |
|
||||
| 24 | - | Swap text/background colors |
|
||||
| 25-30 | - | Reserved |
|
||||
| 31 | x, y | Set cursor position (*) |
|
||||
| Code | Parameters | Operation |
|
||||
| ----- | ---------- | ------------------------------------------ |
|
||||
| 0 | - | Nop |
|
||||
| 1 | char | Print char (including control chars) |
|
||||
| 2-3 | - | Reserved |
|
||||
| 4 | - | Switch to normal mode, reset cursor to 0,0 |
|
||||
| 5 | - | Switch to graphics mode |
|
||||
| 6 | - | Switch output to (debug) console |
|
||||
| 7 | - | Bell / trigger sound channel 0 |
|
||||
| 8 | - | Move cursor left |
|
||||
| 9 | - | Move cursor right |
|
||||
| 10 | - | Move cursor down |
|
||||
| 11 | - | Move cursor up |
|
||||
| 12 | - | do `cls(background_color)` |
|
||||
| 13 | - | Move cursor to the left border |
|
||||
| 14 | color | Set the background color |
|
||||
| 15 | color | Set the text color |
|
||||
| 16-23 | - | Reserved |
|
||||
| 24 | - | Swap text/background colors |
|
||||
| 25-30 | - | Reserved |
|
||||
| 31 | x, y | Set cursor position (*) |
|
||||
|
||||
(*) In graphics mode, the x coordinate is doubled when using control char 31 to be able to cover the whole screen with one byte.
|
||||
|
||||
#### Debug output
|
||||
|
||||
Control code 6 switches all text output (except codes 4 and 5 to switch output back to the screen) to the console. Where exactly this ends
|
||||
up (if at all) is an implementation detail of the runtimes. The native dev-runtime writes the debug output to `stdout`, the web runtime to
|
||||
the debug console using `console.log`. Both implementation buffer the output until they encounter a newline character (10) in the output stream.
|
||||
|
||||
There may be future runtimes that ignore the debug output completely.
|
||||
|
||||
In CurlyWas, a simple way to log some value might look like this:
|
||||
```
|
||||
printChar('\06V: '); // switch to console out, print some prefix
|
||||
printInt(some_value);
|
||||
printChar('\n\4'); // newline and switch back to screen
|
||||
```
|
||||
|
||||
### fn printChar(char: i32)
|
||||
|
||||
Prints the character in the lower 8 bits of `char`. If the upper 24 bits are non-zero, right-shifts `char` by 8 bits and loops back to the beginning.
|
||||
|
||||
@@ -2,6 +2,69 @@
|
||||
description = "Versions"
|
||||
+++
|
||||
|
||||
### v0.2.0
|
||||
|
||||
* [Web runtime](v0.2.0)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.2.0/microw8-0.2.0-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* [add sound support!](docs#sound)
|
||||
* add support to redirect text output to the console for debugging using control code 6
|
||||
* update curlywas:
|
||||
* add support for `else if`
|
||||
* add support for escape sequences in strings
|
||||
* add support for char literals
|
||||
* add support for binop-assignment, eg. `+=`, `^=`, `<<=` etc. (also support for the tee operator: `+:=`)
|
||||
* "integer constant cast to float" literal syntax in CurlyWas (ex. `1_f` is equivalent to `1 as f32`)
|
||||
|
||||
### v0.2.0-rc3
|
||||
|
||||
* [Web runtime](v0.2.0-rc3)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc3/microw8-0.2.0-rc3-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc3/microw8-0.2.0-rc3-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc3/microw8-0.2.0-rc3-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* improve timing stability some more. essentially now guaranteeing that "frame = time_ms * 6 / 100" returns
|
||||
consecutive frame numbers, provided the module can be run at 60 fps
|
||||
* add support to redirect text output to the console for debugging using control code 6
|
||||
* update curlywas:
|
||||
* add support for `else if`
|
||||
* add support for escape sequences in strings
|
||||
* add support for char literals
|
||||
* add support for binop-assignment, eg. `+=`, `^=`, `<<=` etc. (also support for the tee operator: `+:=`)
|
||||
|
||||
### v0.2.0-rc2
|
||||
|
||||
* [Web runtime](v0.2.0-rc2)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc2/microw8-0.2.0-rc2-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc2/microw8-0.2.0-rc2-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc2/microw8-0.2.0-rc2-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* fix timing issues of sound playback, especially on systems with large sound buffers
|
||||
|
||||
### v0.2.0-rc1
|
||||
|
||||
* [Web runtime](v0.2.0-rc1)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc1/microw8-0.2.0-rc1-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc1/microw8-0.2.0-rc1-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.2.0-rc1/microw8-0.2.0-rc1-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* [add sound support](docs#sound)
|
||||
* "integer constant cast to float" literal syntax in CurlyWas (ex. `1_f` is equivalent to `1 as f32`)
|
||||
|
||||
Known issues:
|
||||
|
||||
* timing accuracy/update frequency of sound support currently depends on sound buffer size
|
||||
|
||||
### v0.1.2
|
||||
|
||||
* [Web runtime](v0.1.2)
|
||||
|
||||
1
site/static/v0.2.0-rc2/index.html
Normal file
1
site/static/v0.2.0-rc2/index.html
Normal file
File diff suppressed because one or more lines are too long
1
site/static/v0.2.0-rc3/index.html
Normal file
1
site/static/v0.2.0-rc3/index.html
Normal file
File diff suppressed because one or more lines are too long
1
site/static/v0.2.0/index.html
Normal file
1
site/static/v0.2.0/index.html
Normal file
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
<section>
|
||||
<h1 class="text-center heading-text">A WebAssembly based fantasy console</h1>
|
||||
</section>
|
||||
<a href="v0.1.2">
|
||||
<a href="v0.2.0">
|
||||
<img class="demonstration-gif" style="width:640px;height:480px;image-rendering:pixelated" src="img/technotunnel.png"></img>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -14,9 +14,6 @@ use anyhow::Result;
|
||||
|
||||
pub trait Runtime {
|
||||
fn is_open(&self) -> bool;
|
||||
fn set_timeout(&mut self, _timeout: u32) {
|
||||
eprintln!("Warning: runtime doesn't support timeout");
|
||||
}
|
||||
fn load(&mut self, module_data: &[u8]) -> Result<()>;
|
||||
fn run_frame(&mut self) -> Result<()>;
|
||||
}
|
||||
}
|
||||
|
||||
12
src/main.rs
12
src/main.rs
@@ -52,6 +52,7 @@ fn main() -> Result<()> {
|
||||
#[cfg(any(feature = "native", feature = "browser"))]
|
||||
fn run(mut args: Arguments) -> Result<()> {
|
||||
let watch_mode = args.contains(["-w", "--watch"]);
|
||||
#[allow(unused)]
|
||||
let timeout: Option<u32> = args.opt_value_from_str(["-t", "--timeout"])?;
|
||||
|
||||
let mut config = Config::default();
|
||||
@@ -92,7 +93,7 @@ fn run(mut args: Arguments) -> Result<()> {
|
||||
unimplemented!();
|
||||
#[cfg(feature = "native")]
|
||||
{
|
||||
let mut microw8 = MicroW8::new()?;
|
||||
let mut microw8 = MicroW8::new(timeout)?;
|
||||
if disable_audio {
|
||||
microw8.disable_audio();
|
||||
}
|
||||
@@ -105,10 +106,6 @@ fn run(mut args: Arguments) -> Result<()> {
|
||||
Box::new(RunWebServer::new())
|
||||
};
|
||||
|
||||
if let Some(timeout) = timeout {
|
||||
runtime.set_timeout(timeout);
|
||||
}
|
||||
|
||||
let mut first_run = true;
|
||||
|
||||
while runtime.is_open() {
|
||||
@@ -167,7 +164,10 @@ fn load_cart(filename: &Path, config: &Config) -> (Result<Vec<u8>>, Vec<PathBuf>
|
||||
|
||||
if let Some(ref pack_config) = config.pack {
|
||||
cart = uw8_tool::pack(&cart, pack_config)?;
|
||||
println!("packed size: {} bytes", cart.len());
|
||||
println!(
|
||||
"\npacked size: {:.2} bytes",
|
||||
uw8_tool::compressed_size(&cart)
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(ref path) = config.output_path {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,6 +37,7 @@ struct UW8Instance {
|
||||
end_frame: TypedFunc<(), ()>,
|
||||
update: Option<TypedFunc<(), ()>>,
|
||||
start_time: Instant,
|
||||
next_frame: Instant,
|
||||
module: Vec<u8>,
|
||||
watchdog: Arc<Mutex<UW8WatchDog>>,
|
||||
sound: Option<Uw8Sound>,
|
||||
@@ -51,14 +52,23 @@ impl Drop for UW8Instance {
|
||||
}
|
||||
|
||||
struct UW8WatchDog {
|
||||
interupt: wasmtime::InterruptHandle,
|
||||
timeout: u32,
|
||||
engine: Engine,
|
||||
stop: bool,
|
||||
}
|
||||
|
||||
impl MicroW8 {
|
||||
pub fn new() -> Result<MicroW8> {
|
||||
let engine = wasmtime::Engine::new(wasmtime::Config::new().interruptable(true))?;
|
||||
pub fn new(timeout: Option<u32>) -> Result<MicroW8> {
|
||||
#[cfg(target_os = "windows")]
|
||||
unsafe {
|
||||
winapi::um::timeapi::timeBeginPeriod(1);
|
||||
}
|
||||
|
||||
let mut config = wasmtime::Config::new();
|
||||
config.cranelift_opt_level(wasmtime::OptLevel::Speed);
|
||||
if timeout.is_some() {
|
||||
config.epoch_interruption(true);
|
||||
}
|
||||
let engine = wasmtime::Engine::new(&config)?;
|
||||
|
||||
let loader_module =
|
||||
wasmtime::Module::new(&engine, include_bytes!("../platform/bin/loader.wasm"))?;
|
||||
@@ -69,8 +79,7 @@ impl MicroW8 {
|
||||
resize: true,
|
||||
..Default::default()
|
||||
};
|
||||
let mut window = Window::new("MicroW8", 320, 240, options)?;
|
||||
window.limit_update_rate(Some(std::time::Duration::from_micros(16666)));
|
||||
let window = Window::new("MicroW8", 320, 240, options)?;
|
||||
|
||||
Ok(MicroW8 {
|
||||
engine,
|
||||
@@ -78,7 +87,7 @@ impl MicroW8 {
|
||||
window,
|
||||
window_buffer: vec![0u32; 320 * 240],
|
||||
instance: None,
|
||||
timeout: 30,
|
||||
timeout: timeout.unwrap_or(0),
|
||||
disable_audio: false,
|
||||
})
|
||||
}
|
||||
@@ -100,14 +109,11 @@ impl super::Runtime for MicroW8 {
|
||||
self.window.is_open() && !self.window.is_key_down(Key::Escape)
|
||||
}
|
||||
|
||||
fn set_timeout(&mut self, timeout: u32) {
|
||||
self.timeout = timeout;
|
||||
}
|
||||
|
||||
fn load(&mut self, module_data: &[u8]) -> Result<()> {
|
||||
self.reset();
|
||||
|
||||
let mut store = wasmtime::Store::new(&self.engine, ());
|
||||
store.set_epoch_deadline(60);
|
||||
|
||||
let memory = wasmtime::Memory::new(&mut store, MemoryType::new(4, Some(4)))?;
|
||||
|
||||
@@ -133,8 +139,7 @@ impl super::Runtime for MicroW8 {
|
||||
let platform_instance = instantiate_platform(&mut linker, &mut store, &platform_module)?;
|
||||
|
||||
let watchdog = Arc::new(Mutex::new(UW8WatchDog {
|
||||
interupt: store.interrupt_handle()?,
|
||||
timeout: self.timeout,
|
||||
engine: self.engine.clone(),
|
||||
stop: false,
|
||||
}));
|
||||
|
||||
@@ -142,16 +147,11 @@ impl super::Runtime for MicroW8 {
|
||||
let watchdog = watchdog.clone();
|
||||
thread::spawn(move || loop {
|
||||
thread::sleep(Duration::from_millis(17));
|
||||
if let Ok(mut watchdog) = watchdog.lock() {
|
||||
if let Ok(watchdog) = watchdog.lock() {
|
||||
if watchdog.stop {
|
||||
break;
|
||||
}
|
||||
if watchdog.timeout > 0 {
|
||||
watchdog.timeout -= 1;
|
||||
if watchdog.timeout == 0 {
|
||||
watchdog.interupt.interrupt();
|
||||
}
|
||||
}
|
||||
watchdog.engine.increment_epoch();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -159,9 +159,6 @@ impl super::Runtime for MicroW8 {
|
||||
}
|
||||
|
||||
let instance = linker.instantiate(&mut store, &module)?;
|
||||
if let Ok(mut watchdog) = watchdog.lock() {
|
||||
watchdog.timeout = 0;
|
||||
}
|
||||
let end_frame = platform_instance.get_typed_func::<(), (), _>(&mut store, "endFrame")?;
|
||||
let update = instance.get_typed_func::<(), (), _>(&mut store, "upd").ok();
|
||||
|
||||
@@ -186,6 +183,7 @@ impl super::Runtime for MicroW8 {
|
||||
end_frame,
|
||||
update,
|
||||
start_time: Instant::now(),
|
||||
next_frame: Instant::now(),
|
||||
module: module_data.into(),
|
||||
watchdog,
|
||||
sound,
|
||||
@@ -198,7 +196,19 @@ impl super::Runtime for MicroW8 {
|
||||
let mut result = Ok(());
|
||||
if let Some(mut instance) = self.instance.take() {
|
||||
{
|
||||
let time = instance.start_time.elapsed().as_millis() as i32;
|
||||
if let Some(sleep) = instance.next_frame.checked_duration_since(Instant::now()) {
|
||||
std::thread::sleep(sleep);
|
||||
}
|
||||
}
|
||||
|
||||
let now = Instant::now();
|
||||
let time = (now - instance.start_time).as_millis() as i32;
|
||||
{
|
||||
let offset = ((time as u32 as i64 * 6) % 100 - 50) / 6;
|
||||
instance.next_frame = now + Duration::from_millis((16 - offset) as u64);
|
||||
}
|
||||
|
||||
{
|
||||
let mut gamepad: u32 = 0;
|
||||
for key in self.window.get_keys() {
|
||||
if let Some(index) = GAMEPAD_KEYS
|
||||
@@ -216,15 +226,10 @@ impl super::Runtime for MicroW8 {
|
||||
mem[68..72].copy_from_slice(&gamepad.to_le_bytes());
|
||||
}
|
||||
|
||||
if let Ok(mut watchdog) = instance.watchdog.lock() {
|
||||
watchdog.timeout = self.timeout;
|
||||
}
|
||||
instance.store.set_epoch_deadline(self.timeout as u64);
|
||||
if let Some(ref update) = instance.update {
|
||||
result = update.call(&mut instance.store, ());
|
||||
}
|
||||
if let Ok(mut watchdog) = instance.watchdog.lock() {
|
||||
watchdog.timeout = 0;
|
||||
}
|
||||
instance.end_frame.call(&mut instance.store, ())?;
|
||||
|
||||
let memory = instance.memory.data(&instance.store);
|
||||
@@ -232,7 +237,10 @@ impl super::Runtime for MicroW8 {
|
||||
let mut sound_regs = [0u8; 32];
|
||||
sound_regs.copy_from_slice(&memory[80..112]);
|
||||
if let Some(ref sound) = instance.sound {
|
||||
sound.tx.send(sound_regs)?;
|
||||
sound.tx.send(RegisterUpdate {
|
||||
time,
|
||||
data: sound_regs,
|
||||
})?;
|
||||
}
|
||||
|
||||
let framebuffer = &memory[120..(120 + 320 * 240)];
|
||||
@@ -277,6 +285,16 @@ fn add_native_functions(
|
||||
for i in 10..64 {
|
||||
linker.func_wrap("env", &format!("reserved{}", i), || {})?;
|
||||
}
|
||||
let log_line = std::sync::Mutex::new(String::new());
|
||||
linker.func_wrap("env", "logChar", move |c: i32| {
|
||||
let mut log_line = log_line.lock().unwrap();
|
||||
if c == 10 {
|
||||
println!("{}", log_line);
|
||||
log_line.clear();
|
||||
} else {
|
||||
log_line.push(c as u8 as char);
|
||||
}
|
||||
})?;
|
||||
for i in 0..16 {
|
||||
linker.define(
|
||||
"env",
|
||||
@@ -312,9 +330,14 @@ fn instantiate_platform(
|
||||
Ok(platform_instance)
|
||||
}
|
||||
|
||||
struct RegisterUpdate {
|
||||
time: i32,
|
||||
data: [u8; 32],
|
||||
}
|
||||
|
||||
struct Uw8Sound {
|
||||
stream: cpal::Stream,
|
||||
tx: mpsc::SyncSender<[u8; 32]>,
|
||||
tx: mpsc::SyncSender<RegisterUpdate>,
|
||||
}
|
||||
|
||||
fn init_sound(
|
||||
@@ -323,6 +346,7 @@ fn init_sound(
|
||||
module: &wasmtime::Module,
|
||||
) -> Result<Uw8Sound> {
|
||||
let mut store = wasmtime::Store::new(engine, ());
|
||||
store.set_epoch_deadline(60);
|
||||
|
||||
let memory = wasmtime::Memory::new(&mut store, MemoryType::new(4, Some(4)))?;
|
||||
|
||||
@@ -378,9 +402,7 @@ fn init_sound(
|
||||
|
||||
let sample_rate = config.sample_rate.0 as usize;
|
||||
|
||||
let (tx, rx) = mpsc::sync_channel::<[u8; 32]>(1);
|
||||
|
||||
let start_time = Instant::now();
|
||||
let (tx, rx) = mpsc::sync_channel::<RegisterUpdate>(30);
|
||||
|
||||
struct Resampler {
|
||||
resampler: rubato::FftFixedIn<f32>,
|
||||
@@ -403,60 +425,92 @@ fn init_sound(
|
||||
};
|
||||
|
||||
let mut sample_index = 0;
|
||||
let mut pending_updates: Vec<RegisterUpdate> = Vec::with_capacity(30);
|
||||
let mut current_time = 0;
|
||||
let stream = device.build_output_stream(
|
||||
&config,
|
||||
move |mut buffer: &mut [f32], _| {
|
||||
if let Ok(regs) = rx.try_recv() {
|
||||
memory.write(&mut store, 80, ®s).unwrap();
|
||||
move |mut outer_buffer: &mut [f32], _| {
|
||||
let mut first_update = true;
|
||||
while let Ok(update) = rx.try_recv() {
|
||||
if first_update {
|
||||
current_time += update.time.wrapping_sub(current_time) / 8;
|
||||
first_update = false;
|
||||
}
|
||||
pending_updates.push(update);
|
||||
}
|
||||
|
||||
{
|
||||
let time = start_time.elapsed().as_millis() as i32;
|
||||
let mem = memory.data_mut(&mut store);
|
||||
mem[64..68].copy_from_slice(&time.to_le_bytes());
|
||||
}
|
||||
while !outer_buffer.is_empty() {
|
||||
store.set_epoch_deadline(30);
|
||||
while pending_updates
|
||||
.first()
|
||||
.into_iter()
|
||||
.any(|u| u.time.wrapping_sub(current_time) <= 0)
|
||||
{
|
||||
let update = pending_updates.remove(0);
|
||||
memory.write(&mut store, 80, &update.data).unwrap();
|
||||
}
|
||||
|
||||
if let Some(ref mut resampler) = resampler {
|
||||
while !buffer.is_empty() {
|
||||
let copy_size = resampler.output_buffers[0]
|
||||
.len()
|
||||
.saturating_sub(resampler.output_index)
|
||||
.min(buffer.len() / 2);
|
||||
if copy_size == 0 {
|
||||
resampler.input_buffers[0].clear();
|
||||
resampler.input_buffers[1].clear();
|
||||
for _ in 0..resampler.resampler.input_frames_next() {
|
||||
resampler.input_buffers[0]
|
||||
.push(snd.call(&mut store, (sample_index,)).unwrap_or(0.0));
|
||||
resampler.input_buffers[1]
|
||||
.push(snd.call(&mut store, (sample_index + 1,)).unwrap_or(0.0));
|
||||
sample_index = sample_index.wrapping_add(2);
|
||||
}
|
||||
let duration = if let Some(update) = pending_updates.first() {
|
||||
((update.time.wrapping_sub(current_time) as usize) * sample_rate + 999) / 1000
|
||||
} else {
|
||||
outer_buffer.len()
|
||||
};
|
||||
let step_size = (duration.max(64) * 2).min(outer_buffer.len());
|
||||
|
||||
resampler
|
||||
.resampler
|
||||
.process_into_buffer(
|
||||
&resampler.input_buffers,
|
||||
&mut resampler.output_buffers,
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
resampler.output_index = 0;
|
||||
} else {
|
||||
for i in 0..copy_size {
|
||||
buffer[i * 2] = resampler.output_buffers[0][resampler.output_index + i];
|
||||
buffer[i * 2 + 1] =
|
||||
resampler.output_buffers[1][resampler.output_index + i];
|
||||
let mut buffer = &mut outer_buffer[..step_size];
|
||||
|
||||
{
|
||||
let mem = memory.data_mut(&mut store);
|
||||
mem[64..68].copy_from_slice(¤t_time.to_le_bytes());
|
||||
}
|
||||
|
||||
if let Some(ref mut resampler) = resampler {
|
||||
while !buffer.is_empty() {
|
||||
let copy_size = resampler.output_buffers[0]
|
||||
.len()
|
||||
.saturating_sub(resampler.output_index)
|
||||
.min(buffer.len() / 2);
|
||||
if copy_size == 0 {
|
||||
resampler.input_buffers[0].clear();
|
||||
resampler.input_buffers[1].clear();
|
||||
for _ in 0..resampler.resampler.input_frames_next() {
|
||||
resampler.input_buffers[0]
|
||||
.push(snd.call(&mut store, (sample_index,)).unwrap_or(0.0));
|
||||
resampler.input_buffers[1]
|
||||
.push(snd.call(&mut store, (sample_index + 1,)).unwrap_or(0.0));
|
||||
sample_index = sample_index.wrapping_add(2);
|
||||
}
|
||||
|
||||
resampler
|
||||
.resampler
|
||||
.process_into_buffer(
|
||||
&resampler.input_buffers,
|
||||
&mut resampler.output_buffers,
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
resampler.output_index = 0;
|
||||
} else {
|
||||
for i in 0..copy_size {
|
||||
buffer[i * 2] =
|
||||
resampler.output_buffers[0][resampler.output_index + i];
|
||||
buffer[i * 2 + 1] =
|
||||
resampler.output_buffers[1][resampler.output_index + i];
|
||||
}
|
||||
resampler.output_index += copy_size;
|
||||
buffer = &mut buffer[copy_size * 2..];
|
||||
}
|
||||
resampler.output_index += copy_size;
|
||||
buffer = &mut buffer[copy_size * 2..];
|
||||
}
|
||||
} else {
|
||||
for v in buffer {
|
||||
*v = snd.call(&mut store, (sample_index,)).unwrap_or(0.0);
|
||||
sample_index = sample_index.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for v in buffer {
|
||||
*v = snd.call(&mut store, (sample_index,)).unwrap_or(0.0);
|
||||
sample_index = sample_index.wrapping_add(1);
|
||||
}
|
||||
|
||||
outer_buffer = &mut outer_buffer[step_size..];
|
||||
current_time =
|
||||
current_time.wrapping_add((step_size * 500 / sample_rate).max(1) as i32);
|
||||
}
|
||||
},
|
||||
move |err| {
|
||||
|
||||
62
test/drawing_test.cwa
Normal file
62
test/drawing_test.cwa
Normal file
@@ -0,0 +1,62 @@
|
||||
include "../examples/include/microw8-api.cwa"
|
||||
|
||||
global mut counter = 0;
|
||||
|
||||
export fn upd() {
|
||||
cls(0);
|
||||
|
||||
let col: i32 = 1;
|
||||
|
||||
loop colors {
|
||||
if !testCircle(counter, col) {
|
||||
printInt(counter);
|
||||
return;
|
||||
}
|
||||
counter += 1;
|
||||
branch_if (col +:= 1) < 256: colors;
|
||||
}
|
||||
}
|
||||
|
||||
fn testCircle(seed: i32, col: i32) -> i32 {
|
||||
randomSeed(seed);
|
||||
let cx = randomf() * 640_f - 160_f;
|
||||
let cy = randomf() * 480_f - 120_f;
|
||||
let radius = randomf() * 4_f;
|
||||
radius *= radius;
|
||||
radius *= radius;
|
||||
|
||||
circle(cx, cy, radius, col);
|
||||
|
||||
let min_x = max(0_f, floor(cx - radius - 1_f)) as i32;
|
||||
let min_y = max(0_f, floor(cy - radius - 1_f)) as i32;
|
||||
let max_x = min(320_f, ceil(cx + radius + 1_f)) as i32;
|
||||
let max_y = min(240_f, ceil(cy + radius + 1_f)) as i32;
|
||||
|
||||
let x = min_x;
|
||||
loop xloop {
|
||||
if x < max_x {
|
||||
let y = min_y;
|
||||
loop yloop {
|
||||
if y < max_y {
|
||||
let rx = x as f32 + 0.5 - cx;
|
||||
let ry = y as f32 + 0.5 - cy;
|
||||
let d = sqrt(rx*rx + ry*ry) - radius;
|
||||
if abs(d) > 0.001 {
|
||||
let is_inside = d < 0_f;
|
||||
let is_plotted = getPixel(x, y) == col;
|
||||
if is_inside != is_plotted {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
y += 1;
|
||||
branch yloop;
|
||||
}
|
||||
}
|
||||
x += 1;
|
||||
branch xloop;
|
||||
}
|
||||
}
|
||||
|
||||
1
|
||||
}
|
||||
20
test/frame_time.cwa
Normal file
20
test/frame_time.cwa
Normal file
@@ -0,0 +1,20 @@
|
||||
include "../examples/include/microw8-api.cwa"
|
||||
|
||||
global mut pos = 0;
|
||||
global mut next = 0;
|
||||
|
||||
export fn upd() {
|
||||
let lazy t = 32!32;
|
||||
let lazy tick = t * 6 / 100;
|
||||
let lazy rel = t - tick * 100 / 6;
|
||||
|
||||
setBackgroundColor(select(tick == next, 0, select(tick < next, 0x35, 0x55)));
|
||||
setCursorPosition(pos % 13 * 3, pos / 13 % 30);
|
||||
if rel < 10 {
|
||||
printChar(32);
|
||||
}
|
||||
printInt(rel);
|
||||
|
||||
pos = pos + 1;
|
||||
next = tick + 1;
|
||||
}
|
||||
7
test/log.cwa
Normal file
7
test/log.cwa
Normal file
@@ -0,0 +1,7 @@
|
||||
include "../examples/include/microw8-api.cwa"
|
||||
|
||||
export fn upd() {
|
||||
printChar('\06f: ');
|
||||
printInt(32!32 * 6 / 100);
|
||||
printChar('\n\4');
|
||||
}
|
||||
2
uw8-tool/Cargo.lock
generated
2
uw8-tool/Cargo.lock
generated
@@ -189,7 +189,7 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
[[package]]
|
||||
name = "upkr"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/exoticorn/upkr.git?rev=2e7983fc#2e7983fc650788d98da2eecef2d16f63e849e4a0"
|
||||
source = "git+https://github.com/exoticorn/upkr.git?rev=d93aec186c9fb91d962c488682a2db125c61306c#d93aec186c9fb91d962c488682a2db125c61306c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cdivsufsort",
|
||||
|
||||
@@ -11,5 +11,5 @@ wasm-encoder = "0.8"
|
||||
walrus = "0.19"
|
||||
anyhow = "1"
|
||||
pico-args = "0.4"
|
||||
upkr = { git = "https://github.com/exoticorn/upkr.git", rev = "2e7983fc" }
|
||||
upkr = { git = "https://github.com/exoticorn/upkr.git", rev = "d93aec186c9fb91d962c488682a2db125c61306c" }
|
||||
pbr = "1"
|
||||
@@ -286,7 +286,7 @@ impl BaseModule {
|
||||
|
||||
pub fn create_binary(path: &Path) -> Result<()> {
|
||||
let base1 = BaseModule::for_format_version(1)?.to_wasm();
|
||||
let data = upkr::pack(&base1, 4, None);
|
||||
let data = upkr::pack(&base1, 4, false, None);
|
||||
File::create(path)?.write_all(&data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
mod base_module;
|
||||
mod pack;
|
||||
mod filter_exports;
|
||||
mod pack;
|
||||
|
||||
pub use base_module::BaseModule;
|
||||
pub use pack::{pack, pack_file, unpack, unpack_file, PackConfig};
|
||||
pub use filter_exports::filter_exports;
|
||||
pub use pack::{pack, pack_file, unpack, unpack_file, PackConfig};
|
||||
|
||||
pub fn compressed_size(cart: &[u8]) -> f32 {
|
||||
if cart[0] != 2 {
|
||||
cart.len() as f32
|
||||
} else {
|
||||
upkr::compressed_size(&cart[1..]) + 1.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ pub fn pack(data: &[u8], config: &PackConfig) -> Result<Vec<u8>> {
|
||||
uw8.extend_from_slice(&upkr::pack(
|
||||
&result[8..],
|
||||
level,
|
||||
false,
|
||||
Some(&mut |pos| {
|
||||
pb.set(pos as u64);
|
||||
}),
|
||||
@@ -89,7 +90,7 @@ pub fn unpack(data: Vec<u8>) -> Result<Vec<u8>> {
|
||||
let (version, data) = match data[0] {
|
||||
0 => return Ok(data),
|
||||
1 => (1, data[1..].to_vec()),
|
||||
2 => (1, upkr::unpack(&data[1..])),
|
||||
2 => (1, upkr::unpack(&data[1..], false)),
|
||||
other => bail!("Uknown format version {}", other),
|
||||
};
|
||||
|
||||
@@ -962,6 +963,8 @@ fn remap_function(
|
||||
De::I64TruncSatF32U => En::I64TruncSatF32U,
|
||||
De::I64TruncSatF64S => En::I64TruncSatF64S,
|
||||
De::I64TruncSatF64U => En::I64TruncSatF64U,
|
||||
De::MemoryCopy { src, dst } => En::MemoryCopy { src, dst },
|
||||
De::MemoryFill { mem } => En::MemoryFill(mem),
|
||||
other => bail!("Unsupported instruction {:?}", other),
|
||||
});
|
||||
}
|
||||
|
||||
57
web/opus-repro.html
Normal file
57
web/opus-repro.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<button onclick="go()">Go!</button>
|
||||
<canvas id="screen" width="320" height="240"></canvas>
|
||||
<video id="video"></video>
|
||||
<script>
|
||||
function go() {
|
||||
let audioContext = new AudioContext({sampleRate: 44100});
|
||||
|
||||
let oscillator = new OscillatorNode(audioContext);
|
||||
let gain = new GainNode(audioContext, {gain: 1});
|
||||
oscillator.connect(gain);
|
||||
gain.connect(audioContext.destination);
|
||||
for(let i = 0; i < 8; ++i ) {
|
||||
gain.gain.setValueAtTime(1, i / 2);
|
||||
gain.gain.setValueAtTime(0, i / 2 + 0.3);
|
||||
}
|
||||
oscillator.start();
|
||||
oscillator.stop(4);
|
||||
|
||||
let screen = document.getElementById('screen');
|
||||
let context = screen.getContext('2d');
|
||||
let startTime = Date.now();
|
||||
let drawFrame = () => {
|
||||
let time = Date.now() - startTime;
|
||||
context.fillStyle = 'white';
|
||||
context.fillRect(0, 0, 320, 240);
|
||||
if(time < 4000) {
|
||||
if(time % 500 < 300) {
|
||||
context.fillStyle = 'black';
|
||||
context.fillRect(time / 15, 50, 50, 50);
|
||||
}
|
||||
window.requestAnimationFrame(drawFrame);
|
||||
}
|
||||
};
|
||||
drawFrame();
|
||||
|
||||
let stream = screen.captureStream();
|
||||
let audioStreamNode = audioContext.createMediaStreamDestination();
|
||||
gain.connect(audioStreamNode);
|
||||
stream.addTrack(audioStreamNode.stream.getAudioTracks()[0]);
|
||||
let recorder = new MediaRecorder(stream, { mimeType: 'video/webm' });
|
||||
|
||||
let chunks = [];
|
||||
recorder.ondataavailable = e => chunks.push(e.data);
|
||||
recorder.onstop = () => {
|
||||
let blob = new Blob(chunks, {type: 'video/webm'});
|
||||
let url = URL.createObjectURL(blob);
|
||||
let video = document.getElementById('video');
|
||||
video.src = url;
|
||||
video.play();
|
||||
};
|
||||
|
||||
recorder.start();
|
||||
setTimeout(() => recorder.stop(), 4000);
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
@@ -3,13 +3,17 @@ class APU extends AudioWorkletProcessor {
|
||||
constructor() {
|
||||
super();
|
||||
this.sampleIndex = 0;
|
||||
this.currentTime = 0;
|
||||
this.isFirstMessage = true;
|
||||
this.pendingUpdates = [];
|
||||
this.port.onmessage = (ev) => {
|
||||
if(this.memory) {
|
||||
if(isNaN(ev.data)) {
|
||||
U8(this.memory.buffer, 80, 32).set(U8(ev.data));
|
||||
} else {
|
||||
this.startTime = ev.data;
|
||||
if(this.isFirstMessage)
|
||||
{
|
||||
this.currentTime += (ev.data.t - this.currentTime) / 8;
|
||||
this.isFirstMessage = false;
|
||||
}
|
||||
this.pendingUpdates.push(ev.data);
|
||||
} else {
|
||||
this.load(ev.data[0], ev.data[1]);
|
||||
}
|
||||
@@ -33,6 +37,16 @@ class APU extends AudioWorkletProcessor {
|
||||
importObject.env['reserved' + i] = () => { };
|
||||
}
|
||||
|
||||
let logLine = '';
|
||||
importObject.env['logChar'] = (c) => {
|
||||
if(c == 10) {
|
||||
console.log(logLine);
|
||||
logLine = '';
|
||||
} else {
|
||||
logLine += String.fromCharCode(c);
|
||||
}
|
||||
};
|
||||
|
||||
for (let i = 0; i < 16; ++i) {
|
||||
importObject.env['g_reserved' + i] = 0;
|
||||
}
|
||||
@@ -55,9 +69,13 @@ class APU extends AudioWorkletProcessor {
|
||||
}
|
||||
|
||||
process(inputs, outputs, parameters) {
|
||||
if(this.snd && this.startTime) {
|
||||
this.isFirstMessage = true;
|
||||
if(this.snd) {
|
||||
while(this.pendingUpdates.length > 0 && this.pendingUpdates[0].t <= this.currentTime) {
|
||||
U8(this.memory.buffer, 80, 32).set(U8(this.pendingUpdates.shift().r));
|
||||
}
|
||||
let u32Mem = new Uint32Array(this.memory.buffer);
|
||||
u32Mem[16] = Date.now() - this.startTime;
|
||||
u32Mem[16] = this.currentTime;
|
||||
let channels = outputs[0];
|
||||
let index = this.sampleIndex;
|
||||
let numSamples = channels[0].length;
|
||||
@@ -66,6 +84,7 @@ class APU extends AudioWorkletProcessor {
|
||||
channels[1][i] = this.snd(index++);
|
||||
}
|
||||
this.sampleIndex = index & 0xffffffff;
|
||||
this.currentTime += numSamples / 44.1;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="uw8">
|
||||
<a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.2.0-rc1
|
||||
<a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.2.0
|
||||
</div>
|
||||
<div id="centered">
|
||||
<canvas class="screen" id="screen" width="320" height="240">
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function MicroW8(screen, config = {}) {
|
||||
audioContext.close();
|
||||
keepRunning = false;
|
||||
abortController.abort();
|
||||
}
|
||||
};
|
||||
|
||||
let cartridgeSize = data.byteLength;
|
||||
|
||||
@@ -206,6 +206,16 @@ export default function MicroW8(screen, config = {}) {
|
||||
importObject.env['reserved' + i] = () => { };
|
||||
}
|
||||
|
||||
let logLine = '';
|
||||
importObject.env['logChar'] = (c) => {
|
||||
if(c == 10) {
|
||||
console.log(logLine);
|
||||
logLine = '';
|
||||
} else {
|
||||
logLine += String.fromCharCode(c);
|
||||
}
|
||||
};
|
||||
|
||||
for (let i = 0; i < 16; ++i) {
|
||||
importObject.env['g_reserved' + i] = 0;
|
||||
}
|
||||
@@ -232,7 +242,6 @@ export default function MicroW8(screen, config = {}) {
|
||||
let startTime = Date.now();
|
||||
|
||||
const timePerFrame = 1000 / 60;
|
||||
let nextFrame = startTime;
|
||||
|
||||
audioNode.connect(audioContext.destination);
|
||||
|
||||
@@ -244,18 +253,16 @@ export default function MicroW8(screen, config = {}) {
|
||||
isPaused = false;
|
||||
audioContext.resume();
|
||||
startTime += now - pauseTime;
|
||||
audioNode.port.postMessage(startTime);
|
||||
} else {
|
||||
isPaused = true;
|
||||
audioContext.suspend();
|
||||
pauseTime = now;
|
||||
audioNode.port.postMessage(0);
|
||||
}
|
||||
};
|
||||
window.addEventListener('focus', () => updateVisibility(true), { signal: abortController.signal });
|
||||
window.addEventListener('blur', () => updateVisibility(false), { signal: abortController.signal });
|
||||
updateVisibility(document.hasFocus());
|
||||
|
||||
|
||||
function mainloop() {
|
||||
if (!keepRunning) {
|
||||
return;
|
||||
@@ -263,6 +270,7 @@ export default function MicroW8(screen, config = {}) {
|
||||
|
||||
try {
|
||||
let restart = false;
|
||||
let thisFrame;
|
||||
if (!isPaused) {
|
||||
let gamepads = navigator.getGamepads();
|
||||
let gamepad = 0;
|
||||
@@ -291,7 +299,8 @@ export default function MicroW8(screen, config = {}) {
|
||||
}
|
||||
|
||||
let u32Mem = U32(memory.buffer);
|
||||
u32Mem[16] = Date.now() - startTime;
|
||||
let time = Date.now() - startTime;
|
||||
u32Mem[16] = time;
|
||||
u32Mem[17] = pad | gamepad;
|
||||
if(instance.exports.upd) {
|
||||
instance.exports.upd();
|
||||
@@ -300,21 +309,26 @@ export default function MicroW8(screen, config = {}) {
|
||||
|
||||
let soundRegisters = new ArrayBuffer(32);
|
||||
U8(soundRegisters).set(U8(memory.buffer, 80, 32));
|
||||
audioNode.port.postMessage(soundRegisters, [soundRegisters]);
|
||||
audioNode.port.postMessage({t: time, r: soundRegisters}, [soundRegisters]);
|
||||
|
||||
let palette = U32(memory.buffer, 0x13000, 1024);
|
||||
for (let i = 0; i < 320 * 240; ++i) {
|
||||
buffer[i] = palette[memU8[i + 120]] | 0xff000000;
|
||||
}
|
||||
canvasCtx.putImageData(imageData, 0, 0);
|
||||
|
||||
let timeOffset = ((time * 6) % 100 - 50) / 6;
|
||||
thisFrame = startTime + time - timeOffset / 8;
|
||||
} else {
|
||||
thisFrame = Date.now();
|
||||
}
|
||||
let now = Date.now();
|
||||
nextFrame = Math.max(nextFrame + timePerFrame, now);
|
||||
let nextFrame = Math.max(thisFrame + timePerFrame, now);
|
||||
|
||||
if (restart) {
|
||||
runModule(currentData);
|
||||
} else {
|
||||
window.setTimeout(mainloop, Math.round(nextFrame - now))
|
||||
window.setTimeout(mainloop, nextFrame - now)
|
||||
}
|
||||
} catch (err) {
|
||||
config.setMessage(cartridgeSize, err.toString());
|
||||
|
||||
1158
web/yarn.lock
1158
web/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user