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
593a20cb
Verified
Commit
593a20cb
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
fet: more support for mmu and new opcode
parent
e3e02402
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
+6
-1
6 additions, 1 deletion
src/cpu.rs
src/mmu.rs
+23
-0
23 additions, 0 deletions
src/mmu.rs
with
29 additions
and
1 deletion
src/cpu.rs
+
6
−
1
View file @
593a20cb
...
...
@@ -69,7 +69,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 208] = [
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"NOP"
),
(
nop
,
4
,
"
NOP
"
),
(
ld_a_u8
,
8
,
"
LD A, u8
"
),
(
nop
,
4
,
"NOP"
),
// 0x4 opcodes
(
nop
,
4
,
"NOP"
),
...
...
@@ -690,6 +690,11 @@ fn ld_mhld_a(cpu: &mut Cpu) {
cpu
.set_hl
(
cpu
.hl
()
.wrapping_sub
(
1
));
}
fn
ld_a_u8
(
cpu
:
&
mut
Cpu
)
{
let
byte
=
cpu
.read_u8
();
cpu
.a
=
byte
;
}
fn
xor_a_a
(
cpu
:
&
mut
Cpu
)
{
cpu
.a
^=
cpu
.a
;
...
...
This diff is collapsed.
Click to expand it.
src/mmu.rs
+
23
−
0
View file @
593a20cb
...
...
@@ -47,6 +47,29 @@ impl Mmu {
println!
(
"WRITING TO RAM"
);
self
.ram
[(
addr
&
0x1fff
)
as
usize
]
=
value
;
}
// Working RAM shadow
0xe000
=>
{
println!
(
"WRITING TO RAM Shadow"
);
self
.ram
[(
addr
&
0x1fff
)
as
usize
]
=
value
;
}
// Working RAM shadow, I/O, Zero-page RAM
0xf000
=>
match
addr
&
0x0f00
{
0x000
|
0x100
|
0x200
|
0x300
|
0x400
|
0x500
|
0x600
|
0x700
|
0x800
|
0x900
|
0xa00
|
0xb00
|
0xc00
|
0xd00
=>
{
self
.ram
[(
addr
&
0x1fff
)
as
usize
]
=
value
;
}
0xe00
=>
{
println!
(
"WRITING TO GPU OAM"
);
}
0xf00
=>
{
if
addr
>=
0xff80
{
println!
(
"WRITING TO Zero page"
);
}
else
{
println!
(
"WRITING TO IO control"
);
}
}
addr
=>
panic!
(
"Writing in unknown location 0x{:04x}"
,
addr
),
},
addr
=>
panic!
(
"Writing in unknown location 0x{:04x}"
,
addr
),
}
}
...
...
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