Search code examples
assemblyfasm

How to set MP and TS flags of register CR0? x86 Fasm


How to set MP and TS flags of register CR0?

I only know how To set PE flag:

mov eax, cr0
or eax, 1
mov cr0, eax

Solution

  • Have a look at this Wikipedia article about Control Registers and set the bits accordingly. In your case, starting from 0, the MP bit is at position 1 and the TS bit at position 3.

    So you can use the following code to set the MP and TS flags in CR0:

    mov eax, cr0
    or  eax, 10      ; 2^1(MP) + 2^3(TS) = 2 + 8 = 10 decimal
    mov cr0, eax