1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/in/ALU
julianb0 cbd079d2a0
vm
2019-08-14 20:23:05 +02:00

88 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
# 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
# Negation but traps on $src == -2^N
negv 1
# 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