kvisc/vm/in/ALU

91 lines
1.3 KiB
Plaintext

# The OS/K Team licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
#---------------------------------------------------------------------------#
# Logical instructions #
#---------------------------------------------------------------------------#
# Bitwise NOT
not 1
not 2
# Bitwise OR
or 2
or 3
# Bitwise AND
and 2
and 3
# Bitwise XOR
xor 2
xor 3
# Logical left/right shift
shl 2
shl 3
shr 2
shr 3
# Arithmetical right shift
sar 2
sar 3
#---------------------------------------------------------------------------#
# Arithmetic instructions #
#---------------------------------------------------------------------------#
# Negation
neg 1
neg 2
# Negation but traps on $src == -2^N
negv 1
negv 2
# Addition
add 2
add 3
# Addition but traps on overflow
addv 2
addv 3
# Substraction
sub 2
sub 3
# Substraction but traps on underflow
subv 2
subv 3
# Multiplication
# $dest = LO($src1 * $src2)
mul 2
mul 3
# Multiplication (unsigned)
# $dest1 = HI($dest2 * $src)
# $dest2 = LO($dest2 * $src)
#
mulhi 3
# Multiplication (signed)
# $dest1 = HI($dest2 * $src)
# $dest2 = LO($dest2 * $src)
#
imulhi 3
# Division (unsigned)
div 2
div 3
# Division (signed)
idiv 2
idiv 3
# Modulo/remainder
rem 2
rem 3