Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
chip-ahoyto
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
chip-ahoyto
Commits
ab3dedf3
Verified
Commit
ab3dedf3
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
refactor: cleanup spaces
parent
0ba1310f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!5
Support for the new web layout
Pipeline
#657
passed
2 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/web/index.js
+8
-9
8 additions, 9 deletions
examples/web/index.js
with
8 additions
and
9 deletions
examples/web/index.js
+
8
−
9
View file @
ab3dedf3
...
...
@@ -75,14 +75,14 @@ const state = {
// runs the sequence as an infinite loop, running
// the associated CPU cycles accordingly
while
(
true
)
{
while
(
true
)
{
const
ratioLogic
=
state
.
logicFrequency
/
VISUAL_HZ
;
for
(
let
i
=
0
;
i
<
ratioLogic
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ratioLogic
;
i
++
)
{
state
.
chip8
.
clock_ws
();
}
const
ratioTimer
=
TIMER_HZ
/
VISUAL_HZ
;
for
(
let
i
=
0
;
i
<
ratioTimer
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ratioTimer
;
i
++
)
{
state
.
chip8
.
clock_dt_ws
();
state
.
chip8
.
clock_st_ws
();
}
...
...
@@ -90,9 +90,9 @@ const state = {
// updates the canvas object with the new
// visual information coming in
updateCanvas
(
state
.
chip8
.
vram_ws
());
// waits a little bit for the next frame to be draw
// @todo
need to define target time for draw
// @todo
NEED TO DEFINE A TARGET TIME
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(
resolve
,
1000
/
VISUAL_HZ
);
});
...
...
@@ -128,7 +128,7 @@ const registerDrop = () => {
state
.
chip8
.
reset_hard_ws
();
state
.
chip8
.
load_rom_ws
(
data
);
setRom
(
file
.
name
,
file
.
size
);
showToast
(
`Loaded
${
file
.
name
}
ROM successfully!`
);
...
...
@@ -161,8 +161,7 @@ const registerKeys = () => {
return
;
}
switch
(
event
.
key
)
{
switch
(
event
.
key
)
{
case
"
+
"
:
setLogicFrequency
(
state
.
logicFrequency
+
60
);
break
;
...
...
@@ -287,4 +286,4 @@ const updateCanvas = (pixels) => {
}
state
.
canvasCtx
.
putImageData
(
state
.
image
,
0
,
0
);
state
.
canvasScaledCtx
.
drawImage
(
state
.
canvas
,
0
,
0
);
};
};
\ No newline at end of file
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