mirror of
https://github.com/macocianradu/goboy.git
synced 2026-03-18 13:00:07 +00:00
basic memory and cpu
This commit is contained in:
29
cpu/cpu.go
Normal file
29
cpu/cpu.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"radu.macocian.me/goboy/memory"
|
||||
)
|
||||
|
||||
type cpu_struct struct {
|
||||
A int8
|
||||
F int8
|
||||
B int8
|
||||
C int8
|
||||
D int8
|
||||
E int8
|
||||
H int8
|
||||
L int8
|
||||
IR int8
|
||||
IE int8
|
||||
|
||||
PC int16
|
||||
SP int16
|
||||
}
|
||||
|
||||
var cpu = new(cpu_struct)
|
||||
|
||||
func Execute(addr int) {
|
||||
instr := memory.Read(addr + int(cpu.PC))
|
||||
cpu.PC++
|
||||
print(string(instr))
|
||||
}
|
||||
Reference in New Issue
Block a user