Split files to domains.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user