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
0c93aa69
Verified
Commit
0c93aa69
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fix: issue with the boot flag register
The wrong value was being store in 0xFF50.
parent
789a68c5
No related branches found
No related tags found
1 merge request
!31
System state save
Pipeline
#3255
passed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mmu.rs
+8
-2
8 additions, 2 deletions
src/mmu.rs
src/state.rs
+19
-7
19 additions, 7 deletions
src/state.rs
with
27 additions
and
9 deletions
src/mmu.rs
+
8
−
2
View file @
0c93aa69
...
@@ -327,7 +327,13 @@ impl Mmu {
...
@@ -327,7 +327,13 @@ impl Mmu {
0x4d
=>
(
false
as
u8
)
|
((
self
.speed
as
u8
)
<<
7
),
0x4d
=>
(
false
as
u8
)
|
((
self
.speed
as
u8
)
<<
7
),
// 0xFF50 - Boot active flag
// 0xFF50 - Boot active flag
0x50
=>
u8
::
from
(
self
.boot_active
),
0x50
=>
{
if
self
.boot_active
{
0x00
}
else
{
0xff
}
}
// 0xFF70 - SVBK: WRAM bank (CGB only)
// 0xFF70 - SVBK: WRAM bank (CGB only)
0x70
=>
self
.ram_bank
&
0x07
,
0x70
=>
self
.ram_bank
&
0x07
,
...
@@ -430,7 +436,7 @@ impl Mmu {
...
@@ -430,7 +436,7 @@ impl Mmu {
}
}
// 0xFF50 - Boot active flag
// 0xFF50 - Boot active flag
0x50
=>
self
.boot_active
=
f
al
se
,
0x50
=>
self
.boot_active
=
v
al
ue
==
0x00
,
// 0xFF70 - SVBK: WRAM bank (CGB only)
// 0xFF70 - SVBK: WRAM bank (CGB only)
0x70
=>
{
0x70
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/state.rs
+
19
−
7
View file @
0c93aa69
...
@@ -610,7 +610,12 @@ impl BeesCore {
...
@@ -610,7 +610,12 @@ impl BeesCore {
buffer
[
1
]
=
b' '
;
buffer
[
1
]
=
b' '
;
}
}
buffer
[
2
]
=
b' '
;
if
gb
.is_dmg
()
{
buffer
[
2
]
=
b'0'
;
}
else
{
buffer
[
2
]
=
b' '
;
}
buffer
[
3
]
=
b' '
;
buffer
[
3
]
=
b' '
;
String
::
from_utf8
(
Vec
::
from
(
buffer
))
.unwrap
()
String
::
from_utf8
(
Vec
::
from
(
buffer
))
.unwrap
()
...
@@ -877,20 +882,27 @@ impl Default for BeesMbc {
...
@@ -877,20 +882,27 @@ impl Default for BeesMbc {
}
}
}
}
pub
fn
save_state_file
(
file_path
:
&
str
,
gb
:
&
mut
GameBoy
)
{
pub
fn
save_state_file
(
file_path
:
&
str
,
gb
:
&
mut
GameBoy
)
->
Result
<
(),
String
>
{
let
mut
file
=
File
::
create
(
file_path
)
.unwrap
();
let
mut
file
=
match
File
::
create
(
file_path
)
{
let
data
=
save_state
(
gb
);
Ok
(
file
)
=>
file
,
Err
(
_
)
=>
return
Err
(
format!
(
"Failed to open file: {}"
,
file_path
)),
};
let
data
=
save_state
(
gb
)
?
;
file
.write_all
(
&
data
)
.unwrap
();
file
.write_all
(
&
data
)
.unwrap
();
Ok
(())
}
}
pub
fn
save_state
(
gb
:
&
mut
GameBoy
)
->
Vec
<
u8
>
{
pub
fn
save_state
(
gb
:
&
mut
GameBoy
)
->
Result
<
Vec
<
u8
>
,
String
>
{
let
mut
data
:
Vec
<
u8
>
=
vec!
[];
let
mut
data
:
Vec
<
u8
>
=
vec!
[];
BeesState
::
from_gb
(
gb
)
.save
(
&
mut
data
);
BeesState
::
from_gb
(
gb
)
.save
(
&
mut
data
);
data
Ok
(
data
)
}
}
pub
fn
load_state_file
(
file_path
:
&
str
,
gb
:
&
mut
GameBoy
)
->
Result
<
(),
String
>
{
pub
fn
load_state_file
(
file_path
:
&
str
,
gb
:
&
mut
GameBoy
)
->
Result
<
(),
String
>
{
let
mut
file
=
File
::
open
(
file_path
)
.unwrap
();
let
mut
file
=
match
File
::
open
(
file_path
)
{
Ok
(
file
)
=>
file
,
Err
(
_
)
=>
return
Err
(
format!
(
"Failed to open file: {}"
,
file_path
)),
};
let
mut
data
=
vec!
[];
let
mut
data
=
vec!
[];
file
.read_to_end
(
&
mut
data
)
.unwrap
();
file
.read_to_end
(
&
mut
data
)
.unwrap
();
load_state
(
&
data
,
gb
)
?
;
load_state
(
&
data
,
gb
)
?
;
...
...
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