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
7387c805
Verified
Commit
7387c805
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: new flags
parent
ce38a79c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cpu.rs
+49
-0
49 additions, 0 deletions
src/cpu.rs
with
49 additions
and
0 deletions
src/cpu.rs
+
49
−
0
View file @
7387c805
pub
struct
Cpu
{
pc
:
u16
,
sp
:
u16
,
reg_a
:
u8
,
reg_b
:
u8
,
reg_c
:
u8
,
reg_d
:
u8
,
reg_e
:
u8
,
reg_f
:
u8
,
reg_h
:
u8
,
reg_l
:
u8
,
}
impl
Cpu
{
#[inline(always)]
fn
reg_af
(
&
self
)
->
u16
{
(
self
.reg_a
as
u16
)
<<
8
|
self
.reg_f
as
u16
}
#[inline(always)]
fn
reg_bc
(
&
self
)
->
u16
{
(
self
.reg_b
as
u16
)
<<
8
|
self
.reg_c
as
u16
}
#[inline(always)]
fn
reg_de
(
&
self
)
->
u16
{
(
self
.reg_d
as
u16
)
<<
8
|
self
.reg_e
as
u16
}
#[inline(always)]
fn
reg_hl
(
&
self
)
->
u16
{
(
self
.reg_h
as
u16
)
<<
8
|
self
.reg_l
as
u16
}
#[inline(always)]
fn
zero_flag
(
&
self
)
->
bool
{
self
.reg_f
&
0x40
==
1
}
#[inline(always)]
fn
sub_flag
(
&
self
)
->
bool
{
self
.reg_f
&
0x20
==
1
}
#[inline(always)]
fn
half_carry_flag
(
&
self
)
->
bool
{
self
.reg_f
&
0x10
==
1
}
#[inline(always)]
fn
carry_flag
(
&
self
)
->
bool
{
self
.reg_f
&
0x08
==
1
}
}
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