-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (46 loc) · 1012 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import "github.com/doracpphp/GameBoyEmulator_Golang/gameboy"
import (
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
)
import "fmt"
func main() {
cpu := gameboy.NewGameboy()
/*for {
opcode := cpu.Memory[cpu.Registers.PC]
cpu.Registers.PC+=1
fmt.Printf("Opcode : %04X\n",opcode)
cpu.Inst[opcode](cpu)
cpu.Debug()
}
*/
cpu.Registers.A = 0x5
cpu.Registers.B = 0x4
cpu.Registers.SP = 0x04
cpu.Registers.PC = 0x1
cpu.Registers.F |= 0x10
cpu.Debug()
cpu.Inst[0x51](cpu)
cpu.Debug()
cart, err := cpu.Memory.Cartridge.NewCartridgeFile("/Users/main/Documents/LT_Program/GameBoyEmu/src/Tetris.gb")
if err != nil {
fmt.Println("error ", err)
}
fmt.Println(cart.GetName())
fmt.Printf("%08b\n", cpu.Memory.Read(0xFF00))
pixelgl.Run(run)
}
func run() {
cfg := pixelgl.WindowConfig{
Title: "Gameboy Emulator",
Bounds: pixel.R(0, 0, 160, 140),
}
win, err := pixelgl.NewWindow(cfg)
if err != nil {
panic(err)
}
for !win.Closed() {
win.Update()
}
}