CHAPTER 21. STRUCTURES CHAPTER 21. STRUCTURES
mov eax, esi
and eax, 15
push eax
push OFFSET $SG15435 ; 'stepping=%d', 0aH, 00H
call _printfmov ecx, esi
shr ecx, 4
and ecx, 15
push ecx
push OFFSET $SG15436 ; 'model=%d', 0aH, 00H
call _printfmov edx, esi
shr edx, 8
and edx, 15
push edx
push OFFSET $SG15437 ; 'family_id=%d', 0aH, 00H
call _printfmov eax, esi
shr eax, 12
and eax, 3
push eax
push OFFSET $SG15438 ; 'processor_type=%d', 0aH, 00H
call _printfmov ecx, esi
shr ecx, 16
and ecx, 15
push ecx
push OFFSET $SG15439 ; 'extended_model_id=%d', 0aH, 00H
call _printfshr esi, 20
and esi, 255
push esi
push OFFSET $SG15440 ; 'extended_family_id=%d', 0aH, 00H
call _printf
add esp, 48
pop esixor eax, eax
pop ebxadd esp, 16
ret 0
_main ENDP
TheSHRinstruction shifting the value inEAXby the number of bits that must beskipped, e.g., we ignore some bitsat the
right side.
TheANDinstruction clears the unneeded bitson the left, or, in other words, leaves only those bits in theEAXregister we
need.