Initial commit
This commit is contained in:
parent
4dc7dc4127
commit
4d81f2b32b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "salt-n-vinegar"
|
||||
version = "0.1.0"
|
||||
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "salt-n-vinegar"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
18
notes.txt
Normal file
18
notes.txt
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
00E0 Clear screen
|
||||
00EE RET
|
||||
Sets the PC to the top of the stack, then subtracts 1 from the stack pointer
|
||||
1nnn JMP, address
|
||||
2nnn CALL address
|
||||
Increments the stack pointer then puts the current PC on the top of the stack, the PC is then set to xxx
|
||||
3xkk SE Vx, byte
|
||||
Skip next instruction if Vx register == kk
|
||||
Increments PC by 2
|
||||
4xkk SNE Vx, byte
|
||||
Skip next instruction if Vx register != kk
|
||||
Increments PC by 2
|
||||
5xy0 SE Vx, Vy
|
||||
Skip next instruction if Vx register == Vy register
|
||||
Increments PC by 2
|
||||
6xkk Ld Vx, Vy
|
||||
Skip next instruction if Vx register == Vy register
|
||||
Increments PC by 2
|
||||
42
src/main.rs
Normal file
42
src/main.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
use std::path;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::process::exit;
|
||||
|
||||
// Module imports
|
||||
mod util;
|
||||
|
||||
fn main()
|
||||
{
|
||||
// Collect our execution args
|
||||
let args: Vec<String> = env::args().collect();
|
||||
// let mut inject_mode: bool = false;
|
||||
// let mut patch_file_path: &String = &"".to_string();
|
||||
|
||||
// Grab our filepath from our options
|
||||
if &args.len() < &2
|
||||
{
|
||||
// No file given, terminate
|
||||
util::print_help();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
let file_path: &String = &args[1];
|
||||
|
||||
if path::Path::new(file_path).exists()
|
||||
{
|
||||
println!("File exists, reading '{}'...", file_path);
|
||||
|
||||
let contents: Result<Vec<u8>, std::io::Error> = fs::read(file_path);
|
||||
|
||||
if contents.is_ok()
|
||||
{
|
||||
let _bytes: &Vec<u8> = &contents.expect("");
|
||||
// let magic_num: &[u8] = &bytes[0..4];
|
||||
}
|
||||
} else
|
||||
{
|
||||
println!("[Error] File '{}' does not exist", file_path);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
3
src/util.rs
Normal file
3
src/util.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
pub fn print_help() {
|
||||
print!("Usage: saltnvinegar [CHIP8_FILE]\n");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user