flat assembler
Message board for the users of flat assembler.
Index
> Main > Extract EFlags and print it ? |
Author |
|
JohnFound 26 Aug 2012, 20:28
Code: stdcall NumToStr, eax, ntsDec + ntsUnsigned push eax stdcall FileWriteString, [STDOUT], eax stdcall StrDel |
|||
26 Aug 2012, 20:28 |
|
Overflowz 26 Aug 2012, 20:48
Huh ? I have never seen such code before. What the NumToStr/FileWriteString/StrDel functions does ?
|
|||
26 Aug 2012, 20:48 |
|
JohnFound 26 Aug 2012, 21:02
They are from FreshLib. You can download it with Fresh IDE (the above link) but you can use it with every version of FASM. The reference manual is included in Fresh IDE package.
Anyway: NumToStr converts number to string. FileWriteString writes the string to the file (STDOUT in the example) and StrDel destroys the string. |
|||
26 Aug 2012, 21:02 |
|
Overflowz 26 Aug 2012, 21:26
duh.. I need to translate these things in C-s inline ASM, I don't like dependencies I'm aiming to pure ASM code, that will set (e.g. EAX to 1 if CF = 1) and so on..
Thanks ! |
|||
26 Aug 2012, 21:26 |
|
Picnic 26 Aug 2012, 21:31
Hi,
Try this way, Code: format PE CONSOLE include "win32ax.inc" .data buf rb 33 .code main: call flags invoke MessageBox, 0, buf, "", MB_OK ret flags: pushad pushfd pushfd pop ebx mov edi,buf mov ecx,32 cld @@: xor al,al shl ebx,1 adc al,'0' stosb loop @B xor al, al stosb popfd popad ret .end main |
|||
26 Aug 2012, 21:31 |
|
Overflowz 26 Aug 2012, 21:35
I don't understand, AFAIK there is only 8 flags, but that displayed much more than 8.. Why or what I don't know yet ?
|
|||
26 Aug 2012, 21:35 |
|
Overflowz 26 Aug 2012, 21:46
as I guess, they have different offsets according to this ? -> http://www.c-jump.com/CIS77/ASM/Instructions/I77_0070_eflags_bits.htm
|
|||
26 Aug 2012, 21:46 |
|
revolution 26 Aug 2012, 21:53
Overflowz wrote: as I guess, they have different offsets according to this ? -> http://www.c-jump.com/CIS77/ASM/Instructions/I77_0070_eflags_bits.htm |
|||
26 Aug 2012, 21:53 |
|
Overflowz 26 Aug 2012, 21:55
Because I don't have time for searching in manuals because of hard job, isn't it enough ?..
|
|||
26 Aug 2012, 21:55 |
|
Picnic 26 Aug 2012, 21:57
Code converts a double word to binary.
Suppose you want to display only 16 bits of eflags register, Code: ; ; pushfd pop ebx shl ebx,16 mov edi,buf mov ecx,16 ; ; |
|||
26 Aug 2012, 21:57 |
|
Overflowz 26 Aug 2012, 22:07
I did some tests and SHL was not successful. Instead, SHR did job starting from carry flag to end. Am I doing everything right ? I need only status and control flags to be extracted, so I should check positions of each bits right ?
|
|||
26 Aug 2012, 22:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.