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
ce49dbd2
Verified
Commit
ce49dbd2
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: new instruction
parent
b6e722cc
No related branches found
No related tags found
No related merge requests found
Pipeline
#862
passed
2 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/inst.rs
+81
-16
81 additions, 16 deletions
src/inst.rs
with
81 additions
and
16 deletions
src/inst.rs
+
81
−
16
View file @
ce49dbd2
...
...
@@ -104,20 +104,20 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
ld_e_mhl
,
8
,
"LD E, [HL]"
),
(
ld_e_a
,
4
,
"LD E, A"
),
// 0x6 opcodes
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
ld_h_b
,
4
,
"LD H, B
"
),
(
ld_h_c
,
4
,
"LD H, C
"
),
(
ld_h_d
,
4
,
"LD H, D
"
),
(
ld_h_e
,
4
,
"LD H, E
"
),
(
ld_h_h
,
4
,
"LD H, H
"
),
(
ld_h_
l
,
4
,
"
LD H, L
"
),
(
ld_h_mh
l
,
8
,
"
LD H, [HL]
"
),
(
ld_h_a
,
4
,
"LD H, A"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
ld_l_b
,
4
,
"LD L, B
"
),
(
ld_l_c
,
4
,
"LD L, C
"
),
(
ld_l_d
,
4
,
"LD L, D
"
),
(
ld_l_e
,
4
,
"LD L, E
"
),
(
ld_l_h
,
4
,
"LD L, H
"
),
(
ld_l_
l
,
4
,
"
LD L, L
"
),
(
ld_l_mhl
,
8
,
"LD L, [HL]"
),
(
ld_l_a
,
4
,
"LD L, A"
),
// 0x7 opcodes
...
...
@@ -125,8 +125,8 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
ld_mhl_c
,
8
,
"LD [HL], C"
),
(
ld_mhl_d
,
8
,
"LD [HL], D"
),
(
ld_mhl_e
,
8
,
"LD [HL], E"
),
(
noimpl
,
4
,
"
! UNIMP !
"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
ld_mhl_h
,
8
,
"
LD [HL], H
"
),
(
ld_mhl_
l
,
8
,
"
LD [HL], L
"
),
(
halt
,
4
,
"HALT"
),
(
ld_mhl_a
,
8
,
"LD [HL], A"
),
(
ld_a_b
,
4
,
"LD A, B"
),
...
...
@@ -136,7 +136,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
ld_a_h
,
4
,
"LD A, H"
),
(
ld_a_l
,
4
,
"LD A, L"
),
(
ld_a_mhl
,
8
,
"LD A, [HL]"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
ld_a_a
,
4
,
"LD A, A
"
),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cpu
.hl
(),
cpu
.e
);
}
fn
ld_mhl_h
(
cpu
:
&
mut
Cpu
)
{
cpu
.mmu
.write
(
cpu
.hl
(),
cpu
.h
);
}
fn
ld_mhl_l
(
cpu
:
&
mut
Cpu
)
{
cpu
.mmu
.write
(
cpu
.hl
(),
cpu
.l
);
}
fn
halt
(
cpu
:
&
mut
Cpu
)
{
cpu
.halt
();
}
...
...
@@ -1147,6 +1208,10 @@ fn ld_a_mhl(cpu: &mut Cpu) {
cpu
.a
=
byte
;
}
fn
ld_a_a
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
cpu
.a
;
}
fn
add_a_b
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
add_set_flags
(
cpu
,
cpu
.a
,
cpu
.b
);
}
...
...
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