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
7d2727d2
Verified
Commit
7d2727d2
authored
2 years ago
by
João Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
feat: more instructions
parent
aa38e1ec
No related branches found
No related tags found
No related merge requests found
Pipeline
#891
passed
2 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/sdl/src/main.rs
+4
-4
4 additions, 4 deletions
examples/sdl/src/main.rs
src/inst.rs
+17
-2
17 additions, 2 deletions
src/inst.rs
with
21 additions
and
6 deletions
examples/sdl/src/main.rs
+
4
−
4
View file @
7d2727d2
...
...
@@ -81,24 +81,24 @@ fn main() {
// creates a new Game Boy instance and loads both the boot ROM
// and the initial game ROM to "start the engine"
let
mut
game_boy
=
GameBoy
::
new
();
game_boy
.load_boot_mg
b
_bootix
();
game_boy
.load_boot_
d
mg_bootix
();
//game_boy.load_rom_file("../../res/roms.prop/tetris.gb");
//game_boy.load_rom_file("../../res/roms.prop/alleyway.gb");
//game_boy.load_rom_file("../../res/roms/firstwhite.gb");
game_boy
.load_rom_file
(
"../../res/roms/opus5.gb"
);
//
game_boy.load_rom_file("../../res/roms/opus5.gb");
//game_boy.load_rom_file("../../res/roms/special.gb");
//game_boy.load_rom_file("../../res/roms/paradius/cpu/01-special.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/02-interrupts.gb"); // NO FINISH
//game_boy.load_rom_file("../../res/roms/paradius/cpu/03-op sp,hl.gb"); //
NO FINISH
//game_boy.load_rom_file("../../res/roms/paradius/cpu/03-op sp,hl.gb"); //
PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/04-op r,imm.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/05-op rp.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/06-ld r,r.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/07-jr,jp,call,ret,rst.gb"); // PASSED
//game_boy.load_rom_file("../../res/roms/paradius/cpu/08-misc instrs.gb"); // PASSED
//
game_boy.load_rom_file("../../res/roms/paradius/cpu/09-op r,r.gb"); // NO FINISH
game_boy
.load_rom_file
(
"../../res/roms/paradius/cpu/09-op r,r.gb"
);
// NO FINISH
//game_boy.load_rom_file("../../res/roms/paradius/cpu/11-op a,(hl).gb"); // NO FINISH
'main
:
loop
{
...
...
This diff is collapsed.
Click to expand it.
src/inst.rs
+
17
−
2
View file @
7d2727d2
...
...
@@ -220,7 +220,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
ret_z
,
8
,
"RET Z"
),
(
ret
,
16
,
"RET"
),
(
jp_z_u16
,
12
,
"JP Z, u16"
),
(
noimp
l
,
4
,
"
! UNIMP !
"
),
(
illega
l
,
4
,
"
ILLEGAL
"
),
(
call_z_u16
,
12
,
"CALL Z, u16"
),
(
call_u16
,
24
,
"CALL u16"
),
(
adc_a_u8
,
8
,
"ADC A, u8 "
),
...
...
@@ -268,7 +268,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(
push_af
,
16
,
"PUSH AF"
),
(
or_a_u8
,
8
,
"OR A, u8"
),
(
rst_30h
,
16
,
"RST 30h"
),
(
noimpl
,
4
,
"! UNIMP !
"
),
(
ld_hl_spi8
,
12
,
"LD HL, SP+i8
"
),
(
ld_sp_hl
,
8
,
"LD SP, HL"
),
(
ld_a_mu16
,
16
,
"LD A [u16]"
),
(
ei
,
4
,
"EI"
),
...
...
@@ -2005,6 +2005,21 @@ fn rst_30h(cpu: &mut Cpu) {
rst
(
cpu
,
0x0030
);
}
fn
ld_hl_spi8
(
cpu
:
&
mut
Cpu
)
{
let
sp
=
cpu
.sp
as
i32
;
let
byte
=
cpu
.read_u8
()
as
i8
;
let
byte_i32
=
byte
as
i32
;
let
result
=
sp
.wrapping_add
(
byte_i32
);
cpu
.set_sub
(
false
);
cpu
.set_zero
(
false
);
cpu
.set_half_carry
((
sp
^
byte_i32
^
result
)
&
0x10
==
0x10
);
cpu
.set_carry
((
sp
^
byte_i32
^
result
)
&
0x100
==
0x100
);
cpu
.set_hl
(
result
as
u16
);
}
fn
ld_sp_hl
(
cpu
:
&
mut
Cpu
)
{
cpu
.sp
=
cpu
.hl
();
}
...
...
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