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>
This commit is contained in:
43
test.asm
43
test.asm
@@ -1,28 +1,35 @@
|
||||
.section data
|
||||
data $0x1000 .. $0x2000 {
|
||||
}
|
||||
|
||||
.section code
|
||||
code $0x0 {
|
||||
main:
|
||||
storeimm %r00, $0xDEAD
|
||||
storeimm %r01, $16
|
||||
|
||||
main:
|
||||
storeimm %r00, $0xDEAD
|
||||
storeimm %r01, $16
|
||||
shl %r00, %r01
|
||||
|
||||
shl %r00, %r01
|
||||
storeimm %r01, $0xBEEF
|
||||
or %r00, %r01
|
||||
|
||||
storeimm %r01, $0xBEEF
|
||||
or %r00, %r01
|
||||
storeimm %r01, $0xDEADBEEF
|
||||
|
||||
storeimm %r01, $0xDEADBEEF
|
||||
storeimm %r00, failure
|
||||
storeimm %r01, ok
|
||||
cmpeq %r00, %r01
|
||||
|
||||
storeimm %r00, failure
|
||||
storeimm %r01, ok
|
||||
cmpeq %r00, %r01
|
||||
jz %r00
|
||||
|
||||
jz %r00
|
||||
jmp %r01
|
||||
|
||||
jmp %r01
|
||||
failure:
|
||||
storeimm %status, $1
|
||||
halt
|
||||
|
||||
failure:
|
||||
storeimm %status, $1
|
||||
halt
|
||||
ok:
|
||||
|
||||
ok:
|
||||
.export main
|
||||
}
|
||||
|
||||
meta {
|
||||
entry: main
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user