Add value directives and strings

.string, .zstring, .u64, .u32, .u16, .u8 are used before an ImmValue to
determine how the memory should be laid out for that value.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-11 17:49:17 -05:00
parent 95d4eb0a60
commit cf9ba376aa
8 changed files with 158 additions and 24 deletions

View File

@@ -50,10 +50,10 @@ instructions! {
pub fn inst_len(op: InstOp) -> usize {
match op {
// 2 bytes
INEG | INV | NOT | HALT | NOP => 2,
HALT | NOP => 2,
// 4 bytes
ADD | MUL | DIV | MOD | AND | OR | XOR | SHL | SHR | CMPEQ | CMPLT | JMP | JZ | JNZ
| LOAD | REGCOPY | MEMCOPY | STORE => 4,
ADD | MUL | DIV | INEG | INV | NOT | MOD | AND | OR | XOR | SHL | SHR | CMPEQ | CMPLT
| JMP | JZ | JNZ | LOAD | REGCOPY | MEMCOPY | STORE => 4,
// Immediates - 4+ bytes
STOREIMM64 => 16,
STOREIMM32 => 8,