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
e3e02402
Verified
Commit
e3e02402
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: better opcodes
parent
5de8af66
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
+9
-4
9 additions, 4 deletions
src/cpu.rs
with
9 additions
and
4 deletions
src/cpu.rs
+
9
−
4
View file @
e3e02402
...
...
@@ -5,12 +5,12 @@ pub const PREFIX: u8 = 0xcb;
pub
const
INSTRUCTIONS
:
[(
fn
(
&
mut
Cpu
),
u8
,
&
'static
str
);
208
]
=
[
// 0x0 opcodes
(
nop
,
4
,
"NOP"
),
(
ld_bc_u16
,
12
,
"LD BC,
NN
"
),
(
ld_bc_u16
,
12
,
"LD BC,
u16
"
),
(
ld_mbc_a
,
8
,
"LD [BC], A"
),
(
inc_bc
,
8
,
"INC BC"
),
(
inc_b
,
4
,
"INC B"
),
(
dec_b
,
4
,
"DEC B"
),
(
ld_b_u8
,
8
,
"LD B,
N
"
),
(
ld_b_u8
,
8
,
"LD B,
u8
"
),
(
rlca
,
4
,
"RLCA"
),
(
ld_mu16_sp
,
20
,
"LD [u16], SP"
),
(
add_hl_bc
,
8
,
"ADD HL, BC"
),
...
...
@@ -18,7 +18,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 208] = [
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"
NOP
"
),
(
ld_c_u8
,
8
,
"
LD C, u8
"
),
(
nop
,
4
,
"NOP"
),
// 0x1 opcodes
(
nop
,
4
,
"NOP"
),
...
...
@@ -56,7 +56,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 208] = [
(
nop
,
4
,
"NOP"
),
// 0x3 opcodes
(
nop
,
4
,
"NOP"
),
(
ld_sp_u16
,
12
,
"LD SP,
NN
"
),
(
ld_sp_u16
,
12
,
"LD SP,
u16
"
),
(
ld_mhld_a
,
8
,
"LD [HL]-, A"
),
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"NOP"
),
...
...
@@ -660,6 +660,11 @@ fn add_hl_bc(cpu: &mut Cpu) {
cpu
.set_hl
(
value
);
}
fn
ld_c_u8
(
cpu
:
&
mut
Cpu
)
{
let
byte
=
cpu
.read_u8
();
cpu
.c
=
byte
;
}
fn
jr_nz_i8
(
cpu
:
&
mut
Cpu
)
{
let
byte
=
cpu
.read_u8
()
as
i8
;
...
...
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