aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-28 18:24:59 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-29 16:56:19 +0000
commit025b26b87776085f6d06654d060f19721e238e36 (patch)
treee8dd51168ca3faa375d1457f44ab20bbd2d7bcee
parent1177a5a45b153fd753c48e60bf759046e945d43b (diff)
downloadovm-025b26b87776085f6d06654d060f19721e238e36.tar.gz
ovm-025b26b87776085f6d06654d060f19721e238e36.tar.bz2
ovm-025b26b87776085f6d06654d060f19721e238e36.zip
Introduced an example source file for all instructions
Provides calling conventions, ensures parser and lexer are working correctly. Will be updated as more instructions are introduced and supported in the assembler.
-rw-r--r--examples/instruction-test.asm50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/instruction-test.asm b/examples/instruction-test.asm
new file mode 100644
index 0000000..dcc0cc2
--- /dev/null
+++ b/examples/instruction-test.asm
@@ -0,0 +1,50 @@
+;;; instruction-test.asm: A file that contains all possible opcodes in
+;;; order, with proper calling convention. Used to test lexer and
+;;; parser but isn't a semantically correct program, but may be run as
+;;; first instruction is halt (so program will stop immediately).
+ halt
+ push.byte 1
+ push.hword 2
+ push.word 3
+ pop.byte
+ pop.hword
+ pop.word
+ push-reg.byte 1
+ push-reg.hword 2
+ push-reg.word 3
+ mov.byte 1
+ mov.hword 2
+ mov.word 3
+ dup.byte 1
+ dup.hword 2
+ dup.word 3
+ not.byte
+ not.hword
+ not.word
+ or.byte
+ or.hword
+ or.word
+ and.byte
+ and.hword
+ and.word
+ xor.byte
+ xor.hword
+ xor.word
+ eq.byte
+ eq.hword
+ eq.word
+ plus.byte
+ plus.hword
+ plus.word
+ print.char
+ print.byte
+ print.int
+ print.hword
+ print.long
+ print.word
+ jump.abs 1
+ jump.stack
+ jump.register 2
+ jump.if.byte 1
+ jump.if.hword 2
+ jump.if.word 3