# 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 # # Preserves all flags # or 2 or 3 # # Bitwise AND operation # # $dest = $src1 AND $src2 # # Preserves all flags # and 2 and 3 # # Bitwise XOR operation # # $dest = $src1 XOR $src2 # # Preserves all flags # xor 2 xor 3 # # Logical left/right shift (SHL/SHR) # # $dest = $src1 << $src2 (SHL) # $dest = $src1 >> $src2 (SHR) # # Preserves all flags # shl 2 shl 3 shr 2 shr 3 # # Arithmetical right shift (SAR) # # $dest = $src1 >>> $src2 (SAR) # # Preserves all flags # sar 2 sar 3 #---------------------------------------------------------------------------# # Arithmetic instructions # #---------------------------------------------------------------------------# # # CMP Comparison instruction # # SignExtend($1) - $2 # # 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 # cmp 2 # # Arithmetical ADD operation # # $dest1 = $src1 + $src2 # # 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 # add 2 add 3 addf 3 # # Arithmetical SUB operation # # $dest = $src1 - $src2 # # 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 # sub 2 sub 3 subf 3 # # Arithmetical ADD/SUB operation, with carry/overflow # # $dest = $src1 + $src2 + CF (ADC) # $dest = $src1 - $src2 - CF (SBB) # # 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 # adcx 2 adcx 3 sbbx 2 sbbx 3 # # Arithmetical MUL operation # # $dest = LO($src1 * $src2) # # Preserves ZF and SF # Sets CF and OF if HI($src1 * $src2) > 0, clears them otherwise # mul 2 mul 3 mulf 3 # Arithmetical unsigned MUL operation # # $dest1 = HI($dest2 * $src) # $dest2 = LO($dest2 * $src) # # Preserves all flags # mulhi 3 # Arithmetical signed MUL operation # # $dest1 = HI($dest2 ** $src) # $dest2 = LO($dest2 ** $src) # # Preserves all flags # 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 # # Preserves all flags # idiv 2 idiv 3 # # Arithmetical modulo operation (REM) # # $dest = $src1 MOD $src2 # # Preserves all flags # rem 2 rem 3