Split files to domains.

This commit is contained in:
2026-05-16 09:13:38 +02:00
parent 8ff22fac55
commit beb2faa1ed
5 changed files with 82 additions and 30 deletions
+2 -28
View File
@@ -1,8 +1,9 @@
package machine
import "core:os"
import "core:log"
// System struct, init, constants, fontset
System :: struct {
// 4kb ram
memory: [4096]u8,
@@ -55,30 +56,3 @@ init :: proc() -> System {
return s
}
load_rom :: proc(s: ^System, file_path: string) -> os.Error {
log.info("Loading rom from file")
data, read_err := os.read_entire_file(file_path, context.allocator)
if read_err != os.ERROR_NONE {
log.errorf("failed to read rom %v", read_err)
return read_err
}
defer delete(data)
for byte,i in data {
s.memory[0x200 + i] = byte
}
log.infof("First few bytes: %X %X %X %X", s.memory[0x200], s.memory[0x201], s.memory[0x202], s.memory[0x203])
return nil
}
// fetch decode execute loop
run :: proc(s: ^System) {
log.info("=== TODO loop ===")
// maybe needs a few functions for the 'screen' ie raylib.
// also a cycle function or something that will do the ops
}