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
402fb63b
Verified
Commit
402fb63b
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: better APU cycles
parent
6395f11d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
Initial tentative audio support 🔉
Pipeline
#2258
failed
2 years ago
Stage: build
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/apu.rs
+5
-0
5 additions, 0 deletions
src/apu.rs
src/cpu.rs
+6
-0
6 additions, 0 deletions
src/cpu.rs
src/gb.rs
+9
-0
9 additions, 0 deletions
src/gb.rs
src/mmu.rs
+4
-0
4 additions, 0 deletions
src/mmu.rs
with
24 additions
and
0 deletions
src/apu.rs
+
5
−
0
View file @
402fb63b
...
@@ -49,6 +49,11 @@ impl Apu {
...
@@ -49,6 +49,11 @@ impl Apu {
}
}
}
}
pub
fn
clock
(
&
mut
self
,
cycles
:
u8
)
{
// @todo implement the clock and allow for the proper
// writing of the output buffer at a fixed frequency
}
pub
fn
read
(
&
mut
self
,
addr
:
u16
)
->
u8
{
pub
fn
read
(
&
mut
self
,
addr
:
u16
)
->
u8
{
match
addr
{
match
addr
{
0xff26
=>
1
as
u8
,
// todo implement this
0xff26
=>
1
as
u8
,
// todo implement this
...
...
This diff is collapsed.
Click to expand it.
src/cpu.rs
+
6
−
0
View file @
402fb63b
use
core
::
panic
;
use
core
::
panic
;
use
crate
::{
use
crate
::{
apu
::
Apu
,
debugln
,
debugln
,
inst
::{
EXTENDED
,
INSTRUCTIONS
},
inst
::{
EXTENDED
,
INSTRUCTIONS
},
mmu
::
Mmu
,
mmu
::
Mmu
,
...
@@ -271,6 +272,11 @@ impl Cpu {
...
@@ -271,6 +272,11 @@ impl Cpu {
self
.mmu
()
.ppu
()
self
.mmu
()
.ppu
()
}
}
#[inline(always)]
pub
fn
apu
(
&
mut
self
)
->
&
mut
Apu
{
self
.mmu
()
.apu
()
}
#[inline(always)]
#[inline(always)]
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
self
.mmu
()
.pad
()
self
.mmu
()
.pad
()
...
...
This diff is collapsed.
Click to expand it.
src/gb.rs
+
9
−
0
View file @
402fb63b
...
@@ -75,6 +75,7 @@ impl GameBoy {
...
@@ -75,6 +75,7 @@ impl GameBoy {
pub
fn
clock
(
&
mut
self
)
->
u8
{
pub
fn
clock
(
&
mut
self
)
->
u8
{
let
cycles
=
self
.cpu_clock
();
let
cycles
=
self
.cpu_clock
();
self
.ppu_clock
(
cycles
);
self
.ppu_clock
(
cycles
);
self
.apu_clock
(
cycles
);
self
.timer_clock
(
cycles
);
self
.timer_clock
(
cycles
);
cycles
cycles
}
}
...
@@ -95,6 +96,10 @@ impl GameBoy {
...
@@ -95,6 +96,10 @@ impl GameBoy {
self
.ppu
()
.clock
(
cycles
)
self
.ppu
()
.clock
(
cycles
)
}
}
pub
fn
apu_clock
(
&
mut
self
,
cycles
:
u8
)
{
self
.apu
()
.clock
(
cycles
)
}
pub
fn
timer_clock
(
&
mut
self
,
cycles
:
u8
)
{
pub
fn
timer_clock
(
&
mut
self
,
cycles
:
u8
)
{
self
.timer
()
.clock
(
cycles
)
self
.timer
()
.clock
(
cycles
)
}
}
...
@@ -248,6 +253,10 @@ impl GameBoy {
...
@@ -248,6 +253,10 @@ impl GameBoy {
self
.cpu
.ppu
()
self
.cpu
.ppu
()
}
}
pub
fn
apu
(
&
mut
self
)
->
&
mut
Apu
{
self
.cpu
.apu
()
}
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
self
.cpu
.pad
()
self
.cpu
.pad
()
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mmu.rs
+
4
−
0
View file @
402fb63b
...
@@ -75,6 +75,10 @@ impl Mmu {
...
@@ -75,6 +75,10 @@ impl Mmu {
&
mut
self
.ppu
&
mut
self
.ppu
}
}
pub
fn
apu
(
&
mut
self
)
->
&
mut
Apu
{
&
mut
self
.apu
}
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
pub
fn
pad
(
&
mut
self
)
->
&
mut
Pad
{
&
mut
self
.pad
&
mut
self
.pad
}
}
...
...
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