Commit Graph

9 Commits

Author SHA1 Message Date
7a6c2d80ab Add call/ret/push/pop instructions
* Call/ret/push/pop are implemented and appear to be working
* Call/ret/push/pop is specified in the 0x2000 block, replacing the
  mov instruction
* Mov instruction is now specified in the 0x3000 block

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-26 10:14:48 -05:00
795a890502 Add IDiv instruction for signed integer division
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-25 13:44:03 -05:00
5619c9dc87 Add address deref, syntax, and deref sizes
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-25 12:07:24 -05:00
b0ef49bc2a Add assembler and execution logic
Most everything works, but there's one small bug with the execution
involving jumps - still have to figure that one out.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-18 17:44:41 -05:00
0598bd1526 Rename vm::common -> vm::addr
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-17 16:22:15 -05:00
2c4b56e362 Use lrpar for parsing, big 'ol syntax overhaul
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-17 16:15:06 -05:00
a4a37b5a27 Add Disassemble, fix bug in position calculation
* Disassemble structure can be used for dumping an object section
* Assembler position calculation was messing up, causing jump addresses
  to be wrong. This is fixed.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-10 16:31:08 -05:00
f1ed41f98b Rustfmt
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-09 13:13:26 -05:00
214f0b8aed Add object layout, object parsing, instruction layout
* Object layout and parsing are done in the vm::obj module
* Add MemCursor, a wrapper around the std::io::Cursor type for walking
  through VM memory
* Add vm::tick module for containing the Vm::tick() method
  implementation, since it's pretty big
* Instructions are now variable-sized, and are read lazily,
  one-at-a-time directly from memory.
* Add VM runtime error structure
* Probably some other stuff I forgot

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-03 17:56:32 -05:00