mirror of
https://github.com/danbee/8080
synced 2025-03-04 08:39:07 +00:00
First commit
Started disassembler.
This commit is contained in:
commit
5f4c4db0ad
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Compiled files
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
|
*.rlib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# Generated by Cargo
|
||||||
|
/target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for
|
||||||
|
# libraries
|
||||||
|
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# Ignore the invaders roms
|
||||||
|
invaders/
|
||||||
4
Cargo.lock
generated
Normal file
4
Cargo.lock
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[root]
|
||||||
|
name = "8080"
|
||||||
|
version = "0.0.1"
|
||||||
|
|
||||||
5
Cargo.toml
Normal file
5
Cargo.toml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[package]
|
||||||
|
|
||||||
|
name = "8080"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = [ "Dan Barber <hello@danbarber.me>" ]
|
||||||
32
src/main.rs
Normal file
32
src/main.rs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
use std::io::{self, Read};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut input: Vec<u8> = vec![];
|
||||||
|
|
||||||
|
let mut counter: usize = 0;
|
||||||
|
|
||||||
|
io::stdin()
|
||||||
|
.read_to_end(&mut input)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
// for byte in input.iter() {
|
||||||
|
// println!("{}", byte);
|
||||||
|
// };
|
||||||
|
|
||||||
|
while counter < input.len() {
|
||||||
|
// get the instruction
|
||||||
|
let opcode = input[counter];
|
||||||
|
match opcode {
|
||||||
|
0x00 => println!("NOP"),
|
||||||
|
0xc3 => {
|
||||||
|
counter += 1;
|
||||||
|
let low = input[counter];
|
||||||
|
counter += 1;
|
||||||
|
let high = input[counter];
|
||||||
|
println!("JMP ${:x}{:x}", high, low);
|
||||||
|
}
|
||||||
|
_ => println!("{:x}", opcode),
|
||||||
|
}
|
||||||
|
counter += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user