1
0
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:
Daniel Barber 2015-12-10 14:57:39 +01:00
commit 5f4c4db0ad
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8
4 changed files with 60 additions and 0 deletions

19
.gitignore vendored Normal file
View 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
View File

@ -0,0 +1,4 @@
[root]
name = "8080"
version = "0.0.1"

5
Cargo.toml Normal file
View File

@ -0,0 +1,5 @@
[package]
name = "8080"
version = "0.0.1"
authors = [ "Dan Barber <hello@danbarber.me>" ]

32
src/main.rs Normal file
View 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;
}
}