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
b1b7aaad
Verified
Commit
b1b7aaad
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: more instructions
parent
96c51b90
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cpu.rs
+2
-2
2 additions, 2 deletions
src/cpu.rs
src/inst.rs
+16
-3
16 additions, 3 deletions
src/inst.rs
with
18 additions
and
5 deletions
src/cpu.rs
+
2
−
2
View file @
b1b7aaad
...
...
@@ -77,8 +77,8 @@ impl Cpu {
println!
(
"GOING TO PLAY BOOT SOUND"
);
}
if
pc
==
0x00e
0
{
println!
(
"GOING TO PLAY BOOT 0x00e
0
"
);
if
pc
==
0x00e
9
{
println!
(
"GOING TO PLAY BOOT 0x00e
f
"
);
}
// calls the current instruction and increments the number of
...
...
This diff is collapsed.
Click to expand it.
src/inst.rs
+
16
−
3
View file @
b1b7aaad
...
...
@@ -129,12 +129,12 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
ld_mhl_a
,
8
,
"LD [HL], A"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
ld_a_b
,
4
,
"LD A, B
"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
ld_a_e
,
4
,
"LD A, E"
),
(
ld_a_h
,
4
,
"LD A, H"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
ld_a_
l
,
4
,
"
LD A, L
"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimpl
,
4
,
"! UNIMP !"
),
// 0x8 opcodes
...
...
@@ -203,7 +203,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimpl
,
4
,
"! UNIMP !"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
cp_a_mh
l
,
8
,
"
CP A, [HL]
"
),
(
noimpl
,
4
,
"! UNIMP !"
),
// 0xc opcodes
(
ret_nz
,
8
,
"RET NZ"
),
...
...
@@ -717,6 +717,10 @@ fn ld_mhl_a(cpu: &mut Cpu) {
cpu
.mmu
.write
(
cpu
.hl
(),
cpu
.a
);
}
fn
ld_a_b
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
cpu
.b
;
}
fn
ld_a_e
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
cpu
.e
;
}
...
...
@@ -725,6 +729,10 @@ fn ld_a_h(cpu: &mut Cpu) {
cpu
.a
=
cpu
.h
;
}
fn
ld_a_l
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
cpu
.l
;
}
fn
sub_a_b
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
=
sub_set_flags
(
cpu
,
cpu
.a
,
cpu
.b
);
}
...
...
@@ -738,6 +746,11 @@ fn xor_a_a(cpu: &mut Cpu) {
cpu
.set_carry
(
false
);
}
fn
cp_a_mhl
(
cpu
:
&
mut
Cpu
)
{
let
byte
=
cpu
.mmu
.read
(
cpu
.hl
());
sub_set_flags
(
cpu
,
cpu
.a
,
byte
);
}
fn
ret_nz
(
cpu
:
&
mut
Cpu
)
{
if
cpu
.get_zero
()
{
return
;
...
...
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