ALP to identify the Central Processing Unit (CPU) type (32-bit)
kw.asm
section.datatitledb"———————————————————————————————————————————"db10,"ALPtoidentifytheCentralProcessingUnittype"
db 10, "———————————————————————————————————————————"title_len equ$-titleoutputdb10,10,"The CPU type is "output_len equ$-outputenddb"———————————————————————————————————————————",10end_len equ$-endsection.bssvar1resd1var2resd1var3resd1var4resb49%macro display 4
moveax,%1movebx,%2movecx,%3movedx,%4int80h%endm
section.textglobal_start_start:CPUIDmov[var1],ebxmov[var2],edxmov[var3],ecxdisplay4,1,title,title_lendisplay4,1,output,output_lendisplay4,1,var1,4display4,1,var2,4display4,1,var3,4movedi,var4moveax,80000002hcpuidcallCPU_PROCmoveax,80000003hcpuidcallCPU_PROCmoveax,80000004hcpuidcallCPU_PROCmoval,10stosbdisplay4,1,var4,49display4,1,end,end_lenmoveax,1movebx,0int80hCPU_PROC:stosdmoveax,ebxstosdmoveax,ecxstosdmoveax,edxstosdret
Output
kodingwindow@kw:~$ nasm -felf64 kw.asm kodingwindow@kw:~$ ld kw.o && ./a.out
———————————————————————————————————————————
ALP to identify the Central Processing Unit type
———————————————————————————————————————————
The CPU type is GenuineIntel
Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.