Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [Asm x86]Cpuid: problema con edx

    codice:
     
    ; Source name : 
    ; Executable name : CPUID.COM
    ; Code model: : Real mode flat model
    ; Version : 1.0
    ; Created date : 7/9/2004
    ; Last update : 7/9/2004
    ; Author : Luca Francesca
    ; Description : A utility to display information about CPU 
    ; Compiling on : NASM
    
    [BITS 16] ; 16bit output
    [ORG 0100h] ; for .com
    
    [SECTION .text]
    start:
    	mov dx, Title
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, NewLine
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, Name
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov eax, 80000002h
    	cpuid
    	mov [ProcessorStr],    eax
    	mov [ProcessorStr+4],  ebx
    	mov [ProcessorStr+8],  ecx
    	mov [ProcessorStr+12], edx
    	
    	mov eax, 80000003h
    	cpuid
    	mov [ProcessorStr+16], eax
    	mov [ProcessorStr+20], ebx
    	mov [ProcessorStr+24], ecx
    	mov [ProcessorStr+28], edx
    	
    	mov eax, 80000004h ; required from Intel, optional in AMD
    	cpuid
    	mov [ProcessorStr+32], eax
    	mov [ProcessorStr+36], ebx
    	mov [ProcessorStr+40], ecx
    	mov [ProcessorStr+44], edx
    	
    	mov byte [ProcessorStr+48], 13 ; CR
    	mov byte [ProcessorStr+49], 10 ; LF
    	mov byte [ProcessorStr+50], '$' ; String termining
    	
    	mov dx, ProcessorStr
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    		
    	mov eax, 1h
    	cpuid
    	
    	mov dx, Fam 
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	;bits 11-8 (reg_eax & 0xf00) >> 8;
    	mov dx, NewLine
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, Mod 
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	;bits 7-4 f0 (reg_eax & 0xf0) >> 4;
    	mov dx, NewLine
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, NewLine
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, Vendor
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string) 
    	int 21h
    	
    	mov eax, 0h
    	cpuid
    	
    	mov [VendorStr], ebx
    	mov [VendorStr+4], edx
    	mov [VendorStr+8], ecx
    	mov byte [VendorStr+12], 13 ; CR
    	mov byte [VendorStr+13], 10 ; LF
    	mov byte [VendorStr+14], '$' ; String termining
    	mov dx, VendorStr
    	mov ah, 09h
    	int 21h
    	
    	mov dx, NewLine
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	mov dx, Ext
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	
    	; extension info
    	mov eax, 1h
    	cpuid
    	
    	test edx, 00800000h ; MMX bit(23)
    	jnz MMX
    
    	test edx, 002000000h ; SSE bit(25)
    	jnz SSE
    	
    	test edx, 004000000h ; SSE2 bit(26)
    	jnz SSE_TWO
    				
    	test ecx, 000000001h ; SSE3 bit(0)
    	jnz SSE_THREE
    
    	test edx, 0040000000h ; 3DNow! bit(30)
    	jnz AMD_NOW
    
    	test edx, 0080000000; 3DNow! Extensions bit(31)
    	jnz AMD_NOW_EXT
    	
    	; exit to the program
    	jmp exit
    
    MMX:
    	push edx
    	mov dx, MMXMsg 
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    SSE:
    	push edx
    	mov dx, SSEMsg  
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    SSE_TWO:
    	push edx
    	mov dx, SSE_TWOMsg 
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    SSE_THREE:
    	push edx
    	mov dx, SSE_THREEMsg 
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    AMD_NOW:
    	push edx
    	mov dx, AMD_NOWMsg
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    AMD_NOW_EXT:
    	push edx
    	mov dx, AMD_NOW_EXTMsg
    	mov ah, 09h ; set int 21h service 09h(print '$'-terminated string)
    	int 21h
    	pop	edx
    	ret
    	
    exit:
    	mov ah, 4Ch ; set int 21h service 4Ch(exit)
    	int 21h
    
    [SECTION .data]
    
    NewLine db 13, 10, '$'
    Title db "§§§§§ Lucas CPUID program §§§§§", 13, 10, '$'
    Name db "=> Cpu Name: ", '$'
    Vendor db "=> Cpu Vendor: ", '$'
    Ext db "=> Cpu supported extension:", 13, 10, '$'
    
    Fam db "==> Cpu Family: ", '$'
    Mod db "===> Cpu Model: ", '$'
    
    ; Intel specific instruction
    MMXMsg db "*This CPU support the 'MMX' instructions", 13, 10, '$'
    SSEMsg db "*This CPU support the 'SSE' instructions", 13, 10, '$'
    SSE_TWOMsg db "*This CPU support the 'SSE2' instructions", 13, 10, '$'
    SSE_THREEMsg db "*This CPU support the 'SSE3' instructions", 13, 10, '$'
    
    ; AMD specific instructions
    AMD_NOWMsg db "*This CPU support the '3DNow!' instructions", 13, 10, '$'
    AMD_NOW_EXTMsg db "*This CPU support the '3DNow!+ Extensions' instructions", 13, 10, '$'
    
    [SECTION .bss]
    VendorStr resb 14    ; Reserve 12 bytes for cpu's vendor string
    ProcessorStr resb 50 ; Reserve 47 +3(\n) bytes for cpu's vendor string
    Family resb 7  ; 4 + 3(\n)
    Model resb 7   ; 4 + 3(\n)
    Ma il risultato è:
    §§§§§ Lucas CPUID program §§§§§

    => Cpu Name: AMD Athlon(tm) XP 2600+
    ==> Cpu Family:
    ===> Cpu Model:

    => Cpu Vendor: AuthenticAMD

    => Cpu supported extension:
    *This CPU support the 'MMX' instructions
    E il supporto SSE, 3dNow! e 3dNow!+ perche nn me li trova?
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

  2. #2
    il codice così è un pò pesante da leggere, puoi dare maggiori informazioni?
    www.vape04.too.it - informatica, elettronica e tante altre cose.
    @LFEO§OFT GREEnOS

  3. #3
    La stupidità umana e l'universo sono infinite.
    Della seconda non sono certo(Einstein)

    Gnu/Linux User

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.