Code Monkey home page Code Monkey logo

gbemu's Introduction

gbemu's People

Contributors

aidan-clyens avatar jgilchrist avatar marcushultman avatar twiddle-bits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gbemu's Issues

debugger commands listed incorrectly under help

In the debugger the command parser is looking for strings of mem or memcell in order to view a location or range in the virtual memory:

    if (cmd == "mem") return CommandType::Memory;
    if (cmd == "memcell") return CommandType::MemoryCell;

However, the help menu says to type "memory" or "memory cell":

    printf("memory $start $lines Print a dump of memory from $start to $end\n");
    printf("memorycell $addr     Print the value of the memory at $addr\n");

One or the other should be changed so that they matched. Selfishly, mem and memcell are faster to type.

Help output in debugger is misleading (registers should be regs)

When calling help within the debugger, we get the following output.

> help
...
= Debug Information
registers            Print a dump of the CPU registers
flags                Print a dump of the CPU flags
....

But the command to print a dump of the registers seems to be just regs.

save data (state restore) - how does it work?

Hi! Great emulator, I got a custom Gameboy instance working very quickly in my environment. However, I think I am struggling with state restore/save data. I'm saving the get_cartridge_ram() to disk and pass it as save_data in the ctor, but the game I'm trying out is always starting from the beginning. I've tried saving both during the run-loop and afterwards, and data seem to be written (there is binary data in the file). Am I misunderstanding something, or is it maybe the ROM I'm using that is to blame?

How to understand the code and where to start?

Hi @jgilchrist , I also want to make a Gameboy emulator on C/C++ and I have no idea how to approach the problem. I know I must read Gameboy manual and understand how it works but what do I do after that? I see that you have solved this problem, so will you please explain me how to get started with coding something for this project? Thanks in advance!

PS: I am going to code in Visual Studio 2017, on Windows 10.

test with https://github.com/drhelius/demo-emulator/blob/master/test_roms/cpu_instrs/cpu_instrs.gb,something error happend?

| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Attempting to read from cartridge RAM
| Boot rom was disabled
| Wrote to sound on/off address 0xff26 - 0x0
| Wrote to sound on/off address 0xff26 - 0x80
| Wrote to selection of sound output terminal address 0xff25 - 0xff
| Wrote to channel control address 0xff24 - 0x77
cpu_instrs

| Attempting to write to cartridge ROM: 2000 - 0x1
01| Wrote to sound on/off address 0xff26 - 0x0
| Wrote to sound on/off address 0xff26 - 0x80
| Wrote to selection of sound output terminal address 0xff25 - 0xff
| Wrote to channel control address 0xff24 - 0x77
:ok | Attempting to write to cartridge ROM: 2000 - 0x1
02| Wrote to sound on/off address 0xff26 - 0x0
| Wrote to sound on/off address 0xff26 - 0x80
| Wrote to selection of sound output terminal address 0xff25 - 0xff
| Wrote to channel control address 0xff24 - 0x77
| Wrote to unknown address 0xff05 - 0x0
:04 | Attempting to write to cartridge ROM: 2000 - 0x1
03| Wrote to sound on/off address 0xff26 - 0x0
| Wrote to sound on/off address 0xff26 - 0x80
| Wrote to selection of sound output terminal address 0xff25 - 0xff
| Wrote to channel control address 0xff24 - 0x77
| Attempted to read from 'Prepare Speed Switch' register
| Attempted to write to 'Prepare Speed Switch' register
| Fatal error @ [opcode_stop:822]
| Stopped

Changing Clock Speed

Is it possible to change the clock speed of the emulator? I'd like to make it runs at X2 speed.

AND also effecting F register

I do also wonder why AND touches the F register.

| 0xC321: LD A,C (0x79)
> regs
AF: 0100
BC: 1301
DE: 1300
HL: C304
SP: DFFD
PC: C322
> step
| 0xC322: AND n (0xe6)
> regs
AF: 00A0
BC: 1301
DE: 1300
HL: C304
SP: DFFD
PC: C324

Any documentation I found only talks about A

Add support for building with GCC

fuwangqin@fuwangqin-pc:~/code/emulator$ make
-- Found SFML 2.3.2 in /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/fuwangqin/code/emulator/build
make[1]: Entering directory '/home/fuwangqin/code/emulator/build'
make[2]: Entering directory '/home/fuwangqin/code/emulator/build'
make[3]: Entering directory '/home/fuwangqin/code/emulator/build'
Scanning dependencies of target emulator
make[3]: Leaving directory '/home/fuwangqin/code/emulator/build'
make[3]: Entering directory '/home/fuwangqin/code/emulator/build'
[ 4%] Building CXX object CMakeFiles/emulator.dir/src/address.cc.o
c++: error: unrecognized command line option ‘-Weverything’
CMakeFiles/emulator.dir/build.make:62: recipe for target 'CMakeFiles/emulator.dir/src/address.cc.o' failed
make[3]: *** [CMakeFiles/emulator.dir/src/address.cc.o] Error 1
make[3]: Leaving directory '/home/fuwangqin/code/emulator/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/emulator.dir/all' failed
make[2]: *** [CMakeFiles/emulator.dir/all] Error 2
make[2]: Leaving directory '/home/fuwangqin/code/emulator/build'
Makefile:83: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/fuwangqin/code/emulator/build'
Makefile:16: recipe for target 'compile' failed
make: *** [compile] Error 2
fuwangqin@fuwangqin-pc:~/code/emulator$

Unable to build on Windows

When i tried running make command, I am getting the following error.

CMake Error at CMakeLists.txt:25 (find_package):
By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SDL2", but
CMake did not find one.

Could not find a package configuration file provided by "SDL2" with any of
the following names:

SDL2Config.cmake
sdl2-config.cmake

Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
"SDL2_DIR" to a directory containing one of the above files. If "SDL2"
provides a separate development package or SDK, be sure it has been
installed.

Strange push/pop behavior?

I was digging into the cpu_instr rom since the 01 special push af test case does not work on my emulator (very early development). After inspecting the test case code and debugging for hours, I am thinking that the test case should never work at all.

Then I saw that your emulator is able to get the test to pass so I used your debugger (thank you for that) to figure out why.

As far as I understand, if a PUSH is followed by a POP directly (no other interactions with the SP register), the POP should write the value, which was previously pushed, to the given register.

> step
| 0xC31D: PUSH BC (0xc5)
> regs
AF: 0000
BC: 1301
DE: 1200
HL: C304
SP: DFFB
PC: C31E
> step
| 0xC31E: POP AF (0xf1)
> regs
AF: 1300
BC: 1301
DE: 1200
HL: C304
SP: DFFD
PC: C31F

Why is AF 0x1300 and not 0x1301?

No audio output

Hi :-)
i was able to build the emulator following the instructions of the readme file. Just a question, the audio is available at the moment or it has to be add?
I ask you that because at the moment i have no audio output and I don't know if I am missing some dependencies or I need to put some specific option on the cli when I run the emulator. I tested it with super mario land
Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.