Skip to content

sylvaus/gameboy_emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GameBoy Emulator

Build and Test Multi OS Rust codecov

Goal

Being able to run a GameBoy game (sound optional).

Compatibility

Tested on: Fedora 38

Installation

Dependencies

Important Findings

Endianness

  • Gameboy uses little endian

Cycle vs M-Cycles

Cycle refers to an actual clock cycle for a clock frequency of (4.194304 MHz) and M-Cycle refers to 4 cycles. source

M-Cycles are used pretty often since all the instruction cycles are divisible by 4. The current implementation uses cycle as the Gameboy CPU (LR35902) instruction set uses it.

Halt implementation

Halt instruction will be implemented as follows:

  • When HALT is called, the system clock will be stopped and only an interruption will allow the clock to restart
  • If the IME is not set, the interrupt code will not be executed and the process will restart after the HALT

Sources:

Errors in resources

  • Chapter 4 page 95: register code for D should be 010 instead of 101 (which is the code for L)
  • Chapter 4 page 109: RLCA example, resulting register A should be 0x0B (and not 0x0A)
  • 0xE2 and 0xF2 should have a length of one instead of 2
  • JP (HL) should be JP HL
  • All SRA commands should compute the carry flag (instead of resetting it)
  • BIT (HL) should take only 12 cycles

Resources

About

Emulator for Gameboy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages