mu/subx
Kartik Agaram 5e2e2eb5da 4337
Return to the usual whitespace-skipping istreams. No need to go beyond
word-based parsing.

This exercise reinforces the amount of duplication between
load_program() and transform_immediate().
2018-07-10 20:26:35 -07:00
..
teensy 4323 2018-07-07 13:54:16 -07:00
000organization.cc 4061 2017-10-13 21:50:41 -07:00
001help.cc 4289 - beginnings of a translator to ELF 2018-06-30 09:41:22 -07:00
002test.cc 4288 2018-06-28 22:03:48 -07:00
003trace.cc 4033 2017-10-12 17:00:48 -07:00
003trace.test.cc 3930 - experimental bytecode interpreter 2017-06-19 21:47:07 -07:00
010core.cc 4337 2018-07-10 20:26:35 -07:00
011direct_addressing.cc 4329 2018-07-08 22:40:07 -07:00
012indirect_addressing.cc 4327 2018-07-08 22:33:15 -07:00
013immediate_addressing.cc 4327 2018-07-08 22:33:15 -07:00
014index_addressing.cc 4327 2018-07-08 22:33:15 -07:00
015jump_relative.cc 4185 2018-01-24 12:59:14 -08:00
016jump_relative.cc 4185 2018-01-24 12:59:14 -08:00
017functions.cc 4327 2018-07-08 22:33:15 -07:00
019syscalls.cc 4333 2018-07-10 07:14:07 -07:00
020elf.cc 4334 2018-07-10 07:18:36 -07:00
021translate.cc 4334 2018-07-10 07:18:36 -07:00
022transform_immediate.cc 4337 2018-07-10 20:26:35 -07:00
Readme.md 4319 2018-07-07 09:36:24 -07:00
build 4288 2018-06-28 22:03:48 -07:00
build_and_test_until 4335 2018-07-10 20:18:11 -07:00
cheatsheet.pdf 4026 2017-10-12 09:36:55 -07:00
clean 4314 2018-07-06 22:50:30 -07:00
edit 4323 2018-07-07 13:54:16 -07:00
ex1 4316 2018-07-06 23:33:42 -07:00
ex1.1.subx 4325 2018-07-07 23:13:25 -07:00
ex1.2.subx 4325 2018-07-07 23:13:25 -07:00
ex2 4327 2018-07-08 22:33:15 -07:00
ex2.subx 4325 2018-07-07 23:13:25 -07:00
ex3 4324 - new example: add first ten numbers 2018-07-07 14:31:56 -07:00
ex3.subx 4325 2018-07-07 23:13:25 -07:00
ex4 4330 - start allocating data/stack/heap segments 2018-07-08 22:57:50 -07:00
ex4.subx 4330 - start allocating data/stack/heap segments 2018-07-08 22:57:50 -07:00
g 4321 2018-07-07 10:57:56 -07:00
gen 4321 2018-07-07 10:57:56 -07:00
gg 4321 2018-07-07 10:57:56 -07:00
nrun 4321 2018-07-07 10:57:56 -07:00
opcodes 3968 2017-07-11 21:41:15 -07:00
run 4323 2018-07-07 13:54:16 -07:00
subx 4211 2018-02-20 01:38:15 -08:00
subx.vim 4299 2018-06-30 23:05:10 -07:00
test_layers 4024 - attempt to get CI working for SubX 2017-10-11 03:22:13 -07:00
vimrc.vim 4020 2017-10-11 02:32:38 -07:00

Readme.md

The SubX VM

Bytecode interpreter for a subset of the 32-bit x86 ISA.

  • Only instructions that operate on the 32-bit E*X registers. (No floating-point yet.)
  • Only instructions that assume a flat address space; no instructions that use segment registers.
  • No instructions that check the carry or parity flags; arithmetic operations always operate on signed integers (while bitwise operations always operate on unsigned integers)
  • Only relative jump instructions (with 8-bit or 16-bit offsets).

These rules yield a clean instruction set. We don't care about running arbitrary binaries, just those generated by our forthcoming Mu compiler.

Targeting a VM enables more comprehensive tests for the compiler, without requiring access to processor/memory state without getting bogged down in details of the ELF format, ABI, STABS debugging format, etc., etc.

Having the VM implement a real (and ubiquitous) instruction set makes it easy to generate native binaries outside of tests.

Just unit tests so far:

./subx test

x86 instruction set resources used in building this: