Ver Mensaje Individual
  #1  
Antiguo 19-04-2018
Mav Mav is offline
Miembro
 
Registrado: jun 2007
Posts: 39
Reputación: 0
Mav Va por buen camino
Ayuda con lenguaje- ¿Que corres, 32 ó 64 bits?

Hola, tengo este código funcionando perfectamente:
Código Delphi [-]
program ProjectQuewin;

uses
 WinApi.Windows;
// {$R *.RES}
    var
    caption:PChar =  'Arquitectura';
    ptext:  PChar =  'Estas en 32 bits';
    ptext2: PChar =  'Estas en 64 bits';

begin
  asm
   // pushad
    xor eax, eax
    mov ax, es
    ror ax, 3
    and eax, 1
    test eax, eax
     je  @treintaydos
    push MB_OK or MB_ICONINFORMATION
    push caption
    push ptext2
    push 0
    call MessageBox
     jmp @exit

  @treintaydos:
     push MB_OK or MB_ICONINFORMATION
     push caption
     push ptext
     push 0
     call MessageBox
  @exit:
      push 0
      call ExitProcess
     //popad

    end;

end.
...pero intento meter menos ensamblador y mas pascal,
no veo como utilizar el resultado del "test eax,eax", osea, el estado del Zero Flag, directamente en pascal
se ahorraria code, declaraciones y la salida del programa etc lo manejaria el compilador
...algo así :
Código Delphi [-]
program quewind;
uses
WinApi.Windows;
  
 
//{$R *.res}
??????????
begin
asm

    xor eax, eax
    mov ax, es
    ror ax, 3
    and eax, 1
    test eax, eax
    ????????? 
end;
if Zero flag es cero   then

MessageBox(0,'You are running 64 bit','Architecture',MB_OK or MB_ICONINFORMATION);

...y si es uno
 MessageBox(0,'You are running 32 bit','Architecture',MB_OK or MB_ICONINFORMATION);
end.

Saludos
Responder Con Cita