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
2019-08-14 09:52:39 +02:00

118 lines
1.8 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 OR operation
#
# $dest = $src1 OR $src2
#
or 2
or 3
#
# Bitwise AND operation
#
# $dest = $src1 AND $src2
#
and 2
and 3
#
# Bitwise XOR operation
#
# $dest = $src1 XOR $src2
#
xor 2
xor 3
#
# Logical left/right shift (SHL/SHR)
#
# $dest = $src1 << $src2 (SHL)
# $dest = $src1 >> $src2 (SHR)
#
shl 2
shl 3
shr 2
shr 3
#
# Arithmetical right shift (SAR)
#
# $dest = $src1 >>> $src2 (SAR)
#
sar 2
sar 3
#---------------------------------------------------------------------------#
# Arithmetic instructions #
#---------------------------------------------------------------------------#
#
# Arithmetical ADD operation
#
# $dest1 = $src1 + $src2
#
add 2
add 3
#
# Arithmetical SUB operation
#
# $dest = $src1 - $src2
#
sub 2
sub 3
#
# Arithmetical MUL operation
#
# $dest = LO($src1 * $src2)
#
mul 2
mul 3
# Arithmetical unsigned MUL operation
#
# $dest1 = HI($dest2 * $src)
# $dest2 = LO($dest2 * $src)
#
mulhi 3
# Arithmetical signed MUL operation
#
# $dest1 = HI($dest2 ** $src)
# $dest2 = LO($dest2 ** $src)
#
imulhi 3
#
# Arithmetical unsigned DIV operation
#
# $dest = $src1 DIV $src2
#
# Preserves all flags
#
div 2
div 3
#
# Arithmetical signed DIV operation
#
# $dest = $src1 IDIV $src2
#
idiv 2
idiv 3
#
# Arithmetical modulo operation (REM)
#
# $dest = $src1 MOD $src2
#
rem 2
rem 3