Skip to content

Commit

Permalink
(chore) update Zig source to use new BOOT()
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Mar 21, 2022
1 parent aeffb6d commit d7d5240
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion demos/bunny/wasmmark/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ pub fn build(b: *std.build.Builder) void {
// so our own usage must start above the 96kb mark
lib.global_base = 96 * 1024;
lib.stack_size = 8192;
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "INIT" };
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "BOOT" };
lib.install();
}
19 changes: 6 additions & 13 deletions demos/bunny/wasmmark/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const MAX_BUNNIES = 1200;
var fps : FPS = undefined;
var bunnyCount : usize = 0;
var bunnies : [MAX_BUNNIES]Bunny = undefined;
var started = false;

fn addBunny() void {
if (bunnyCount >= MAX_BUNNIES) return;
Expand All @@ -111,16 +110,6 @@ fn removeBunny() void {
bunnyCount -= 1;
}

fn start() void {
rnd = RndGen.init(0).random();
fps.initFPS();
addBunny();
started = true;

// tic.ZERO = tic.FIRST + 1;
}


export fn testscreen() void {
var i : usize = 0;

Expand All @@ -134,9 +123,13 @@ export fn testscreen() void {
}
}

export fn TIC() void {
if (!started) { start(); }
export fn BOOT() void {
rnd = RndGen.init(0).random();
fps.initFPS();
addBunny();
}

export fn TIC() void {
if (t==0) {
tic.music(0, .{});
}
Expand Down
2 changes: 1 addition & 1 deletion demos/wasm/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ pub fn build(b: *std.build.Builder) void {
// so our own usage must start above the 96kb mark
lib.global_base = 96 * 1024;
lib.stack_size = 8192;
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "INIT" };
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "BOOT" };
lib.install();
}
2 changes: 1 addition & 1 deletion templates/zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ pub fn build(b: *std.build.Builder) void {
// so our own usage must start above the 96kb mark
lib.global_base = 96 * 1024;
lib.stack_size = 8192;
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "INIT" };
lib.export_symbol_names = &[_][]const u8{ "TIC", "OVR", "BDR", "SCR", "BOOT" };
lib.install();
}
10 changes: 3 additions & 7 deletions templates/zig/src/main.zig
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
const tic = @import("tic80.zig");

var started = false;

fn start() void {
}

const TICGuy = struct {
x : i32 = 96,
y : i32 = 24,
Expand All @@ -13,9 +8,10 @@ const TICGuy = struct {
var t : u16 = 0;
var mascot : TICGuy = .{};

export fn TIC() void {
if (!started) { start(); }
export fn BOOT() void {
}

export fn TIC() void {
if (tic.btn(0) != 0) {
mascot.y -= 1;
}
Expand Down
Empty file modified tools/zig_sync
100644 → 100755
Empty file.

0 comments on commit d7d5240

Please sign in to comment.