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 #
|
|
|
|
#---------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Bitwise OR operation
|
|
|
|
#
|
|
|
|
# $dest = $src1 OR $src2
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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
|
|
|
|
|
|
|
#
|
|
|
|
# Bitwise AND operation
|
|
|
|
#
|
|
|
|
# $dest = $src1 AND $src2
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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
|
|
|
|
|
|
|
#
|
|
|
|
# Bitwise XOR operation
|
|
|
|
#
|
|
|
|
# $dest = $src1 XOR $src2
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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
|
|
|
|
|
|
|
#
|
|
|
|
# Logical left/right shift (SHL/SHR)
|
|
|
|
#
|
|
|
|
# $dest = $src1 << $src2 (SHL)
|
|
|
|
# $dest = $src1 >> $src2 (SHR)
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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-06 14:42:31 +02:00
|
|
|
# Arithmetical right shift (SAR)
|
2019-07-17 20:26:03 +02:00
|
|
|
#
|
|
|
|
# $dest = $src1 >>> $src2 (SAR)
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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 #
|
|
|
|
#---------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
#
|
|
|
|
# CMP Comparison instruction
|
|
|
|
#
|
2019-07-24 16:52:26 +02:00
|
|
|
# SignExtend($1) - $2
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
|
|
|
# Sets CF if unsigned integer overflow occur, clears it otherwise
|
|
|
|
# Sets OF is signed integer overflow occur, clears it otherwise
|
|
|
|
# Sets ZF and SF according to the result
|
|
|
|
#
|
2019-08-03 17:41:44 +02:00
|
|
|
cmp 2
|
2019-06-23 12:40:18 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Arithmetical ADD operation
|
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# $dest1 = $src1 + $src2
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
|
|
|
# Sets CF if unsigned integer overflow occur, clears it otherwise
|
|
|
|
# Sets OF is signed integer overflow occur, clears it otherwise
|
|
|
|
# Sets ZF and SF according to the result
|
|
|
|
#
|
2019-08-08 18:39:12 +02:00
|
|
|
add 2
|
2019-08-03 17:41:44 +02:00
|
|
|
add 3
|
|
|
|
addf 3
|
2019-06-23 12:40:18 +02:00
|
|
|
|
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# Arithmetical SUB operation
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# $dest = $src1 - $src2
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
|
|
|
# Sets CF if unsigned integer overflow occur, clears it otherwise
|
|
|
|
# Sets OF is signed integer overflow occur, clears it otherwise
|
|
|
|
# Sets ZF and SF according to the result
|
|
|
|
#
|
2019-08-08 18:39:12 +02:00
|
|
|
sub 2
|
2019-08-03 17:41:44 +02:00
|
|
|
sub 3
|
|
|
|
subf 3
|
2019-06-23 12:40:18 +02:00
|
|
|
|
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# Arithmetical ADD/SUB operation, with carry/overflow
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# $dest = $src1 + $src2 + CF (ADC)
|
|
|
|
# $dest = $src1 - $src2 - CF (SBB)
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-18 22:49:31 +02:00
|
|
|
# Sets CF if unsigned integer overflow occur, clears it otherwise
|
|
|
|
# Sets OF is signed integer overflow occur, clears it otherwise
|
|
|
|
# Sets ZF and SF according to the result
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-08-08 18:39:12 +02:00
|
|
|
adcx 2
|
2019-08-03 17:41:44 +02:00
|
|
|
adcx 3
|
2019-08-08 18:39:12 +02:00
|
|
|
sbbx 2
|
2019-08-03 17:41:44 +02:00
|
|
|
sbbx 3
|
2019-06-23 12:40:18 +02:00
|
|
|
|
|
|
|
#
|
2019-07-18 22:49:31 +02:00
|
|
|
# Arithmetical MUL operation
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# $dest = LO($src1 * $src2)
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
|
|
|
# Preserves ZF and SF
|
2019-07-04 20:33:49 +02:00
|
|
|
# Sets CF and OF if HI($src1 * $src2) > 0, clears them otherwise
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-08-08 18:39:12 +02:00
|
|
|
mul 2
|
2019-08-03 17:41:44 +02:00
|
|
|
mul 3
|
|
|
|
mulf 3
|
2019-06-23 12:40:18 +02:00
|
|
|
|
2019-07-04 20:33:49 +02:00
|
|
|
# Arithmetical unsigned MUL operation
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 20:33:49 +02:00
|
|
|
# $dest1 = HI($dest2 * $src)
|
|
|
|
# $dest2 = LO($dest2 * $src)
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-18 22:49:31 +02:00
|
|
|
# Preserves all flags
|
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-07-18 22:49:31 +02:00
|
|
|
# Arithmetical signed MUL operation
|
|
|
|
#
|
|
|
|
# $dest1 = HI($dest2 ** $src)
|
|
|
|
# $dest2 = LO($dest2 ** $src)
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
2019-08-03 17:41:44 +02:00
|
|
|
imulhi 3
|
2019-07-18 22:49:31 +02:00
|
|
|
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 18:41:05 +02:00
|
|
|
# Arithmetical unsigned DIV operation
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-18 22:49:31 +02:00
|
|
|
# $dest = $src1 DIV $src2
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-04 18:41:05 +02:00
|
|
|
# Preserves all flags
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
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-07-18 22:49:31 +02:00
|
|
|
# Arithmetical signed DIV operation
|
|
|
|
#
|
|
|
|
# $dest = $src1 IDIV $src2
|
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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
|
|
|
|
|
|
|
#
|
|
|
|
# Arithmetical modulo operation (REM)
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
2019-07-18 22:49:31 +02:00
|
|
|
# $dest = $src1 MOD $src2
|
2019-06-23 12:40:18 +02:00
|
|
|
#
|
|
|
|
# Preserves all flags
|
|
|
|
#
|
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
|
|
|
|