-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use chip8_emulator::chip8::Chip8; | ||
use log; | ||
use std::env; | ||
use std::process::exit; | ||
|
||
fn main() { | ||
env_logger::init(); | ||
|
||
// First argument is the name of the binary | ||
let a: Vec<String> = env::args().collect(); | ||
|
||
if a.len() < 2 { | ||
log::error!("You need to pass filename for the ROM"); | ||
exit(1); | ||
} | ||
|
||
let filename = &a[1]; | ||
log::info!("Emulating {filename}"); | ||
|
||
let mut chip = Chip8::default(); | ||
chip.load(filename).unwrap(); | ||
//chip.dump_memory(); | ||
chip.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use std::fmt; | ||
|
||
/// Opcode is always 2 bytes in CHIP8 | ||
pub struct Opcode { | ||
value: u16, | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
clear | ||
echo "Monitoring src/ for changes..." | ||
echo -n "Hint: By default it runs tests." | ||
echo "Pass 'b' to build or 'r' to run the code" | ||
|
||
case $1 in | ||
b) CMD="cargo build" ;; | ||
r) CMD="cargo run --bin emulator chip8-roms/IBM_logo.ch8" ;; | ||
*) CMD="cargo test" ;; | ||
esac | ||
|
||
inotifywait -q -m -r -e modify src | while read -r _DIRECTORY EVENT _FILE; do | ||
# echo $DIRECTORY $EVENT $FILE | ||
case $EVENT in | ||
MODIFY*) | ||
clear | ||
echo "= ${CMD} ===============================" | ||
echo | ||
RUST_LOG=debug bash -c "${CMD}" | ||
echo | ||
echo "= $(date) ===================" | ||
;; | ||
esac | ||
done |