mirror of
https://github.com/keystone-engine/keystone
synced 2026-06-08 15:15:30 +00:00
21 lines
520 B
Rust
21 lines
520 B
Rust
extern crate keystone;
|
|
use keystone::*;
|
|
|
|
fn main() {
|
|
let engine = Keystone::new(Arch::X86, MODE_32)
|
|
.expect("Could not initialize Keystone engine");
|
|
|
|
engine.option(OptionType::SYNTAX, OPT_SYNTAX_NASM)
|
|
.expect("Could not set option to nasm syntax");
|
|
|
|
let result = engine.asm("mov ah, 0x80".to_string(), 0)
|
|
.expect("Could not assemble");
|
|
|
|
println!("ASM result: {}", result);
|
|
|
|
if let Err(err) = engine.asm("INVALID".to_string(), 0) {
|
|
println!("Error: {}", err);
|
|
}
|
|
}
|
|
|