this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #2204 from soxfox42/rust-docs-update

Update Rust template to remove optimisation issue

authored by

Vadim Grigoruk and committed by
GitHub
0509a6e4 6b87ce56

+2 -4
-1
templates/rust/Cargo.toml
··· 10 10 buddy-alloc = { version = "0.4.1", optional = true } 11 11 12 12 [profile.release] 13 - opt-level = 0 14 13 lto = true 15 14 strip = true 16 15
+2 -3
templates/rust/README.md
··· 1 1 # Rust Starter Project Template 2 2 3 3 ## Important Note 4 - This template currently produces unoptimised builds. This is required due to TIC-80's memory layout placing data at the address 0, which Rust does not understand. 5 - If you aren't using direct framebuffer access, you should be able to use another level by changing the `Cargo.toml`. 4 + Don't access TIC-80's I/O memory by dereferencing raw pointers. The optimiser will ruin attempts to do this, because Rust has no equivalent to C's `volatile` for direct access. Instead, use [`std::ptr::read_volatile`](https://doc.rust-lang.org/std/ptr/fn.read_volatile.html) and [`std::ptr::write_volatile`](https://doc.rust-lang.org/std/ptr/fn.write_volatile.html), or just use the standard TIC-80 `peek`/`poke`. 6 5 7 6 This is a Rust / TIC-80 starter template. Before using it, make sure you have installed the `wasm32-unknown-unknown` target using rustup: 8 7 ``` ··· 37 36 ``` 38 37 wasm-opt -Os target/wasm32-unknown-unknown/release/cart.wasm -o cart.wasm 39 38 ``` 40 - This will create a new, smaller `cart.wasm` file in the working directory. 39 + This will create a new, smaller `cart.wasm` file in the working directory.