Commit Graph

9 Commits

Author SHA1 Message Date
7504b81b2d Require assembler sections to specify where in virtual memory they begin
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-10 18:02:44 -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
00027c4542 Add memory and register checking when required in the VM
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-09 14:10:02 -05:00
f1ed41f98b Rustfmt
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-09 13:13:26 -05:00
1c16be650a Start using 'symbol' in favor of 'name' or 'label'
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-09 13:12:56 -05:00
e198da5825 Finish up parser and assembler with more-or-less complete syntax
Major changes inlude:

* Bit the bullet and now instructions have their length hard-coded
* Move from_utf8 object parsing to be done by their objects (instead of
  a Parser god object)
* A list of AST sections are assembled into an Object using the new
  vm::obj::assemble module.
* Changed the object layout some in the spec, and adjusted code to match
  this.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-02-09 13:04:56 -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
e8b874a3c9 Implement ObjParser::parse_sections
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-01-28 19:17:35 -05:00
54f61101c6 Rename vm::bin -> vm::obj
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-01-28 18:35:41 -05:00