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
d68cfcb6
Verified
Commit
d68cfcb6
authored
1 year ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
chore: support for the BEES model
parent
5045413a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!31
System state save
Pipeline
#3242
failed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/state.rs
+34
-2
34 additions, 2 deletions
src/state.rs
with
34 additions
and
2 deletions
src/state.rs
+
34
−
2
View file @
d68cfcb6
...
...
@@ -112,7 +112,7 @@ impl Serialize for BeesState {
impl
State
for
BeesState
{
fn
from_gb
(
gb
:
&
mut
GameBoy
)
->
Self
{
Self
{
footer
:
BeesFooter
::
default
(),
// @TODO: check if this makes sense
footer
:
BeesFooter
::
default
(),
name
:
BeesName
::
from_gb
(
gb
),
info
:
BeesInfo
::
from_gb
(
gb
),
core
:
BeesCore
::
from_gb
(
gb
),
...
...
@@ -475,6 +475,37 @@ impl BeesCore {
}
Ok
(())
}
/// Obtains the BEES (GAme Boy) model string using the
/// provided GameBoy instance.
fn
bees_model
(
gb
:
&
GameBoy
)
->
String
{
let
mut
buffer
=
[
0x00_u8
;
4
];
if
gb
.is_dmg
()
{
buffer
[
0
]
=
'G'
as
u8
;
}
else
if
gb
.is_cgb
()
{
buffer
[
0
]
=
'C'
as
u8
;
}
else
if
gb
.is_sgb
()
{
buffer
[
0
]
=
'S'
as
u8
;
}
else
{
buffer
[
0
]
=
' '
as
u8
;
}
if
gb
.is_dmg
()
{
buffer
[
1
]
=
'D'
as
u8
;
}
else
if
gb
.is_cgb
()
{
buffer
[
1
]
=
'C'
as
u8
;
}
else
if
gb
.is_sgb
()
{
buffer
[
1
]
=
'N'
as
u8
;
}
else
{
buffer
[
1
]
=
' '
as
u8
;
}
buffer
[
2
]
=
' '
as
u8
;
buffer
[
3
]
=
' '
as
u8
;
String
::
from_utf8
(
Vec
::
from
(
buffer
))
.unwrap
()
}
}
impl
Serialize
for
BeesCore
{
...
...
@@ -572,7 +603,7 @@ impl Serialize for BeesCore {
impl
State
for
BeesCore
{
fn
from_gb
(
gb
:
&
mut
GameBoy
)
->
Self
{
let
mut
core
=
Self
::
new
(
S
tring
::
from
(
"GD "
),
// @TODO: use the proper string
S
elf
::
bees_model
(
gb
),
gb
.cpu_i
()
.pc
(),
gb
.cpu_i
()
.af
(),
gb
.cpu_i
()
.bc
(),
...
...
@@ -583,6 +614,7 @@ impl State for BeesCore {
gb
.mmu_i
()
.ie
,
0
,
// @TODO: these registers cannot be totally retrieved
// because of that some audio noise exists
gb
.mmu
()
.read_many
(
0xff00
,
128
)
.try_into
()
.unwrap
(),
);
core
.ram
.fill_buffer
(
gb
.mmu
()
.ram
());
...
...
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