Verifying the support of the instruction movbe

Started by Vortex, Yesterday at 08:45:29 PM

Previous topic - Next topic

Vortex

Hello,

To check if your processor supports the instruction movbe :

include     movbeCheck.inc

.data

m1          db 'The processor does not support the instruction movbe.',0
m2          db 'The processor supports the instruction movbe.',0
StrTable    dd OFFSET m1,OFFSET m2

.code

start:

    call    main
    invoke  ExitProcess,0

main PROC

    xor     eax,eax
    push    eax
   
    mov     eax,1
    cpuid

    bt      ecx,22
    pop     eax
    adc     eax,0

    mov     edx,OFFSET StrTable
    lea     ecx,[edx+4*eax]

    invoke  printf,DWORD PTR [ecx]
    ret   

main ENDP

END start
Code it... That's all...

Vortex

Here is the 64-bit version :

include     movbeCheck.inc

.data

m1          db 'The processor does not support the instruction movbe.',0
m2          db 'The processor supports the instruction movbe.',0
StrTable    dq OFFSET m1,OFFSET m2

.code

start:

    sub     rsp,8+4*8
    call    main
    invoke  ExitProcess,0

main PROC PARMAREA=4*SIZEOF QWORD

LOCAL _rax:QWORD

    xor     rax,rax
    mov     _rax,rax
   
    mov     rax,1
    cpuid

    bt      rcx,22
    mov     rax,_rax
    adc     rax,0

    mov     rdx,OFFSET StrTable
    lea     rcx,[rdx+8*rax]

    invoke  printf,QWORD PTR [rcx]
    ret   

main ENDP

END start
Code it... That's all...