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
9e0afbed
Verified
Commit
9e0afbed
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: new checking of interrupt level
parent
34666917
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#877
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
+6
-6
6 additions, 6 deletions
src/cpu.rs
src/ppu.rs
+13
-4
13 additions, 4 deletions
src/ppu.rs
with
21 additions
and
12 deletions
examples/sdl/src/main.rs
+
2
−
2
View file @
9e0afbed
...
@@ -81,8 +81,8 @@ fn main() {
...
@@ -81,8 +81,8 @@ fn main() {
let
mut
game_boy
=
GameBoy
::
new
();
let
mut
game_boy
=
GameBoy
::
new
();
game_boy
.load_boot_sgb
();
game_boy
.load_boot_sgb
();
//game_boy.load_rom_file("../../res/roms.prop/tetris.gb");
//game_boy.load_rom_file("../../res/roms.prop/tetris.gb");
game_boy
.load_rom_file
(
"../../res/roms.prop/alleyway.gb"
);
//
game_boy.load_rom_file("../../res/roms.prop/alleyway.gb");
//
game_boy.load_rom_file("../../res/roms/07-jr,jp,call,ret,rst.gb");
game_boy
.load_rom_file
(
"../../res/roms/07-jr,jp,call,ret,rst.gb"
);
//game_boy.load_rom_file("../../res/roms/firstwhite.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/ld_r_r.gb");
//game_boy.load_rom_file("../../res/roms/ld_r_r.gb");
...
...
This diff is collapsed.
Click to expand it.
src/cpu.rs
+
6
−
6
View file @
9e0afbed
...
@@ -108,12 +108,12 @@ impl Cpu {
...
@@ -108,12 +108,12 @@ impl Cpu {
let
(
instruction_fn
,
instruction_time
,
instruction_str
)
=
instruction
;
let
(
instruction_fn
,
instruction_time
,
instruction_str
)
=
instruction
;
if
*
instruction_str
==
"! UNIMP !"
{
//
if *instruction_str == "! UNIMP !" {
println!
(
println!
(
"{}
\t
(0x{:02x})
\t
${:04x} {}"
,
"{}
\t
(0x{:02x})
\t
${:04x} {}"
,
instruction_str
,
opcode
,
pc
,
is_prefix
instruction_str
,
opcode
,
pc
,
is_prefix
);
);
}
//
}
// calls the current instruction and increments the number of
// calls the current instruction and increments the number of
// cycles executed by the instruction time of the instruction
// cycles executed by the instruction time of the instruction
...
...
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
13
−
4
View file @
9e0afbed
...
@@ -94,9 +94,9 @@ pub struct Ppu {
...
@@ -94,9 +94,9 @@ pub struct Ppu {
stat_lyc
:
bool
,
stat_lyc
:
bool
,
}
}
#[derive(Clone,
Copy)]
#[derive(Clone,
Copy
,
PartialEq
)]
pub
enum
PpuMode
{
pub
enum
PpuMode
{
H
b
lank
=
0
,
H
B
lank
=
0
,
VBlank
=
1
,
VBlank
=
1
,
OamRead
=
2
,
OamRead
=
2
,
VramRead
=
3
,
VramRead
=
3
,
...
@@ -156,10 +156,10 @@ impl Ppu {
...
@@ -156,10 +156,10 @@ impl Ppu {
}
}
self
.mode_clock
=
0
;
self
.mode_clock
=
0
;
self
.mode
=
PpuMode
::
H
b
lank
;
self
.mode
=
PpuMode
::
H
B
lank
;
}
}
}
}
PpuMode
::
H
b
lank
=>
{
PpuMode
::
H
B
lank
=>
{
if
self
.mode_clock
>=
204
{
if
self
.mode_clock
>=
204
{
self
.ly
+=
1
;
self
.ly
+=
1
;
...
@@ -396,4 +396,13 @@ impl Ppu {
...
@@ -396,4 +396,13 @@ impl Ppu {
print!
(
"
\n
"
);
print!
(
"
\n
"
);
}
}
}
}
/// Obtains the current level of the LCD interrupt by
/// checking the current PPU state in various sections.
fn
interrupt_level
(
&
self
)
->
bool
{
self
.stat_lyc
&&
self
.lyc
==
self
.ly
||
self
.stat_oam
&&
self
.mode
==
PpuMode
::
OamRead
||
self
.stat_vblank
&&
self
.mode
==
PpuMode
::
VBlank
||
self
.stat_vblank
&&
self
.mode
==
PpuMode
::
HBlank
}
}
}
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