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
175ce72e
Verified
Commit
175ce72e
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: new registers
parent
12497caa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#871
passed
2 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/sdl/src/main.rs
+1
-1
1 addition, 1 deletion
examples/sdl/src/main.rs
src/ppu.rs
+14
-0
14 additions, 0 deletions
src/ppu.rs
with
15 additions
and
1 deletion
examples/sdl/src/main.rs
+
1
−
1
View file @
175ce72e
...
@@ -79,7 +79,7 @@ fn main() {
...
@@ -79,7 +79,7 @@ fn main() {
.unwrap
();
.unwrap
();
let
mut
game_boy
=
GameBoy
::
new
();
let
mut
game_boy
=
GameBoy
::
new
();
game_boy
.load_boot_
dmg
();
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/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");
...
...
This diff is collapsed.
Click to expand it.
src/ppu.rs
+
14
−
0
View file @
175ce72e
...
@@ -71,12 +71,17 @@ pub struct Ppu {
...
@@ -71,12 +71,17 @@ pub struct Ppu {
switch_bg
:
bool
,
switch_bg
:
bool
,
/// Controls if the sprites/objects are going to be drawn to screen.
/// Controls if the sprites/objects are going to be drawn to screen.
switch_obj
:
bool
,
switch_obj
:
bool
,
/// Defines the size in pixels of the object (false=8x8, true=8x16).
obj_size
:
bool
,
/// Controls the map that is going to be drawn to screen, the
/// Controls the map that is going to be drawn to screen, the
/// offset in VRAM will be adjusted according to this.
/// offset in VRAM will be adjusted according to this.
bg_map
:
bool
,
bg_map
:
bool
,
/// If the background tile set is active meaning that the
/// If the background tile set is active meaning that the
/// negative based indexes are going to be used.
/// negative based indexes are going to be used.
bg_tile
:
bool
,
bg_tile
:
bool
,
// Controls if the window is meant to be drawn.
switch_window
:
bool
,
window_map
:
bool
,
/// Flag that controls if the LCD screen is ON and displaying
/// Flag that controls if the LCD screen is ON and displaying
/// content.
/// content.
switch_lcd
:
bool
,
switch_lcd
:
bool
,
...
@@ -111,8 +116,11 @@ impl Ppu {
...
@@ -111,8 +116,11 @@ impl Ppu {
mode_clock
:
0
,
mode_clock
:
0
,
switch_bg
:
false
,
switch_bg
:
false
,
switch_obj
:
false
,
switch_obj
:
false
,
obj_size
:
false
,
bg_map
:
false
,
bg_map
:
false
,
bg_tile
:
false
,
bg_tile
:
false
,
switch_window
:
false
,
window_map
:
false
,
switch_lcd
:
false
,
switch_lcd
:
false
,
stat_hblank
:
false
,
stat_hblank
:
false
,
stat_vblank
:
false
,
stat_vblank
:
false
,
...
@@ -187,8 +195,11 @@ impl Ppu {
...
@@ -187,8 +195,11 @@ impl Ppu {
0x0040
=>
{
0x0040
=>
{
let
value
=
if
self
.switch_bg
{
0x01
}
else
{
0x00
}
let
value
=
if
self
.switch_bg
{
0x01
}
else
{
0x00
}
|
if
self
.switch_obj
{
0x02
}
else
{
0x00
}
|
if
self
.switch_obj
{
0x02
}
else
{
0x00
}
|
if
self
.obj_size
{
0x02
}
else
{
0x00
}
|
if
self
.bg_map
{
0x08
}
else
{
0x00
}
|
if
self
.bg_map
{
0x08
}
else
{
0x00
}
|
if
self
.bg_tile
{
0x10
}
else
{
0x00
}
|
if
self
.bg_tile
{
0x10
}
else
{
0x00
}
|
if
self
.switch_window
{
0x20
}
else
{
0x00
}
|
if
self
.window_map
{
0x40
}
else
{
0x00
}
|
if
self
.switch_lcd
{
0x80
}
else
{
0x00
};
|
if
self
.switch_lcd
{
0x80
}
else
{
0x00
};
value
value
}
}
...
@@ -212,8 +223,11 @@ impl Ppu {
...
@@ -212,8 +223,11 @@ impl Ppu {
0x0040
=>
{
0x0040
=>
{
self
.switch_bg
=
value
&
0x01
==
0x01
;
self
.switch_bg
=
value
&
0x01
==
0x01
;
self
.switch_obj
=
value
&
0x02
==
0x02
;
self
.switch_obj
=
value
&
0x02
==
0x02
;
self
.obj_size
=
value
&
0x04
==
0x04
;
self
.bg_map
=
value
&
0x08
==
0x08
;
self
.bg_map
=
value
&
0x08
==
0x08
;
self
.bg_tile
=
value
&
0x10
==
0x10
;
self
.bg_tile
=
value
&
0x10
==
0x10
;
self
.switch_window
=
value
&
0x20
==
0x20
;
self
.window_map
=
value
&
0x40
==
0x40
;
self
.switch_lcd
=
value
&
0x80
==
0x80
;
self
.switch_lcd
=
value
&
0x80
==
0x80
;
}
}
0x0041
=>
{
0x0041
=>
{
...
...
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