Re: TIC-80 WebAssembly: pointers to fixed addresses

2022-04-17 Thread Pierce Ng via Digitalmars-d-learn
On Saturday, 16 April 2022 at 20:36:12 UTC, Adam Ruppe wrote: __gshared ubyte[] framebuffer = (cast(ubyte*) 0) [0 .. 16320]; ubyte[] framebuffer() { return (cast(ubyte*) 0) [0 .. 16320]; } Thank you, Adam. I'll go with both, as existing examples in other languages use pointer arithmetic. N

Re: TIC-80 WebAssembly: pointers to fixed addresses

2022-04-16 Thread Adam Ruppe via Digitalmars-d-learn
On Saturday, 16 April 2022 at 14:29:09 UTC, Pierce Ng wrote: ``` pub const FRAMEBUFFER: *allowzero volatile [16320]u8 = @intToPtr(*allowzero volatile [16320]u8, 0); pub const TILES : *[8192]u8 = @intToPtr(*[8192]u8, 0x4000); pub const SPRITES : *[8192]u8 = @intToPtr(*[8192]u8, 0x6000); ``` I b

TIC-80 WebAssembly: pointers to fixed addresses

2022-04-16 Thread Pierce Ng via Digitalmars-d-learn
Hi all, D newbie here. I'm building a D WebAssembly binding for [TIC-80](https://github.com/nesbox/TIC-80), a fantasy gaming console. TIC-80 has a [fixed size RAM](https://github.com/nesbox/TIC-80/wiki/RAM) that is directly addressable by a running program using peek() and poke() functions