NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: S Mahen on June 09, 2014, 11:45:49 AM
-
Hi,
First of all thanks to forum for supporting me to develop ALP using nasm.
Last year when I joined the forum I was new to ALP using nasm.
Now I am comfortable with ALP.
I want to develop few more ALPs and one of them is displaying CPU & FPU type.
Please help me to start writing program.
Thanks in advance...
-
I like to start with "global _start". :)
; nasm -f elf32 cpuname.asm
; ld -o cpuname cpuname.o -m elf_i386
global _start
section .bss
namestring resb 49
section .text
_start:
mov eax, 80000000h
cpuid
cmp eax, 80000004h
jb exit
mov edi, namestring
mov eax, 80000002h
cpuid
call savestring
mov eax, 80000003h
cpuid
call savestring
mov eax, 80000004h
cpuid
call savestring
mov al, 10
stosb
mov ecx, namestring
mov edx, 49
mov ebx, 1
mov eax, 4
int 80h
exit:
mov eax, 1
int 80h
;----------------
;----------------
savestring:
stosd
mov eax, ebx
stosd
mov eax, ecx
stosd
mov eax, edx
stosd
ret
;----------------
You can do quite a lot more with cpuid, of course.
Best,
Frank
-
Thanks Frank.
It is showing CPU Type.
What about FPU?
-
I don't know. Might be a bit in one of the cpuid functions that will tell you whether you've got one (you do). I don't know how to check capabilities. osdev.org might have info on it.
Best,
Frank
Edit: Here ya go:
http://wiki.osdev.org/FPU#Detecting_an_FPU
-
Surely I will try and let you know.
Thanks.