The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Danish on April 13, 2008, 06:14:02 AM

Title: How to display CPU registers?
Post by: Danish on April 13, 2008, 06:14:02 AM
Hello friends   I need a short programme which would show me CPU registers so I can use their data to make sure my add,sub or div  programs are working.Please if you can gimme one little program which could help.
Title: Re: How to display CPU registers?
Post by: BogdanOntanu on April 13, 2008, 11:57:46 AM
The simple way is to use the functions already provided in MASM32 in order to print numbers "on screen". Check the MASM32 samples and also check countless small simple examples provided on this board.

I guess it is easier  to start with a console application than a GUI application for printing numbers on screen. This way you could print anything on screen ranging from register values to variables and memory region dumps. Later on you can write your own functions but you have to start somewhere.

If you are no capable of doing this then a fast solution would also be to use OllyDbg debugger. Start your program in Ollydbg and you can see the CPU registers values as you execute each instruction step by step.
Title: Re: How to display CPU registers?
Post by: hutch-- on April 13, 2008, 12:12:38 PM
Danish,

Here is a hint.


YourProc proc args etc ....

    LOCAL _eax  :DWORD

    mov _eax, eax

    print str$(_eax),13,10

    ret

YourProc endp


The trick is to write them to memory first so you don't change any registers. Once you have them in memory you just display them at the console.