humpheh / goboy Goto Github PK
View Code? Open in Web Editor NEWMulti-platform Nintendo Game Boy Color emulator written in Go
Home Page: https://humpheh.github.io/goboy/
License: MIT License
Multi-platform Nintendo Game Boy Color emulator written in Go
Home Page: https://humpheh.github.io/goboy/
License: MIT License
./goboy -dmg dmg_sound.gb
Tests passed
On the 12th test, goboy crashes:
panic: runtime error: index out of range
goroutine 19 [running]:
github.com/Humpheh/goboy/pkg/cart.(*MBC1).Read(0xc00012d700, 0xc000014000, 0x400000c0000a5400)
/home/bell/github/goboy/pkg/cart/mbc1.go:30 +0xb7
github.com/Humpheh/goboy/pkg/gb.(*Memory).Read(0xc000116000, 0xc0000b4000, 0x4c000040)
/home/bell/github/goboy/pkg/gb/memory.go:271 +0x1cf
github.com/Humpheh/goboy/pkg/gb.(*Gameboy).ExecuteOpcode(0xc0000f4000, 0xc0000d0b1a)
/home/bell/github/goboy/pkg/gb/instructions.go:132 +0xad8
github.com/Humpheh/goboy/pkg/gb.(*Gameboy).ExecuteNextOpcode(0xc0000f4000, 0x0)
/home/bell/github/goboy/pkg/gb/instructions.go:52 +0x62
github.com/Humpheh/goboy/pkg/gb.(*Gameboy).Update(0xc0000f4000, 0xc0000b1d01)
/home/bell/github/goboy/pkg/gb/gameboy.go:81 +0x119
main.startGB(0xc0000f4000, 0x76d0a0, 0xc0000a28c0)
/home/bell/github/goboy/cmd/goboy/main.go:136 +0x237
main.start(0x7ffd676cb33a, 0x2b)
/home/bell/github/goboy/cmd/goboy/main.go:113 +0x43c
main.main.func1()
/home/bell/github/goboy/cmd/goboy/main.go:60 +0x33
github.com/faiface/mainthread.Run.func1(0xc0000a2820, 0xc000078240)
/home/bell/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:37 +0x27
created by github.com/faiface/mainthread.Run
/home/bell/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:36 +0xb1
go version go1.11.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bell/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bell/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bell/github/goboy/go.mod"
GOROOT/bin/go version: go version go1.11.2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.2
uname -sr: Linux 4.19.2-arch1-1-ARCH
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.28.
gdb --version: GNU gdb (GDB) 8.2
are them in the project?
./goboy mem_timing.gb
Tests passed
Failed 3 tests:
Sound: true
CGB : true
2018/11/23 12:31:48 Cart type: 0x01 (MBC1)
go version go1.11.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bell/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bell/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bell/github/goboy/go.mod"
GOROOT/bin/go version: go version go1.11.2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.2
uname -sr: Linux 4.19.2-arch1-1-ARCH
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.28.
gdb --version: GNU gdb (GDB) 8.2
./goboy cgb_sound.gb
Tests passed
go version go1.11.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bell/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bell/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bell/github/goboy/go.mod"
GOROOT/bin/go version: go version go1.11.2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.2
uname -sr: Linux 4.19.2-arch1-1-ARCH
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.28.
gdb --version: GNU gdb (GDB) 8.2
Describe the bug
Sound is clear on MacOS, but noisy on Windows10. Linux is unchecked.
To Reproduce
git clone https://github.com/Humpheh/goboy.git
cd goboy
go build -o goboy cmd/goboy/main.go
./goboy pokered.gb
Expected behaviour
A clear sound on Windows10.
System Details:
I tried Pokemon Red(en)
& Legend of Zelda Link's Awakening DX(en)
, and both were noisy.
CPU: Intel Core i5-8250U
RAM: 16.0GB
OS: Windows 10 Home 1909
$ go version
go version go1.15.6 windows/amd64
Describe the bug
A clear and concise description of what the bug is. If applicable, add screenshots to help explain your problem.
When I start the game, it begins writing save state to .sav. When I relaunch the game it doesn't autoload from the .sav file and running Goboy with the .sav file doesn't work either.
To Reproduce
What did you run and do?
I started Pokemon Red and played for a bit. Closed out of the game and restarted the game and no save state.
Expected behaviour
A clear and concise description of what you expected to happen.
I expect the game to load from the .sav file.
System Details:
Please paste the outputs of go version
and go env
. If you were running from a binary, please detail your OS.
go version go1.10.3 linux/amd64
[dymurray@pups ~]$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dymurray/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dymurray/go"
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build386047923=/tmp/go-build -gno-record-gcc-switches"
The battery backed Real Time Clock (RTC) on some memory bank controllers is not implemented.
./goboy cgb_sound.gb
Tests passed
Test Failed:
Sound: true
CGB : true
2018/11/23 12:28:52 Cart type: 0x02 (MBC1)
2018/11/23 12:28:53 0x10 (STOP) unimplemented (is 0x00 follows)
go version go1.11.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bell/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bell/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bell/github/goboy/go.mod"
GOROOT/bin/go version: go version go1.11.2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.11.2
uname -sr: Linux 4.19.2-arch1-1-ARCH
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.28.
gdb --version: GNU gdb (GDB) 8.2
Since I can't access golang.org
, I remove go.sum
and go.mod
. Then I manually download the dependencies from github
. But now I am having problems running. I want to know what is wrong.
# github.com/go-gl/glfw/v3.2/glfw
In file included from ../../go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:24:0:
../../go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c: In function ‘_glfwInitJoysticksLinux’:
../../go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 9 [-Wformat-truncation=]
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
^~~~~~~
In file included from /usr/include/stdio.h:862:0,
from /usr/include/X11/Xcursor/Xcursor.h:26,
from ../../go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_platform.h:39,
from ../../go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/internal.h:169,
from ../../go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_init.c:28,
from ../../go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:19:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 12 and 267 bytes into a destination of size 20
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ws-zzy/code/goboy/go_build_main_go #gosetup
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7fc12bdf0fa0]
runtime stack:
runtime.throw(0x71a5fa, 0x2a)
/usr/local/go/src/runtime/panic.go:608 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:374 +0x2f2
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x6335e0, 0xc00009fb80, 0x25f50a0)
/usr/local/go/src/runtime/cgocall.go:128 +0x5e fp=0xc00009fb50 sp=0xc00009fb18 pc=0x46653e
github.com/mattn/go-gtk/gtk._Cfunc_gtk_dialog_run(0x25f50a0, 0x0)
_cgo_gotypes.go:7705 +0x49 fp=0xc00009fb80 sp=0xc00009fb50 pc=0x55e5a9
github.com/mattn/go-gtk/gtk.(*Dialog).Run.func1(0x25f50a0, 0x25f50a0)
/home/ws-zzy/go/src/github.com/mattn/go-gtk/gtk/gtk.go:1236 +0x56 fp=0xc00009fbb8 sp=0xc00009fb80 pc=0x57a286
github.com/mattn/go-gtk/gtk.(*Dialog).Run(0xc0000100e0, 0xc00000e030)
/home/ws-zzy/go/src/github.com/mattn/go-gtk/gtk/gtk.go:1236 +0x39 fp=0xc00009fbd8 sp=0xc00009fbb8 pc=0x56b729
github.com/Humpheh/goboy/dialog.chooseFile(0x70b346, 0x4, 0x0, 0xc00009fe30, 0x0, 0x0, 0x0, 0x0)
/home/ws-zzy/go/src/github.com/Humpheh/goboy/dialog/dlgs_linux.go:68 +0x35e fp=0xc00009fd38 sp=0xc00009fbd8 pc=0x598c4e
github.com/Humpheh/goboy/dialog.(*FileBuilder).load(0xc00009fe30, 0x0, 0x6987a0, 0xc0000d0120, 0xc00005a100)
/home/ws-zzy/go/src/github.com/Humpheh/goboy/dialog/dlgs_linux.go:40 +0x49 fp=0xc00009fd88 sp=0xc00009fd38 pc=0x598689
github.com/Humpheh/goboy/dialog.(*FileBuilder).Load(0xc00009fe30, 0x0, 0x0, 0x0, 0x1)
/home/ws-zzy/go/src/github.com/Humpheh/goboy/dialog/dlgs.go:101 +0x2b fp=0xc00009fdc0 sp=0xc00009fd88 pc=0x59818b
main.getROM.func1()
/home/ws-zzy/code/goboy/cmd/goboy/main.go:123 +0x1e8 fp=0xc00009fe78 sp=0xc00009fdc0 pc=0x62f6d8
github.com/faiface/mainthread.Call.func1()
/home/ws-zzy/go/src/github.com/faiface/mainthread/mainthread.go:63 +0x2f fp=0xc00009fea0 sp=0xc00009fe78 pc=0x54312f
github.com/faiface/mainthread.Run(0x71ca48)
/home/ws-zzy/go/src/github.com/faiface/mainthread/mainthread.go:44 +0xbd fp=0xc00009ff40 sp=0xc00009fea0 pc=0x542d2d
github.com/faiface/pixel/pixelgl.Run(0x71ca48)
/home/ws-zzy/go/src/github.com/faiface/pixel/pixelgl/run.go:32 +0x57 fp=0xc00009ff80 sp=0xc00009ff40 pc=0x627df7
main.main()
/home/ws-zzy/code/goboy/cmd/goboy/main.go:45 +0x32 fp=0xc00009ff98 sp=0xc00009ff80 pc=0x62eb32
runtime.main()
/usr/local/go/src/runtime/proc.go:201 +0x207 fp=0xc00009ffe0 sp=0xc00009ff98 pc=0x48f507
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc00009ffe8 sp=0xc00009ffe0 pc=0x4ba751
goroutine 19 [chan receive]:
github.com/faiface/mainthread.Call(0xc0000100d0)
/home/ws-zzy/go/src/github.com/faiface/mainthread/mainthread.go:66 +0xc2
main.getROM(0x0, 0xc0000920e0)
/home/ws-zzy/code/goboy/cmd/goboy/main.go:119 +0xbf
main.start()
/home/ws-zzy/code/goboy/cmd/goboy/main.go:53 +0x5e
github.com/faiface/mainthread.Run.func1(0x71ca48, 0xc000068240)
/home/ws-zzy/go/src/github.com/faiface/mainthread/mainthread.go:37 +0x27
created by github.com/faiface/mainthread.Run
/home/ws-zzy/go/src/github.com/faiface/mainthread/mainthread.go:36 +0xb1
Just found this project and saw one of you goals was to speed up the CPU, I think I found an optimization that can be made in the following function. Currently there is a switch statement but I think a lookup table in the form of a map[byte]func(*Gameboy)
or [numOpCodes]func(*Gameboy)
(static size array) would be more efficient.
Lines 70 to 71 in f9f78a9
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.