Updated spec page
This commit is contained in:
parent
75465c6a20
commit
95272a3472
2 changed files with 9 additions and 11 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Iridium
|
## Iridium
|
||||||
|
|
||||||
Corten is based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial. His virtual machine used for the tutorial is known as [Iridium](https://github.com/fhaynes/iridium). Despite it's origins, it does aim to be full a fledged virtual machine and is already on it's [third iteration](https://gitlab.com/fletchercp/iridium3) with support for SSH, PIDs and Strings. Corten aims to be Iridium 1-compatible.
|
Corten is based on Fletcher Haynes's [So you want to build a language VM](https://blog.subnetzero.io/post/building-language-vm-part-01/) tutorial. His virtual machine used for the tutorial is known as [Iridium](https://github.com/fhaynes/iridium) and is based on the [MIPS64 Release 6](https://en.wikipedia.org/wiki/MIPS_architecture#MIPS32/MIPS64_Release_6) architecture. Corten aims to be Iridium 1-compatible.
|
||||||
|
|
||||||
## Instruction Set
|
## Instruction Set
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ Corten is based on Fletcher Haynes's [So you want to build a language VM](https:
|
||||||
| 10 | NEQ | Not equal |
|
| 10 | NEQ | Not equal |
|
||||||
| 11 | GTE | Greater then or equal to |
|
| 11 | GTE | Greater then or equal to |
|
||||||
| 12 | GT | Greater then |
|
| 12 | GT | Greater then |
|
||||||
| 13 | LTE | Less then or equal |
|
| 13 | LTE | Less then or equal to |
|
||||||
| 14 | LT | Less then
|
| 14 | LT | Less then |
|
||||||
| 15 | JMPE | Jump if equal |
|
| 15 | JMPE | Jump if equal |
|
||||||
| 16 | NOP |
|
| 16 | NOP |
|
||||||
| _ | IGL | Illegal action |
|
| _ | IGL | Illegal action |
|
14
src/repl.rs
14
src/repl.rs
|
@ -1,7 +1,7 @@
|
||||||
use std;
|
use std;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::num::ParseIntError;
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
use std::num::ParseIntError;
|
||||||
|
|
||||||
use crate::vm::VM;
|
use crate::vm::VM;
|
||||||
use metacrate::crate_version;
|
use metacrate::crate_version;
|
||||||
|
@ -59,7 +59,7 @@ impl REPL {
|
||||||
match buffer {
|
match buffer {
|
||||||
".exit" => {
|
".exit" => {
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
},
|
}
|
||||||
".history" => {
|
".history" => {
|
||||||
for command in &self.command_buffer {
|
for command in &self.command_buffer {
|
||||||
println!("{}", command);
|
println!("{}", command);
|
||||||
|
@ -70,11 +70,11 @@ impl REPL {
|
||||||
for instruction in &self.vm.program {
|
for instruction in &self.vm.program {
|
||||||
println!("{}", instruction);
|
println!("{}", instruction);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
".registers" => {
|
".registers" => {
|
||||||
println!("Listing registers and all contents:");
|
println!("Listing registers and all contents:");
|
||||||
println!("{:#?}", self.vm.registers);
|
println!("{:#?}", self.vm.registers);
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let results = self.parse_hex(buffer);
|
let results = self.parse_hex(buffer);
|
||||||
match results {
|
match results {
|
||||||
|
@ -103,12 +103,10 @@ impl REPL {
|
||||||
match byte {
|
match byte {
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
results.push(result);
|
results.push(result);
|
||||||
},
|
|
||||||
Err(err) => {
|
|
||||||
return Err(err)
|
|
||||||
}
|
}
|
||||||
|
Err(err) => return Err(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue