Skip to content

Commit

Permalink
Commit Message: "Major updates to README and versioning, addition of …
Browse files Browse the repository at this point in the history
…new gif and enhancements to various windows"

Added:
- New gif file 'bgb.gif' in docs.
- New constant for versioning in 'internal/root.go'.
- New sections in README for future features, installation, usage, and key bindings.

Changed:
- Updated the versioning in the title of various windows including 'cartview.go', 'cpuview.go', 'ioview.go', 'memoryview.go', and 'vramview.go'.
- Updated the game loop GUI title in 'gobc.go'.
- Updated the README with changes in the supported features and installation sections.

Removed:
- Removed the old versioning from the title of various windows.
  • Loading branch information
duysqubix committed Oct 2, 2023
1 parent f73d02b commit 5391c18
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 22 deletions.
148 changes: 134 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,45 @@ Generate GIF with the layout and captions
<td align="center">
<img src="docs/blue.gif" width="200">
</td>
</tr>
<tr>
<td align="center">
<td align="center">
<img src="docs/tetris.gif" width="200">
</td>
</tr>
<tr>
<td align="center">
<img src="docs/dr_mario.png" width="200">
</td>
</tr>
<tr>
<td align="center">
<img src="docs/cpu_instrs.png" width="200">
<td align="center">
<img src="docs/bgb.gif" width="200">
</td>
<td align="center">
<img src="docs/instr_timing.png" width="200">
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center">
<img src="docs/dmg-acid2.png" width="200">
</td>
<td align="center">
<img src="docs/cgb-acid2.png" width="200">
</td>
</td>
<td align="center">
<img src="docs/cpu_instrs.png" width="200">
</td>
</tr>
</tbody>
</table>

Supported Features
==================
- [x] Emulated CPU (LR35902)
- [x] CPU
- [ ] Double Speed Mode
- [ ] Sound
- [x] Interrupts
- [ ] Joypad
- [x] Joypad
- [ ] Serial
- [ ] Cartridges
- [x] Cartridge RAM_ONLY
Expand All @@ -68,19 +73,134 @@ Supported Features
- [ ] Cartridge Hudson HuC-1
- [ ] Cartridge Hudson HuC-3
- [x] Graphics
- [ ] FIFO
- [x] Timers
- [x] CGB Mode

Future Features
==================
List is in no particular order and is subject to change. Take a stab at any of them if you feel like it.

- [ ] Sound
- [ ] Use real Cartridges (via Arduino)
- [ ] Implement all MBCs
- [ ] Fix Links Awakening DMG (Menu is broken)


Installation

Installing GoBC
============
Compiled on Go 1.21.1, build each binary with
You need the following dependencies installed:
- [Go](https://golang.org/doc/install)
- [OpenGL](https://github.com/faiface/pixel#requirements)

Building from source
```bash
go build -o bin/cartdump cmd/cartdump/main.go && \ # Disassemble a ROM
go build -o bin/gobc cmd/gobc/main.go && \ # Main GoBC Emulator
go build -o bin/opbenchmark cmd/opbenchmark/main.go # Benchmark the CPU on current system
go build -o bin/gobc cmd/gobc/gobc.go
```

Or Install latest binary
```bash
go install github.com/duysqubix/gobc/cmd/gobc@latest
```

Usage
========

```bash
NAME:
gobc - A Gameboy emulator written in Go

USAGE:
gobc ROM_File [options]

VERSION:
0.0.1

AUTHOR:
duys <[email protected]>

COMMANDS:
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--debug Enable debug mode (default: false)
--breakpoints value Define breakpoints
--force-cgb Force CGB mode (default: false)
--force-dmg Force DMG mode (default: false)
--no-gui Run without GUI (default: false)
--panic-on-stuck Panic when CPU is stuck (default: false)
--randomize Randomize RAM on startup (default: false)
--help, -h show help
--version, -v print the version


Examples:

gobc roms/cpu_instrs.gb --debug --breakpoints 0x100,0x200,0x300 # Run with debug mode and breakpoints
gobc roms/cpu_instrs.gb --force-cgb # Force CGB mode on DMG rom
gobc roms/cpu_instrs.gb --force-dmg # Force DMG mode on CGB rom
LOG_LEVEL=debug gobc roms/cpu_instrs.gb # Set Log level to debug
LOG_LEVEL=info gobc roms/cpu_instrs.gb # Set Log level to info
```

Key Bindings
============
Main Window
-----------
| Key | Description |
| --- | ----------- |
| `F1` | Toggle Grid |
| `F2` | Toggle Debug Information |
| `F3` | Change Pallete (DMG Only) |
| `F4` | Save Cartridge SRAM |
| `F5` | Save State |
| `F6` | Load State |
| `A` | Button B |
| `S` | Button A |
| `Enter` | Start |
| `Shift` | Select |
| `Up` | D-Pad Up |
| `Down` | D-Pad Down |
| `Left` | D-Pad Left |
| `Right` | D-Pad Right |
| `DEBUG ON - Space Bar` | Game Pause |
| `DEBUG ON - N` | Step N Cycles |
| `DEBUG ON - M` | Increase Cycles Per Frame 10x |
| `DEBUG ON - B` | Decrease Cycles Per Frame 10x |
| `DEBUG ON - F` | Step Frame |

VRAM Window
-----------
| Key | Description |
| --- | ----------- |
| `T` | Toggle Tile Addressing Mode|
| `B` | Toggle TileMap Addressing Mode|
| `G` | Toggle Grid |
| `V` | Toggle VRAM bank 0/1 |

Memory Window
-----------
| Key | Description |
| --- | ----------- |
| `Right` | Page Down |
| `Left` | Page Up |
| `Up` | Scroll Up |
| `Down` | Scroll Down |
| `Mouse Wheel Up` | Scroll Up |
| `Mouse Wheel Down` | Scroll Down |

Cart Window
-----------
| Key | Description |
| --- | ----------- |
| `Right` | Page Down |
| `Left` | Page Up |
| `Up` | Scroll Up |
| `Down` | Scroll Down |
| `Mouse Wheel Up` | Scroll Up |
| `Mouse Wheel Down` | Scroll Down |


Contributors
============
Expand Down
3 changes: 1 addition & 2 deletions cmd/gobc/gobc.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ func gameLoopGUI() {
}

for !mainWin.Closed() {
mainWin.SetTitle("gobc v0.1 | FPS: " + fmt.Sprintf("%.2f", fps))
mainWin.SetTitle(fmt.Sprintf("gobc v0.1 | %s | FPS: %.2f", g.Mb.Cartridge.Filename, fps))
mainWin.SetTitle(fmt.Sprintf("gobc v%s | %s | FPS: %.2f", internal.VERSION, g.Mb.Cartridge.Filename, fps))
elasped = 0
start := time.Now()

Expand Down
Binary file added docs/bgb.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions internal/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
log "github.com/sirupsen/logrus"
)

const VERSION string = "1.0"
const FRAMES_PER_SECOND = 60
const DMG_CLOCK_SPEED = 4194304 // 4.194304 MHz or 4,194,304 cycles per second
const CGB_CLOCK_SPEED = 8388608 // 8.388608 MHz or 8,388,608 cycles per second
Expand Down
4 changes: 2 additions & 2 deletions internal/windows/cartview.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package windows
import (
"fmt"

"github.com/duysqubix/gobc/internal"
"github.com/duysqubix/gobc/internal/cartridge"
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
Expand Down Expand Up @@ -53,7 +54,7 @@ type CartViewWindow struct {
func NewCartViewWindow(gobc *GoBoyColor) *CartViewWindow {
/// create memory window
memWin, err := pixelgl.NewWindow(pixelgl.WindowConfig{
Title: "gobc v0.1 | Cart Memory View",
Title: fmt.Sprintf("gobc v%s | Cart Memory View", internal.VERSION),
Bounds: pixel.R(0, 0, cartTrueWidth, cartScreenHeight),
VSync: true,
AlwaysOnTop: true,
Expand All @@ -79,7 +80,6 @@ func (mw *CartViewWindow) SetUp() {
cartConsoleTxt = text.New(
pixel.V(10, 5),
text.NewAtlas(cartDefaultFont, text.ASCII),
// text.NewAtlas(inconsolata.Regular8x16, text.ASCII),
)

cartConsoleTxt.Color = colornames.Yellowgreen
Expand Down
2 changes: 1 addition & 1 deletion internal/windows/cpuview.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type CpuViewWindow struct {
func NewCpuViewWindow(gobc *GoBoyColor) *CpuViewWindow {
/// create memory window
memWin, err := pixelgl.NewWindow(pixelgl.WindowConfig{
Title: "gobc v0.1 | Cpu View",
Title: fmt.Sprintf("gobc v%s | CPU View", internal.VERSION),
Bounds: pixel.R(0, 0, cpuTrueWidth, cpuTrueHeight),
VSync: true,
AlwaysOnTop: true,
Expand Down
3 changes: 2 additions & 1 deletion internal/windows/ioview.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strconv"

"github.com/duysqubix/gobc/internal"
"github.com/duysqubix/gobc/internal/motherboard"
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
Expand Down Expand Up @@ -43,7 +44,7 @@ type IoViewWindow struct {
func NewIoViewWindow(gobc *GoBoyColor) *IoViewWindow {
/// create memory window
memWin, err := pixelgl.NewWindow(pixelgl.WindowConfig{
Title: "gobc v0.1 | IO View",
Title: fmt.Sprintf("gobc v%s | IO View", internal.VERSION),
Bounds: pixel.R(0, 0, ioScreenWidth, ioTrueHeight),
VSync: true,
AlwaysOnTop: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/windows/memoryview.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type MemoryViewWindow struct {
func NewMemoryViewWindow(gobc *GoBoyColor) *MemoryViewWindow {
/// create memory window
memWin, err := pixelgl.NewWindow(pixelgl.WindowConfig{
Title: "gobc v0.1 | Memory View",
Title: fmt.Sprintf("gobc v%s | Memory View", internal.VERSION),
Bounds: pixel.R(0, 0, memTrueWidth, memTrueHeight),
VSync: true,
AlwaysOnTop: true,
Expand Down
2 changes: 1 addition & 1 deletion internal/windows/vramview.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type VramViewWindow struct {
func NewVramViewWindow(gobc *GoBoyColor) *VramViewWindow {
/// create memory window
win, err := pixelgl.NewWindow(pixelgl.WindowConfig{
Title: "gobc v0.1 | VRAM View",
Title: fmt.Sprintf("gobc v%s | VRAM View", internal.VERSION),
Bounds: pixel.R(0, 0, vramTrueWidth, vramTrueHeight),
VSync: true,
AlwaysOnTop: true,
Expand Down

0 comments on commit 5391c18

Please sign in to comment.