; cpuid1.nas ; nasmw -fobj cpuid1.nas ; Mc.N (kfb02545@nifty.ne.jp) ;; nasm 内の C32.MAC から抜粋 %imacro proc 1 ; begin a procedure definition %push proc global %1 %1: push ebp mov ebp,esp %assign %$arg 8 %define %$procname %1 %endmacro %imacro arg 0-1 4 ; used with the argument name as a label equ %$arg %assign %$arg %1+%$arg %endmacro %imacro endproc 0 %ifnctx proc %error Mismatched `endproc'/`proc' %else leave ret __end_%$procname: ; useful for calculating function size %pop %endif %endmacro ;; 抜粋終わり segment .code USE32 proc _IsCPUID push ecx pushfd pop eax mov ecx, eax xor eax, 0x200000 ; ID ビット push eax popfd pushfd pop eax and eax, 0x200000 ; ID ビットがトルクしない ; ---> can't support CPUID and ecx, 0x200000 ; ID ビットがトルクする ; ---> support CPUID xor eax, ecx mov eax, 1 jnz jSupCPUID mov eax, 0 jSupCPUID: pop ecx endproc segment .data USE32