Compare commits
10 Commits
015b039fff
...
c0953a9374
| Author | SHA1 | Date | |
|---|---|---|---|
| c0953a9374 | |||
| 115a5c7c9f | |||
| e3af26a508 | |||
| a9357b924d | |||
| 1ab1ec57de | |||
| 45f688e8c9 | |||
| d40414efd8 | |||
| 265cd69937 | |||
| 9ba05a45ef | |||
| edac91baf9 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest]
|
||||
os: [windows-latest, macos-latest, ubuntu-latest]
|
||||
build_type: [Release]
|
||||
|
||||
steps:
|
||||
|
||||
@@ -46,10 +46,20 @@ elseif(APPLE)
|
||||
find_package(SDL2 REQUIRED CONFIG)
|
||||
|
||||
message(STATUS "Found SDL2 at: ${SDL2_DIR}")
|
||||
elseif(UNIX)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
find_package(SDL2 CONFIG QUIET)
|
||||
|
||||
if(NOT SDL2_FOUND)
|
||||
# Use pkg-config as fallback
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||
|
||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
|
||||
set_target_properties(SDL2::SDL2 PROPERTIES
|
||||
IMPORTED_LOCATION "${SDL2_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_OPTIONS "${SDL2_CFLAGS_OTHER}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
90
README.md
Normal file
90
README.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# BreadedSNES
|
||||
|
||||
**BreadedSNES** is an up-and-coming cross-platform Super Nintendo (SNES) emulator written in modern C++23. SDL2 is used for audio, video, and input support.
|
||||
|
||||
Note, this does not function currently. Maybe it'll boot something in the future. Now is certainly not that time.
|
||||
## Build Instructions
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You will need:
|
||||
|
||||
- CMake ≥ 3.16
|
||||
- C++23-compatible compiler (GCC, Clang, or MSVC)
|
||||
- SDL2 development libraries
|
||||
|
||||
---
|
||||
|
||||
### Windows
|
||||
|
||||
1. Clone the repository and vcpkg:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.bat
|
||||
```
|
||||
|
||||
2. Install SDL2:
|
||||
|
||||
```bash
|
||||
./vcpkg install sdl2
|
||||
```
|
||||
|
||||
3. Build the project:
|
||||
|
||||
```bash
|
||||
cd path/to/breadedSNES
|
||||
cmake -B build -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### macOS
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
```bash
|
||||
brew install cmake sdl2
|
||||
```
|
||||
|
||||
2. Build the project:
|
||||
|
||||
```bash
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 🐧 Linux
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
>apt:
|
||||
> ```bash
|
||||
>sudo apt install cmake build-essential libsdl2-dev pkg-config
|
||||
>```
|
||||
|
||||
> pacman:
|
||||
> ```bash
|
||||
> sudo pacman -S cmake sdl2 pkgconf
|
||||
> ```
|
||||
|
||||
2. Build the project:
|
||||
|
||||
```bash
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build --config Release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Packaging
|
||||
|
||||
To create distributable packages (e.g. `.zip`, `.dmg`, `.tgz`), run:
|
||||
|
||||
```bash
|
||||
cd build
|
||||
cpack
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef BUS_H
|
||||
#define BUS_H
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
// Memory Bus - handles memory mapping
|
||||
|
||||
979
src/cpu.cpp
979
src/cpu.cpp
File diff suppressed because it is too large
Load Diff
52
src/cpu.h
52
src/cpu.h
@@ -67,6 +67,43 @@ class CPU {
|
||||
// Helper method to check for decimal mode adjustment
|
||||
static uint16_t AdjustDecimal(uint16_t binary_result, bool is_16bit);
|
||||
|
||||
// Helpers for LD* Instructions
|
||||
void LDA_Mem(uint32_t address, int base_cycles, bool addDPExtraCycle, bool addPageCrossCycle, uint16_t base,
|
||||
uint16_t offset);
|
||||
|
||||
void LD_Index(uint32_t address, bool isX, int base_cycles, bool addDPExtraCycle, bool addPageCrossCycle,
|
||||
uint16_t base,
|
||||
uint16_t offset);
|
||||
|
||||
// General ORA Logic
|
||||
void ORA_Mem(uint32_t address, int base_cycles, bool addDPExtraCycle, bool addPageCrossCycle, uint16_t base_address,
|
||||
uint16_t offset);
|
||||
|
||||
//Helper Methods for Rotate Right/Left
|
||||
uint8_t ROL8(uint8_t value);
|
||||
uint16_t ROL16(uint16_t value);
|
||||
void ROL_AtAddress(uint32_t address, int base_cycles_8bit, int base_cycles_16bit);
|
||||
|
||||
uint8_t ROR8(uint8_t value);
|
||||
uint16_t ROR16(uint16_t value);
|
||||
void ROR_AtAddress(uint32_t address, int base_cycles_8bit, int base_cycles_16bit);
|
||||
|
||||
// Helper methods for SBC operations
|
||||
void SBC8(uint8_t operand);
|
||||
void SBC16(uint16_t operand);
|
||||
uint8_t SBC8_Decimal(uint8_t a, uint8_t operand, bool carry);
|
||||
uint16_t SBC16_Decimal(uint16_t a, uint16_t operand, bool carry);
|
||||
void SBC_FromAddress(uint32_t address, int base_cycles_8bit, int base_cycles_16bit);
|
||||
void SBC_FromAddress_PageCross(uint32_t address, uint16_t base_address, uint16_t offset, int base_cycles_8bit,
|
||||
int base_cycles_16bit);
|
||||
|
||||
// General STZ Logic
|
||||
void STZ_ToAddress(uint32_t address, int base_cycles_8bit, int base_cycles_16bit);
|
||||
|
||||
// ST* Helpers
|
||||
void WriteWithDirectPagePenalty(uint32_t address, uint16_t value, bool isMemoryFlag, int baseCycles);
|
||||
void WriteRegisterToAddress(uint32_t address, uint16_t value, bool isMemoryFlag, int baseCycles);
|
||||
|
||||
// Helper methods for ASL stuff
|
||||
void UpdateASLFlags8(uint8_t original_value, uint8_t result);
|
||||
void UpdateASLFlags16(uint16_t original_value, uint16_t result);
|
||||
@@ -80,21 +117,6 @@ class CPU {
|
||||
void UpdateLSRFlags8(uint8_t original_value, uint8_t result);
|
||||
void UpdateLSRFlags16(uint16_t original_value, uint16_t result);
|
||||
|
||||
//Helper Methods for Rotate Right/Left
|
||||
uint8_t ROL8(uint8_t value);
|
||||
uint16_t ROL16(uint16_t value);
|
||||
uint8_t ROR8(uint8_t value);
|
||||
uint16_t ROR16(uint16_t value);
|
||||
|
||||
// Helper methods for SBC operations
|
||||
void SBC8(uint8_t operand);
|
||||
void SBC16(uint16_t operand);
|
||||
uint8_t SBC8_Decimal(uint8_t a, uint8_t operand, bool carry);
|
||||
uint16_t SBC16_Decimal(uint16_t a, uint16_t operand, bool carry);
|
||||
void SBC_FromAddress(uint32_t address, int base_cycles_8bit, int base_cycles_16bit);
|
||||
void SBC_FromAddress_PageCross(uint32_t address, uint16_t base_address, uint16_t offset, int base_cycles_8bit,
|
||||
int base_cycles_16bit);
|
||||
|
||||
public:
|
||||
explicit CPU(Bus* memory_bus) : bus(memory_bus) {
|
||||
Reset();
|
||||
|
||||
Reference in New Issue
Block a user