Add address deref, syntax, and deref sizes

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-25 12:07:24 -05:00
parent bdd08c6c5b
commit 5619c9dc87
11 changed files with 308 additions and 99 deletions

View File

@@ -1,31 +1,32 @@
code $0x0 {
.section data $0x1000 {
beef: .u16 $0xBEEF
; TODO(syntax)
; bytes: .u8 [
; $0xEF,
; $0xBE,
; $0xAD,
; $0xDE,
; ]
.export beef
}
.section code $0x0 {
main:
storeimm32 %r00, $0xDEAD
storeimm64 %r01, $16
shl %r00, %r01
storeimm32 %r01, $0xBEEF
or %r00, %r01
storeimm64 %r01, $0xDEADBEEF
cmpeq %r00, %r01
storeimm32 %r00, failure
storeimm64 %r01, ok
jz %r00
jmp %r01
failure:
storeimm32 %status, $1
ok: halt
mov %r0, $0xDEAD
shl %r0, $16
; move 32 bits at 'beef' to %r01
; TODO(syntax)
mov %r1, (beef)u32
or %r0, %r01
cmpeq %r0, $0xDEADBEEF
; jump to the address 'end'
jz end
mov %status, $1
end:
halt
.export main
}
meta {
.meta {
entry: main
}