-
Notifications
You must be signed in to change notification settings - Fork 2
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 improvements #28
Conversation
I couldn't keep myself from implementing more stuff. Most importantly:
But I'm gonna stop now. So this PR is ready. |
- Decoded instructions are cached - Instructions before PC are showed too - An arrow points to the instruction PC is pointing to
9cab544
to
4d26ccc
Compare
core/src/machine/ppu.rs
Outdated
(43..144, _) => { | ||
// TODO: H-Blank | ||
// debug!("[ppu] hblank. current_line: {}", self.current_line); | ||
(43..144, col) if self.phase() == Phase::HBlank && col == 160 => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SCREEN_WIDTH
instead of magic number 160
.
core/src/machine/ppu.rs
Outdated
@@ -290,6 +357,13 @@ impl Ppu { | |||
while self.fifo.len() > 8 && pixel_pushed < 4 { | |||
self.push_pixel(display); | |||
pixel_pushed += 1; | |||
|
|||
// We we are at the end of the line, stop everything and go to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "we" cloned itself 😱
core/src/machine/ppu.rs
Outdated
|
||
// We we are at the end of the line, stop everything and go to | ||
// H-Blank. | ||
if self.current_column == 160 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SCREEN_WIDTH
instead of magic number 160
.
This reduces the time required for `NativeWindow::update()` from around 1,5ms to 200µs when the debugger is paused
Now pausing and doing nothing in the debugger needs almost no CPU. More importantly: since the TUI is only updated every fifth frame, the CPU usage is also lower when the emulator is running.
Now we don't use `TextView` internally anymore and do everything ourselves. This has a significant speed advantage, but means that long lines aren't wrapping anymore. The log message can still use line breaks, though.
These comments can potentially show more information if we want to.
58a975d
to
6a61707
Compare
There might be ways to make the debugger compile on Windows, but I don't think it's worth the trouble.
info!("[ppu] LCD was enabled"); | ||
self.set_phase(Phase::OamSearch); | ||
self.cycle_in_line = 0; | ||
// TODO: also reset other stuff? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to reset the current line here too? (e.g. self.current_line = Byte::new(0);
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The current line is set to 0 a few lines below, when the LCD is disabled. I actually think that most things should be "reset" when the LCD is disabled instead of when it is enabled.
I think the TODO is a bit outdated. But it might still be useful until we figured this out.
I ignored everything in |
CC #18
Closes #26
Closes #27