flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Examples and Tutorials > [Example] Displays current CPU state

Author
Thread Post new topic Reply to topic
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1173
Location: Unknown
[Example] Displays current CPU state
This example reads, and displays current CPU state (registers, flags, FPU, etc...)

It can be called from any point in the program, this example calls it at start.

New registers are not taken into account, my CPU does not even have them. This example is guaranteed to run in most systems.

Sample output (x86_64):

Code:

rax = $F3F6F581447EDD1C     xmm0  = $00000000000000000000000000000000
rbx = $E1D7DA5E86187417     xmm1  = $0000000000000000F3F6F581447EDD1C
rcx = $9090909090909090     xmm2  = $00000000000000000000000000000000
rdx = $68A4744D99460C9F     xmm3  = $00000000000000000000000000000000
rdi = $BD9CE3363325C13B     xmm4  = $00000000000000000000000000000000
rsi = $57629A0F93635C5B     xmm5  = $00000000000000000000000000000000
r8  = $0988541216C2CCF9     xmm6  = $00000000000000000000000000000000
r9  = $4CEDBD02FC3A09AA     xmm7  = $00000000000000000000000000000000
r10 = $A2D9ED1DA3B17832     xmm8  = $00000000000000000000000000000000
r11 = $575D8A6170F9BAC8     xmm9  = $00000000000000000000000000000000
r12 = $A6F0B417661D364F     xmm10 = $00000000000000000000000000000000
r13 = $44CFE6B25759C512     xmm11 = $00000000000000000000000000000000
r14 = $F57130111DEF7BD0     xmm12 = $00000000000000000000000000000000
r15 = $0000000000000000     xmm13 = $00000000000000000000000000000000
rbp = $0000000000000000     xmm14 = $00000000000000000000000000000000
rsp = $00007FFF0904BDC8     xmm15 = $00000000000000000000000000000000
rip = $000000000040013E     

st0 = $00000000000000000000     mm0 = $0000000000000000
st1 = $00000000000000000000     mm1 = $0000000000000000
st2 = $00000000000000000000     mm2 = $0000000000000000
st3 = $00000000000000000000     mm3 = $0000000000000000
st4 = $00000000000000000000     mm4 = $0000000000000000
st5 = $00000000000000000000     mm5 = $0000000000000000
st6 = $00000000000000000000     mm6 = $0000000000000000
st7 = $00000000000000000000     mm7 = $0000000000000000

Partial stack at [rsp]:
_-_-_-_-_-_-_-_-_-_-0000000000000000$9090909090909090-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000008$0000000000000001-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000010$00007FFF0904D45B-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000018$0000000000000000-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000020$00007FFF0904D461-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000028$00007FFF0904D476-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000030$00007FFF0904D481-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000038$00007FFF0904D498-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000040$00007FFF0904D4AB-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-0000000000000048$00007FFF0904D4BD-_-_-_-_-_-_-_-_-_-_

Ordinary segments:
CS$0000000000000033   SS$000000000000002B   DS$0000000000000000
ES$0000000000000000   FS$0000000000000000   GS$0000000000000000

Ordinary flags:
CF = 0   PF = 0   AF = 0   ZF = 0   SF = 0   TF = 0
IF = 1   DF = 1   OF = 0   NT = 0   IOPL = 0




Description: Linux
Download
Filename: dcs.tar.bz2
Filesize: 7.12 KB
Downloaded: 6 Time(s)



Last edited by HaHaAnonymous on 11 Jul 2016, 19:12; edited 11 times in total
Post 12 Feb 2013, 23:17
View user's profile Send private message Reply with quote
KevinN



Joined: 09 Oct 2012
Posts: 161
Thanks for your time! These little programs can be written off as useless but they're not.. I mean, Unix-like oses seem to be made up of em.
Post 14 Feb 2013, 15:55
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1173
Location: Unknown
Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 21:30; edited 2 times in total
Post 14 Feb 2013, 16:41
View user's profile Send private message Reply with quote
randall



Joined: 03 Dec 2011
Posts: 149
Location: Poland
Nice program. Thanks.

_________________
https://github.com/michal-z
Post 07 Mar 2013, 14:57
View user's profile Send private message Visit poster's website Reply with quote
Bob++



Joined: 12 Feb 2013
Posts: 92
Looks like very nice. I will download it.
Post 09 Mar 2013, 16:22
View user's profile Send private message Reply with quote
uart777



Joined: 17 Jan 2012
Posts: 369
HaHa: Good ideas. We definitely need debugging functions like this, they are NOT useless.
Post 13 Mar 2013, 11:25
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1173
Location: Unknown
Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 21:16; edited 2 times in total
Post 24 Mar 2013, 16:12
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1103
Location: Russian Federation

HaHaAnonymous wrote:
No, they are useless indeed. Everything I do is useless.

I don't know what I am doing in this world, I'm just useless.



Whoever wrote this (and I am assuming it is not HaHaAnonymous), I will find and I am gonna put a bullet in yo' bitch ass. Meet me some-fucking-where. Give me an address. But you better come strapped. Cause I am gonna be strapped. The clip is in the motherfuckin' gun.

http://www.youtube.com/results?search_query=irate+black+man

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 24 Mar 2013, 22:26
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1173
Location: Unknown
Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 18:18; edited 1 time in total
Post 07 Feb 2014, 19:04
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
Wow, Will surely help me take less coffee as I usually go realllly mad with
my programs and code. Maybe this could help. Smile
Post 07 Feb 2014, 23:51
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1173
Location: Unknown
Stupid post removed.


Last edited by HaHaAnonymous on 28 Feb 2015, 18:18; edited 1 time in total
Post 08 Feb 2014, 01:13
View user's profile Send private message Reply with quote
questlima



Joined: 27 Aug 2014
Posts: 37
Absolutely among all the Greatest things around us to feel Happy is the only Greatest gift a man can have and Happy is the Greatest word in the dictionary:LOL

another great thing about FASM is i get to learn how to write apps for Linux
this is awesome i should have been here earlier no one told me to just today my grandma:D said try FASM you will not regrade a moment and she was absolutely right and am glade that i listened to my grandma:D anyway thanks for sharing


Last edited by questlima on 27 Aug 2014, 14:09; edited 1 time in total
Post 27 Aug 2014, 13:59
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000

questlima wrote:
another great thing about FASM is i get to learn how to write apps for Linux
this is awesome i should have been here earlier no one told me to just today my grandma:D said try FASM you will not regrade a moment and she was absolutely right and am glade that i listened to my grandma:D anyway thanks for sharing



Is your grandma Grace Hopper?
Post 27 Aug 2014, 14:08
View user's profile Send private message Reply with quote
questlima



Joined: 27 Aug 2014
Posts: 37
nop but Ada Lovelace was my grandma's best friend:LOL


Last edited by questlima on 27 Aug 2014, 14:18; edited 1 time in total
Post 27 Aug 2014, 14:13
View user's profile Send private message Reply with quote
questlima



Joined: 27 Aug 2014
Posts: 37

typedef wrote:

questlima wrote:
another great thing about FASM is i get to learn how to write apps for Linux
this is awesome i should have been here earlier no one told me to just today my grandma:D said try FASM you will not regrade a moment and she was absolutely right and am glade that i listened to my grandma:D anyway thanks for sharing



Is your grandma Grace Hopper?



you are funny mate:)
nop but Grace Hopper was my grandma's best friend:LOL
Post 27 Aug 2014, 14:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.