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
da41d457
Verified
Commit
da41d457
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: more panics
parent
34c24acb
No related branches found
No related tags found
No related merge requests found
Pipeline
#623
passed
2 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/chip8_neo.rs
+11
-5
11 additions, 5 deletions
src/chip8_neo.rs
with
11 additions
and
5 deletions
src/chip8_neo.rs
+
11
−
5
View file @
da41d457
...
@@ -114,7 +114,10 @@ impl Chip8Neo {
...
@@ -114,7 +114,10 @@ impl Chip8Neo {
self
.sp
-=
1
;
self
.sp
-=
1
;
self
.pc
=
self
.stack
[
self
.sp
as
usize
];
self
.pc
=
self
.stack
[
self
.sp
as
usize
];
}
}
_
=>
println!
(
"unimplemented instruction "
),
_
=>
panic!
(
"unimplemented instruction 0x0000, instruction 0x{:04x}"
,
instruction
),
},
},
0x1000
=>
self
.pc
=
address
,
0x1000
=>
self
.pc
=
address
,
0x2000
=>
{
0x2000
=>
{
...
@@ -153,7 +156,10 @@ impl Chip8Neo {
...
@@ -153,7 +156,10 @@ impl Chip8Neo {
self
.regs
[
0xf
]
=
(
self
.regs
[
x
]
&
0x80
)
>>
7
;
self
.regs
[
0xf
]
=
(
self
.regs
[
x
]
&
0x80
)
>>
7
;
self
.regs
[
x
]
<<=
1
;
self
.regs
[
x
]
<<=
1
;
}
}
_
=>
println!
(
"unimplemented instruction"
),
_
=>
panic!
(
"unimplemented instruction 0x8000, instruction 0x{:04x}"
,
instruction
),
},
},
0x9000
=>
self
.pc
+=
if
self
.regs
[
x
]
!=
self
.regs
[
y
]
{
2
}
else
{
0
},
0x9000
=>
self
.pc
+=
if
self
.regs
[
x
]
!=
self
.regs
[
y
]
{
2
}
else
{
0
},
0xa000
=>
self
.i
=
address
,
0xa000
=>
self
.i
=
address
,
...
@@ -175,7 +181,7 @@ impl Chip8Neo {
...
@@ -175,7 +181,7 @@ impl Chip8Neo {
let
key
=
self
.regs
[
x
]
as
usize
;
let
key
=
self
.regs
[
x
]
as
usize
;
self
.pc
+=
if
!
self
.keys
[
key
]
{
2
}
else
{
0
}
self
.pc
+=
if
!
self
.keys
[
key
]
{
2
}
else
{
0
}
}
}
_
=>
p
rintln
!
(
_
=>
p
anic
!
(
"unimplemented instruction 0xe000, instruction 0x{:04x}"
,
"unimplemented instruction 0xe000, instruction 0x{:04x}"
,
instruction
instruction
),
),
...
@@ -202,12 +208,12 @@ impl Chip8Neo {
...
@@ -202,12 +208,12 @@ impl Chip8Neo {
.clone_from_slice
(
&
self
.regs
[
0
..
x
+
1
]),
.clone_from_slice
(
&
self
.regs
[
0
..
x
+
1
]),
0x65
=>
self
.regs
[
0
..
x
+
1
]
0x65
=>
self
.regs
[
0
..
x
+
1
]
.clone_from_slice
(
&
self
.ram
[
self
.i
as
usize
..
self
.i
as
usize
+
x
+
1
]),
.clone_from_slice
(
&
self
.ram
[
self
.i
as
usize
..
self
.i
as
usize
+
x
+
1
]),
_
=>
p
rintln
!
(
_
=>
p
anic
!
(
"unimplemented instruction 0xf000, instruction 0x{:04x}"
,
"unimplemented instruction 0xf000, instruction 0x{:04x}"
,
instruction
instruction
),
),
},
},
_
=>
p
rintln
!
(
_
=>
p
anic
!
(
"unimplemented opcode 0x{:04x}, instruction 0x{:04x}"
,
"unimplemented opcode 0x{:04x}, instruction 0x{:04x}"
,
opcode
,
instruction
opcode
,
instruction
),
),
...
...
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