Move examples to libvm source base and add symlink to root directory

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-03-06 12:18:20 -05:00
parent b1f2de198e
commit 58262eab40
4 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
.section data $0x1000 {
dead: .u16 $0xDEAD
beef: .u16 $0xBEEF
.export dead
.export beef
}
.section code $0x0 {
main:
mov %ivt, ivt
or %flags, $0b100
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'
jnz end
mov %status, $1
end:
div %r0, $0
halt
.export main
}
.section iv $0x2800 {
dz:
mov %status, $255
halt
.export dz
}
.section ivt $0x2000 .. $0x2800 {
ivt:
.interrupt $1, dz ; Divide by zero
.export ivt
}
.meta {
entry: main
}