Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
boytacean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
João Magalhães
boytacean
Commits
a23c7726
Verified
Commit
a23c7726
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: switching of the LCD
parent
4a9c6fc8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#940
passed
2 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/sdl/src/main.rs
+2
-2
2 additions, 2 deletions
examples/sdl/src/main.rs
src/cpu.rs
+9
-1
9 additions, 1 deletion
src/cpu.rs
src/ppu.rs
+10
-4
10 additions, 4 deletions
src/ppu.rs
with
21 additions
and
7 deletions
examples/sdl/src/main.rs
+
2
−
2
View file @
a23c7726
...
...
@@ -89,10 +89,10 @@ fn main() {
//game_boy.load_rom_file("../../res/roms.prop/alleyway.gb");
//game_boy.load_rom_file("../../res/roms/firstwhite.gb");
//
game_boy.load_rom_file("../../res/roms/opus5.gb");
game_boy
.load_rom_file
(
"../../res/roms/opus5.gb"
);
//game_boy.load_rom_file("../../res/roms/paradius/cpu/01-special.gb"); // PASSED
game_boy
.load_rom_file
(
"../../res/roms/paradius/cpu/02-interrupts.gb"
);
//
game_boy.load_rom_file("../../res/roms/paradius/cpu/02-interrupts.gb");
// PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/03-op sp,hl.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/04-op r,imm.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/05-op rp.gb"); // PASSED
...
...
This diff is collapsed.
Click to expand it.
src/cpu.rs
+
9
−
1
View file @
a23c7726
...
...
@@ -109,6 +109,14 @@ impl Cpu {
panic!
(
"Invalid PC area at 0x{:04x}"
,
pc
);
}
// @todo this is so bad, need to improve this by an order
// of magnitude
if
self
.halted
{
if
((
self
.mmu.ie
&
0x01
==
0x01
)
&&
self
.mmu
.ppu
()
.int_vblank
())
||
((
self
.mmu.ie
&
0x04
==
0x04
)
&&
self
.mmu
.timer
()
.int_tima
())
{
self
.halted
=
false
;
}
}
if
self
.ime
{
// @todo aggregate all of this interrupts in the MMU
if
(
self
.mmu.ie
&
0x01
==
0x01
)
&&
self
.mmu
.ppu
()
.int_vblank
()
{
...
...
@@ -179,7 +187,7 @@ impl Cpu {
if
*
instruction_str
==
"! UNIMP !"
||
*
instruction_str
==
"HALT"
{
if
*
instruction_str
==
"HALT"
{
println!
(
"
Waiting for
0x{:02x}
in HALT
"
,
self
.mmu.ie
);
println!
(
"
HALT with IE=
0x{:02x}
IME={}
"
,
self
.mmu.ie
,
self
.ime
);
}
println!
(
"{}
\t
(0x{:02x})
\t
${:04x} {}"
,
...
...
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
10
−
4
View file @
a23c7726
...
...
@@ -316,10 +316,6 @@ impl Ppu {
}
pub
fn
clock
(
&
mut
self
,
cycles
:
u8
)
{
if
!
self
.switch_lcd
{
return
;
}
// increments the current mode clock by the provided amount
// of CPU cycles (probably coming from a previous CPU clock)
self
.mode_clock
+=
cycles
as
u16
;
...
...
@@ -416,6 +412,13 @@ impl Ppu {
self
.switch_window
=
value
&
0x20
==
0x20
;
self
.window_map
=
value
&
0x40
==
0x40
;
self
.switch_lcd
=
value
&
0x80
==
0x80
;
// in case the LCD is off takes the opportunity
// to clear the screen, this is the expected
// behaviour for this specific situation
if
!
self
.switch_lcd
{
self
.clear_frame_buffer
();
}
}
0x0041
=>
{
self
.stat_hblank
=
value
&
0x04
==
0x04
;
...
...
@@ -579,6 +582,9 @@ impl Ppu {
}
fn
render_line
(
&
mut
self
)
{
if
!
self
.switch_lcd
{
return
;
}
if
self
.switch_bg
{
self
.render_background
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment