GithubHelp home page GithubHelp logo

emrsmsrli / gameboiadvance Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 4.49 MB

A Gameboy Advance emulator that kinda works

License: GNU General Public License v3.0

CMake 2.60% C++ 97.40%
cpp cpp17 emulator emulators gameboy gameboy-advance gameboy-advance-emulator gameboy-emulator sdl2 sfml

gameboiadvance's Issues

Disassembler

Implement a full fledged disassembler.

ARM instructions

  • Branch and Branch with Link (B, BL, BX, SWI)
  • Data Processing (ALU)
  • Multiply and Multiply-Accumulate (MUL, MLA)
  • PSR Transfer (MRS, MSR)
  • Memory: Single Data Transfer (LDR, STR)
  • Memory: Halfword, Doubleword, and Signed Data Transfer
  • Memory: Block Data Transfer (LDM, STM)
  • Memory: Single Data Swap (SWP)
  • Coprocessor (MRC/MCR, LDC/STC, CDP, MCRR/MRRC) -- no need since GBA does not have any coprocessors

Thumb instructions

  • Register Operations (ALU, BX)
  • Memory Load/Store (LDR/STR)
  • Memory Addressing (ADD PC/SP)
  • Memory Multiple Load/Store (PUSH/POP and LDM/STM)
  • Jumps and Calls

Following format should be fine:
[address] | [instruction_dword] - [disassembly]

Input controller

Implement input controller as follows:

  • KEYINPUT reg, status of keys
  • KEYCNT reg, irq control

Gamepak

See this GBATEK section.

Rough TODO list:

  • Pull metadata from cartridge header
  • Search for backup id string in rom
    • Optionally add some backup type database consisting roms with known save types
  • Implement backup types
    • SRAM/FRAM
    • EEPROM
    • Flash ROM
  • Implement some GPIO functionality. Maybe only RTC?
  • Implement erase, write etc timings

Serial IO

  • SIO Normal Mode
  • SIO Multi-Player Mode
  • SIO UART Mode
  • SIO JOY BUS Mode
  • SIO General-Purpose Mode
  • Implement actual connection using sfml network module

Memory view debugger

Should show the contents of memory within a certain region.
Included regions taken from GBATEK:

General Internal Memory

00000000-00003FFF BIOS - System ROM
00004000-01FFFFFF Not used
02000000-0203FFFF WRAM - On-board Work RAM
02040000-02FFFFFF Not used
03000000-03007FFF WRAM - On-chip Work RAM
03008000-03FFFFFF Not used
04000000-040003FE I/O Register
04000400-04FFFFFF Not used

Internal Display Memory

05000000-050003FF BG/OBJ Palette RAM
05000400-05FFFFFF Not used
06000000-06017FFF VRAM - Video RAM
06018000-06FFFFFF Not used
07000000-070003FF OAM - OBJ Attributes
07000400-07FFFFFF Not used

External Memory (Game Pak)

08000000-09FFFFFF Game Pak ROM/FlashROM (max 32MB)
0A000000-0BFFFFFF Game Pak ROM/FlashROM (max 32MB)
0C000000-0DFFFFFF Game Pak ROM/FlashROM (max 32MB)
0E000000-0E00FFFF Game Pak SRAM

  • ewram
  • iwram
  • io regs
  • palette ram
  • vram
  • oam
  • pak rom
  • pak backup memory

Gamepak debugger

Should show gamepak metadata info.

  • Pak path
  • Title
  • Game code
  • Maker code
  • Checksum
  • Backup type string

Optionally show memory views of the Pak and the backup medium. Or alternatively they should be shown in memory debugger mentioned in #4

TONC demos

A list of TONC demos. Won't try to run them all correctly probably:

  • bm_modes
  • brin_demo
  • bm_modes
  • brin_demo
  • first
  • hello
  • key_demo
  • m3_demo
  • pageflip
  • sbb_reg
  • second
  • bigmap
  • m7_demo_mb
  • obj_aff
  • sbb_aff
  • tmr_demo
  • txt_obj
  • dma_demo
  • m7_ex
  • obj_demo
  • snd1_demo
  • txt_se1
  • bld_demo
  • irq_demo
  • mos_demo
  • octtest
  • swi_demo
  • tte_demo
  • txt_se2
  • cbb_demo
  • m7_demo
  • oacombo
  • prio_demo
  • swi_vsync
  • txt_bm
  • win_demo

ARM Debugger

Implement a debugger module which shows the current CPU state

  • Registers with all modes
  • Pipeline state
  • Timers
  • DMA states
  • Disassembly around PC (?)
  • Halt state
  • Interrupts
  • BIOS latch
  • Open bus value
  • Breakpoints

Video controller

This should be one of the hardest aspects of the emulator. Lots of things to do:

  • DISPCNT and GREEN SWAP registers
  • DISPSTAT and VCOUNT registers
  • BG*CNT registers (1-4)
  • bg offset registers
  • bg rotate scale registers
  • window registers
  • mosaic
  • special color effect regs (alpha blending etc)
  • see TIMINGS (render takes 4 cpu cycle per dot)
  • bitmap rendering
  • normal bg rendering
  • affine bg rendering
  • obj rendering
  • composition
    • blending
    • windowing
    • obj windowing

Stack based vector

implement a stack based vector (or use PMR) for use in hot loops, where variable size container are needed (i.e block data transfer -> generate rlist)

Broken backup systems

  • EEPROM4 is not being detected
  • EEPROM is not really working, games report "cannot save" messages

APU Debugger

  • Registers
  • FIFO representation
  • Wave ram memory view
  • Wave representations

DMA interleaving issues

When 3 channels are running simultaneously, the length field of the last one gets corrupted. this generally happens in the case of dma1(fifo) + dma2(fifo) + dma3(imm).

Take Mother 3 for example, it freezes the emulator on title screen, or shortly after the game begins

ARM7

This issue tracks ARM7TDMI emulation

  • ARM instructions
    • DataProc
    • PSR
    • BX
    • Multiply
    • MulLong
    • Trans
    • Undefined
    • BlockTrans
    • B,BL
    • SWI
  • Thumb instructions
    • move_shifted_reg
    • add_subtract
    • mov_cmp_add_sub_imm
    • alu
    • hireg_bx
    • pc_rel_load
    • ld_str_reg
    • ld_str_sign_extended_byte_hword
    • ld_str_imm
    • ld_str_hword
    • ld_str_sp_relative
    • ld_addr
    • add_offset_to_sp
    • push_pop
    • ld_str_multiple
    • branch_cond
    • swi_thumb
    • branch
    • long_branch_link
  • Timers
  • Interrupt handling
  • Interrupt delay
  • Halt, stop mode

PPU debugger

  • Registers
  • BG views
    • BG0
    • BG1
    • BG2 (also bitmap view)
    • BG3
  • OAM view
  • Tile view
  • Palette view
  • Screen buffer
  • Window buffer

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.