aboutsummaryrefslogtreecommitdiff
path: root/examples/instruction-test.asm
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-29 16:55:26 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-29 16:56:19 +0000
commit7c367f95c9a46983ed1b97e9ea892f233d592cdf (patch)
treec6747d0530aa4e4c22705b7ecba9bf12d815a539 /examples/instruction-test.asm
parent025b26b87776085f6d06654d060f19721e238e36 (diff)
downloadovm-7c367f95c9a46983ed1b97e9ea892f233d592cdf.tar.gz
ovm-7c367f95c9a46983ed1b97e9ea892f233d592cdf.tar.bz2
ovm-7c367f95c9a46983ed1b97e9ea892f233d592cdf.zip
Added some examples to instruction-test for positive/negative literals
Use the push.* instructions to see this.
Diffstat (limited to 'examples/instruction-test.asm')
-rw-r--r--examples/instruction-test.asm21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/instruction-test.asm b/examples/instruction-test.asm
index dcc0cc2..6a8f172 100644
--- a/examples/instruction-test.asm
+++ b/examples/instruction-test.asm
@@ -48,3 +48,24 @@
jump.if.byte 1
jump.if.hword 2
jump.if.word 3
+
+ ;; Testing if overflows work correctly
+ ;; Format is:
+ ;; -1 All bits are turned on
+ ;; UINT_MAX All bits are turned on
+ ;; INT_MAX All bits but the most significant are on
+ ;; INT_MIN Only the most significant bit is on
+ push.byte -1
+ push.byte 255
+ push.byte 127
+ push.byte -128
+
+ push.hword -1
+ push.hword 4294967295
+ push.hword 2147483647
+ push.hword -2147483648
+
+ push.word -1
+ push.word 18446744073709551615
+ push.word 9223372036854775807
+ push.word -9223372036854775808