mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
cr1
This commit is contained in:
parent
ee4f983103
commit
a48473df92
@ -5,7 +5,10 @@
|
||||
; Main function
|
||||
;
|
||||
main:
|
||||
call movzx_test
|
||||
jmp bswap_test
|
||||
|
||||
bswap_test:
|
||||
mov rdx, 0xFFEEDDCCBBAA99884433
|
||||
ret
|
||||
|
||||
ramdev_test:
|
||||
|
26
vm/in/INSTRS
26
vm/in/INSTRS
@ -138,6 +138,18 @@ decf rm
|
||||
add rm rim
|
||||
addf rm rim
|
||||
|
||||
#
|
||||
# Arithmetical ADD operation, with carry
|
||||
#
|
||||
# $1 = $1 + $2 + CF
|
||||
#
|
||||
# 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
|
||||
#
|
||||
adc rm rim
|
||||
adcf rm rim
|
||||
|
||||
#
|
||||
# Arithmetical SUB operation
|
||||
#
|
||||
@ -507,6 +519,20 @@ cmc
|
||||
clc
|
||||
stc
|
||||
|
||||
#---------------------------------------------------------------------------#
|
||||
# Byte-wise / bit-wise manipulation instructions #
|
||||
#---------------------------------------------------------------------------#
|
||||
|
||||
#
|
||||
# Byte/word/dword swap (xSWAP)
|
||||
#
|
||||
# Changes endianness
|
||||
#
|
||||
bswap rm rim
|
||||
wswap rm rim
|
||||
dswap rm rim
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------#
|
||||
# Misc. instructions #
|
||||
#---------------------------------------------------------------------------#
|
||||
|
@ -93,6 +93,30 @@ IMPL_START_2(addf)
|
||||
}
|
||||
IMPL_OUT_ZSF;
|
||||
|
||||
IMPL_START_2(adc)
|
||||
{
|
||||
v1 += v2 + !!(flg&CF);
|
||||
}
|
||||
IMPL_OUT;
|
||||
|
||||
IMPL_START_2(adcf)
|
||||
{
|
||||
if (v1 + v2 + !!(flg&CF) < v1) flg |= OF;
|
||||
else flg &= ~OF;
|
||||
|
||||
v1 += !!(flg&CF);
|
||||
|
||||
if ( ((v2 > 0) && (v1 > LONG_MAX - v2))
|
||||
|| ((v2 < 0) && (v1 < LONG_MIN - v2)) )
|
||||
flg |= CF;
|
||||
else flg &= ~CF;
|
||||
|
||||
v1 += v2;
|
||||
}
|
||||
IMPL_OUT_ZSF;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
IMPL_START_2(sub)
|
||||
{
|
||||
v1 -= v2;
|
||||
|
27
vm/in/misc.c
Normal file
27
vm/in/misc.c
Normal file
@ -0,0 +1,27 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include <in/instrs.h>
|
||||
|
||||
IMPL_START_2(bswap)
|
||||
{
|
||||
v1 = ((v2 & 0xFF00000000000000) >> 56)
|
||||
| ((v2 & 0x00FF000000000000) >> 40)
|
||||
| ((v2 & 0x0000FF0000000000) >> 24)
|
||||
| ((v2 & 0x000000FF00000000) >> 8)
|
||||
| ((v2 & 0x00000000FF000000) << 8)
|
||||
| ((v2 & 0x0000000000FF0000) << 24)
|
||||
| ((v2 & 0x000000000000FF00) << 40)
|
||||
| ((v2 & 0x00000000000000FF) << 56);
|
||||
}
|
||||
IMPL_OUT;
|
||||
|
||||
IMPL_START_2(wswap)
|
||||
{
|
||||
}
|
||||
IMPL_OUT;
|
||||
|
||||
IMPL_START_2(dswap)
|
||||
{
|
||||
}
|
||||
IMPL_OUT;
|
Loading…
Reference in New Issue
Block a user