The MASM Forum

General => The Campus => Topic started by: greco558 on August 23, 2016, 04:03:42 AM

Title: Sandbox dump registers
Post by: greco558 on August 23, 2016, 04:03:42 AM
Hi All,

I wrote a short program to show the contents of registers.

I placed it in a program called sandbox.asm to test out pieces of code and show register contents
at different points by calling ShowReg procedure.

I have found it helpful for a quick check to see if a piece of code is doing what I want.

Thought I would post it in case anyone is interested.

Best Regards
John
Title: Re: Sandbox dump registers
Post by: hutch-- on August 23, 2016, 10:26:19 PM
Works fine here John on Win 10 Professional.  :t
Title: Re: Sandbox dump registers
Post by: hutch-- on August 23, 2016, 10:39:59 PM
Here is an alternative.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

regs proc

    LOCAL rEAX :DWORD
    LOCAL rEBX :DWORD
    LOCAL rECX :DWORD
    LOCAL rEDX :DWORD
    LOCAL rESI :DWORD
    LOCAL rEDI :DWORD
    LOCAL rEBP :DWORD
    LOCAL rESP :DWORD

  ; ---------------------------------------------
  ; copy 8 registers without altering any of them
  ; ---------------------------------------------
    mov rEAX, eax
    mov rEBX, ebx
    mov rECX, ecx
    mov rEDX, edx
    mov rESI, esi
    mov rEDI, edi
    mov rEBP, ebp
    mov rESP, esp

  ; --------------------
  ; display the 8 copies
  ; --------------------
    print hex$(rEAX)," = eax",13,10
    print hex$(rEBX)," = ebx",13,10
    print hex$(rECX)," = ecx",13,10
    print hex$(rEDX)," = edx",13,10
    print hex$(rESI)," = esi",13,10
    print hex$(rEDI)," = edi",13,10
    print hex$(rEBP)," = ebp",13,10
    print hex$(rESP)," = esp",13,10

    ret

regs endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Title: Re: Sandbox dump registers
Post by: greco558 on August 24, 2016, 11:17:27 AM
Hutch,
Thanks for the procedure, it will come in handy.
I am still working on learning all I  can about masm32 assembly language.
I have learned a lot working on my editbyte program.

Title: Re: Sandbox dump registers
Post by: hutch-- on August 24, 2016, 11:25:34 AM
Hi John,

That is the best way to get up to pace, nothing beats writing enough code to get the swing of how it works. By the time you get up to pace we should have enough 64 bit stuff working to be useful.
Title: Re: Sandbox dump registers
Post by: greco558 on November 16, 2016, 07:41:06 AM
Hi All,

Here is a new Version of sandbox program.
I use it when I want to see how a piece of code effects the registers.
Shows contents of registers in Hex, Decimal, Binary, and ASCII printable characters.

Updated version to show EBP & ESP registers and removed break down of EDI & ESI


Best Regards
John