Home > other >  Looking for a relatively simple in the Windows 7 a compiler environment, to execute the following co
Looking for a relatively simple in the Windows 7 a compiler environment, to execute the following co

Time:01-13

As if can't identify rdrand dosbox, the Intel CPU to generate a random number of instructions, and visual c + + is too big, have difficulty downloading

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
; Generate a 16 bit random number
; Return TRUE if Rand generated successfully, or FALSE if not
;
; BOOLEAN EFIAPI RdRand16Step (UINT16 * Rand); RCX
; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
RdRand16Step PROC
; Rdrand ax; Generate a 16 bit RN into ax, CF=1 if an RN generated ok, otherwise the CF=0
Db fh 0, 0 c7h, 0 f0h; Rdrand r16: "0 f the c7/6 ModRM: r/m (w)"
Jb rn16_ok; JMP if CF=1
Xor rax rax; Reg=0 if the CF=0
Ret. Return with a failure status
Rn16_ok:
Mov [RCX], ax
Mov rax, 1
Ret
RdRand16Step ENDP

CodePudding user response:

Do you link to compile this code or run this program, is dos16 class or win64 program? Because you mention dosbox and code appears in rax or RCX have conflict?
If you want you can compile link simple win64 program ml64. Exe and link. Exe, I was just out from the vs2019, needed to a mailbox, but only these, not including may need to include (this or can use with the masm32 practice of) and the lib (also backup down, but the relatively large),

CodePudding user response:

X64 running in 32-bit and 16-bit programs, 64 instructions cannot be used, and this 32-bit processors running in 16-bit mode can use 32-bit instruction is not the same as
Rdrand, xor rax rax in 16-bit programs don't support the

CodePudding user response:

Learn assembly should know, VirtualBox and Bochs is your good friend,
  • Related