kvisc/vm/in/ALU

91 lines
1.3 KiB
Plaintext
Raw Normal View History

2019-06-23 12:40:18 +02:00
# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
2019-07-17 20:26:03 +02:00
#---------------------------------------------------------------------------#
# Logical instructions #
#---------------------------------------------------------------------------#
2019-08-14 20:23:05 +02:00
# Bitwise NOT
not 1
2019-08-16 13:29:38 +02:00
not 2
2019-08-14 20:23:05 +02:00
# Bitwise OR
2019-08-08 18:39:12 +02:00
or 2
2019-08-03 17:41:44 +02:00
or 3
2019-07-17 20:26:03 +02:00
2019-08-14 20:23:05 +02:00
# Bitwise AND
2019-08-08 18:39:12 +02:00
and 2
2019-08-03 17:41:44 +02:00
and 3
2019-07-17 20:26:03 +02:00
2019-08-14 20:23:05 +02:00
# Bitwise XOR
2019-08-08 18:39:12 +02:00
xor 2
2019-08-03 17:41:44 +02:00
xor 3
2019-07-17 20:26:03 +02:00
2019-08-14 20:23:05 +02:00
# Logical left/right shift
2019-08-08 18:39:12 +02:00
shl 2
2019-08-03 17:41:44 +02:00
shl 3
2019-08-08 18:39:12 +02:00
shr 2
2019-08-03 17:41:44 +02:00
shr 3
2019-07-17 20:26:03 +02:00
2019-08-14 20:23:05 +02:00
# Arithmetical right shift
2019-08-08 18:39:12 +02:00
sar 2
2019-08-03 17:41:44 +02:00
sar 3
2019-07-17 20:26:03 +02:00
2019-06-23 12:40:18 +02:00
#---------------------------------------------------------------------------#
# Arithmetic instructions #
#---------------------------------------------------------------------------#
2019-08-14 20:23:05 +02:00
# Negation
neg 1
2019-08-16 13:29:38 +02:00
neg 2
2019-08-14 20:23:05 +02:00
# Negation but traps on $src == -2^N
negv 1
2019-08-16 13:29:38 +02:00
negv 2
2019-08-14 20:23:05 +02:00
# Addition
2019-08-08 18:39:12 +02:00
add 2
2019-08-03 17:41:44 +02:00
add 3
2019-06-23 12:40:18 +02:00
2019-08-14 20:23:05 +02:00
# Addition but traps on overflow
addv 2
addv 3
# Substraction
2019-08-08 18:39:12 +02:00
sub 2
2019-08-03 17:41:44 +02:00
sub 3
2019-06-23 12:40:18 +02:00
2019-08-14 20:23:05 +02:00
# Substraction but traps on underflow
subv 2
subv 3
# Multiplication
# $dest = LO($src1 * $src2)
2019-08-08 18:39:12 +02:00
mul 2
2019-08-03 17:41:44 +02:00
mul 3
2019-06-23 12:40:18 +02:00
2019-08-14 20:23:05 +02:00
# Multiplication (unsigned)
# $dest1 = HI($dest2 * $src)
# $dest2 = LO($dest2 * $src)
2019-06-23 12:40:18 +02:00
#
2019-08-03 17:41:44 +02:00
mulhi 3
2019-06-23 12:40:18 +02:00
2019-08-14 20:23:05 +02:00
# Multiplication (signed)
# $dest1 = HI($dest2 * $src)
# $dest2 = LO($dest2 * $src)
2019-07-18 22:49:31 +02:00
#
2019-08-03 17:41:44 +02:00
imulhi 3
2019-07-18 22:49:31 +02:00
2019-08-14 20:23:05 +02:00
# Division (unsigned)
2019-08-08 18:39:12 +02:00
div 2
2019-08-03 17:41:44 +02:00
div 3
2019-06-23 12:40:18 +02:00
2019-08-14 20:23:05 +02:00
# Division (signed)
2019-08-08 18:39:12 +02:00
idiv 2
2019-08-03 17:41:44 +02:00
idiv 3
2019-07-18 22:49:31 +02:00
2019-08-14 20:23:05 +02:00
# Modulo/remainder
2019-08-08 18:39:12 +02:00
rem 2
2019-08-03 17:41:44 +02:00
rem 3
2019-06-23 12:40:18 +02:00