Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger #119

Merged
merged 40 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0b99b2b
Add initial debugger support
alloncm Mar 21, 2023
4d99e19
Add support for registers command in the dbg
alloncm Mar 21, 2023
5776c7d
WIP Starting to add proper support for br
alloncm Mar 25, 2023
6df467c
Add delete BP command
alloncm Mar 31, 2023
6cbc1c1
Add gracefull error handling for channel close
alloncm Apr 1, 2023
eb51de3
Add the debbuger as conditional compile feature
alloncm Apr 1, 2023
a24c615
Add dbg feature to desktop
alloncm Apr 1, 2023
cb4a767
Add first memory view for the debugger
alloncm Apr 5, 2023
23d8b16
Rearrange packages and names
alloncm Jun 16, 2023
3db50e3
Update docs and readme
alloncm Jun 16, 2023
9e9c61e
Merge remote-tracking branch 'refs/remotes/origin/master'
alloncm Jun 16, 2023
e32adc6
Fix debugger gets stuck on invalid input
alloncm Jun 16, 2023
10f49cb
Add disassembler
alloncm Jun 17, 2023
88f0a83
Merge branch 'master' into feature/dbg
alloncm Jun 17, 2023
5a94e8f
Add memory watchpoint
alloncm Jun 17, 2023
40d00f1
watch point also on write
alloncm Jun 17, 2023
c7b6292
Adapt intergration tests for dbg feature
alloncm Jun 17, 2023
72a78ef
Create a seperate modle for the debugger in core
alloncm Jul 12, 2023
5fc7002
Fix compilation error
alloncm Jul 13, 2023
1e0d1d1
Fix breaking bug
alloncm Jul 13, 2023
6074d24
Move handle_debugger to debugger module
alloncm Jul 14, 2023
802d0e5
Fix stack overflow at init on debug builds
alloncm Jul 14, 2023
b204a3f
Add a help command
alloncm Jul 14, 2023
f1df905
Add ppu info command
alloncm Jul 15, 2023
6cf2c8d
Start to impl the ppu layer debugger
alloncm Jul 18, 2023
f304413
Merge branch 'master' into feature/dbg
alloncm Jun 22, 2024
d18286f
WIP continue impl of the bg layer view
alloncm Jun 22, 2024
ce820e6
Finish the bg layer view
alloncm Jul 19, 2024
9fb54a4
Add sprites layer viewer
alloncm Jul 20, 2024
dca30f1
Fix some sdl unsound usage and allowed the ppu layer windows to be cl…
alloncm Jul 20, 2024
a1489f6
Fixes
alloncm Jul 20, 2024
e6953ad
Fix the lag input in the menu
alloncm Jul 21, 2024
4cc8740
Self CR cleaning
alloncm Jul 21, 2024
33ba35d
More self CR fixes
alloncm Jul 21, 2024
afcdefd
More fixes and renames for the terminal debugger interface
alloncm Jul 21, 2024
47f99cd
Remove the use of global static in the terminal debugger
alloncm Jul 21, 2024
bbf8378
Add tests for the fixed size set
alloncm Jul 21, 2024
9cf3dd1
Add debugger docs
alloncm Jul 21, 2024
d984fad
Remove redundant note in the docs
alloncm Jul 21, 2024
175d6f9
Fix stack overflow on debugger enabled debug build
alloncm Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 90 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ or with more configuration options:
cargo build --release --package magenboy_sdl --features [optional_features]
```
#### Optional features:
* `dbg` - Enable debugger
* `static-sdl` - will link statically to sdl2, On by default
* `sdl-resample` - Use the audio resampler from sdl2 library and a manual one I wrote
* `push-audio` - Use a push methododlogy instead of pull for the delivery of the sound samples to sdl2
Expand Down
3 changes: 3 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ edition = "2018"

[dependencies]
log = "0.4"
cfg-if = "1"

[features]
# default = ["dbg"]
u16pixel = []
apu = []
dbg = []

[dev-dependencies]
criterion = "0.3"
Expand Down
7 changes: 3 additions & 4 deletions core/src/cpu/gb_cpu.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::mmu::interrupts_handler::InterruptRequest;
use crate::mmu::memory::Memory;
use crate::mmu::{interrupts_handler::InterruptRequest, Memory};

use super::register::Reg;
use super::flag::Flag;
Expand Down Expand Up @@ -84,10 +83,10 @@ impl GbCpu {
}

pub fn inc_hl(&mut self){
*self.hl.value() = (*self.hl.value()).wrapping_add(1);
*self.hl.value_mut() = self.hl.value().wrapping_add(1);
}

pub fn dec_hl(&mut self){
*self.hl.value() = (*self.hl.value()).wrapping_sub(1);
*self.hl.value_mut() = self.hl.value().wrapping_sub(1);
}
}
2 changes: 1 addition & 1 deletion core/src/cpu/opcode_runner.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::mmu::memory::Memory;
use crate::mmu::Memory;
use super::{
gb_cpu::GbCpu,
opcodes::{
Expand Down
4 changes: 2 additions & 2 deletions core/src/cpu/opcodes/arithmetic_16bit_instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use super::opcodes_utils::{
pub fn add_hl_rr(cpu:&mut GbCpu, opcode:u8)->u8{
let reg = opcode >> 4;
let reg = *get_arithmetic_16reg(cpu, reg);
let hl_value = *cpu.hl.value();
let hl_value = cpu.hl.value();

let (value,overflow) = hl_value.overflowing_add(reg);
cpu.set_by_value(Flag::Carry, overflow);
cpu.set_by_value(Flag::HalfCarry, check_for_half_carry_third_nible_add(hl_value, reg));
cpu.unset_flag(Flag::Subtraction);

*cpu.hl.value() = value;
*cpu.hl.value_mut() = value;

// 2 cycles - 1 reading opcode, 1 internal operation
return 1;
Expand Down
Loading