Skip to content

Instantly share code, notes, and snippets.

View binji's full-sized avatar

Ben Smith binji

View GitHub Profile
(import "Math" "random" (func $random (result f32)))
(import "Math" "sin" (func $sin (param f32) (result f32)))
;; Color: u32 ; ABGR
;; Cell2: u8*2 ; left/up cell, right/down cell
;; Wall: f32*5 ; (x1,y1) -> (x2, y2), and x-scale
;; [0x0000, 0x0100) u8[12*12] maze cells for Kruskal's algo
;; [0x0100, 0x0310) Cell2[12*11*2] walls for Kruskal's algo
;; [0x0400, 0x0500) u8[32*32] RLE compressed 2bpp textures
(import "Math" "random" (func $random (result f32)))
(import "Math" "sin" (func $sin (param f32) (result f32)))
(memory (export "mem") 6)
(data (i32.const 0x1000)
;; top wall
"\00\00\00\00" ;; 0.0
"\00\00\00\00" ;; 0.0
"\00\00\c0\41" ;; 24.0
(import "Math" "sin" (func $sin (param f32) (result f32)))
(memory (export "mem") 6)
(data (i32.const 0)
;; top wall
"\00\00\40\c1" ;; -12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
(import "Math" "sin" (func $sin (param f32) (result f32)))
(memory (export "mem") 6)
(data (i32.const 0)
;; top wall
"\00\00\40\c1" ;; -12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
(import "Math" "sin" (func $sin (param f32) (result f32)))
(memory (export "mem") 6)
(data (i32.const 0)
;; top wall
"\00\00\40\c1" ;; -12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
(import "Math" "sin" (func $sin (param f32) (result f32)))
(memory (export "mem") 6)
(data (i32.const 0)
;; top wall
"\00\00\40\c1" ;; -12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
"\00\00\40\41" ;; +12.0
<!doctype HTML>
<script src="test.js"></script>
diff --git a/GrahamBoy/opcode.cpp b/GrahamBoy/opcode.cpp
index a64634c..2bc7778 100644
--- a/GrahamBoy/opcode.cpp
+++ b/GrahamBoy/opcode.cpp
@@ -4,6 +4,182 @@
#include <stdio.h>
#include <iostream>
+#include <stdint.h>
+#include <assert.h>
@binji
binji / both.txt
Last active January 10, 2019 06:58
Distinct instructions executing 6000 frames of gameboy games
00: nop
02: ld [bc],a
04: inc b
06: ld b,XX
0a: ld a,[bc]
0c: inc c
0e: ld c,XX
12: ld [de],a
14: inc d
16: ld d,XX
@binji
binji / main-sdl.c
Created January 8, 2019 16:54
FunkyKarts wasm2c main
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define GL_GLEXT_PROTOTYPES