Fighting the wasm build...

This commit is contained in:
2026-07-02 10:20:35 +02:00
parent 747702d256
commit ec8bcdb5ed
8 changed files with 225 additions and 43 deletions
+14 -13
View File
@@ -1,7 +1,5 @@
package machine
import "core:log"
// System struct, init, constants, fontset
System :: struct {
@@ -48,7 +46,7 @@ FONT_SET := [80]u8 {
}
init :: proc() -> System {
log.info("Booting chip 8 cpu")
// log.info("Booting chip 8 cpu")
// Structs are zero initialized so timers, sp etc are good.
s := System { pc = 0x200 }
@@ -69,17 +67,20 @@ run_machine :: proc(s: ^System, cycles: int) {
}
}
new_machine :: proc() -> System {
s: System
s.pc = 0x200
s.current_key = -1
// load fonts into the memory
reset_machine :: proc(s: ^System) {
s.memory = {}
s.v = {}
s.stack = {}
s.sp = 0
s.i = 0
s.pc = 0x200
s.display = {}
s.keypad = {}
s.current_key = -1
s.delay_timer = 0
s.sound_timer = 0
for v, i in FONT_SET {
s.memory[i] = v
}
return s
}
reset_machine :: proc(s: ^System) {
s^ = new_machine()
}