I'm not familiar with the Irine library. I assume they've got code to do it, possibly wrapped in a macro.
Dr. Carter's got such a setup in the example code from
http://drpaulcarter.com/pcasmUses printf. I like to "do it myself". Here's a rough first draft. It's for Linux, you'll have to fix the "exit" and the "write_stdout" for BSD (holler if you need help with that - I can take a guess).
It can be improved... Probably should show segment registers, too. Display of the flags could be expanded. What do you *want* it to do?
Best,
Frank
; nasm -f elf dumpregs.asm
; ld -o dumpregs dumpregs.o
global _start
section .text
_start:
mov eax, 1
mov ebx, 2
mov ecx, 3
mov edx, 4
mov esi, 5
mov edi, 6
mov ebp, 7
call dumpregs
mov eax, 1
int 80h
;-------------------
dumpregs:
pusha
pushf
mov ebp, esp
sub esp, 1024 ; ?
mov ecx, esp
xor edx, edx
mov dword [ecx + edx], 'eax='
add edx, byte 4
mov eax, [ebp + 32]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'ebx='
add edx, byte 4
mov eax, [ebp + 20]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'ecx='
add edx, byte 4
mov eax, [ebp + 28]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'edx='
add edx, byte 4
mov eax, [ebp + 24]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'esi='
add edx, byte 4
mov eax, [ebp + 8]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'edi='
add edx, byte 4
mov eax, [ebp + 4]
call dumpregs2
mov byte [ecx + edx], 10
inc edx
mov dword [ecx + edx], 'ebp='
add edx, byte 4
mov eax, [ebp + 12]
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'esp='
add edx, byte 4
mov eax, [ebp + 16]
add eax, byte 4
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'eip='
add edx, byte 4
mov eax, [ebp + 36]
sub eax, byte 5
call dumpregs2
mov byte [ecx + edx], ' '
inc edx
mov dword [ecx + edx], 'flg='
add edx, byte 4
mov eax, [ebp + 0]
call dumpregs2
mov byte [ecx + edx], 10
inc edx
call write_stdout
mov esp, ebp
popf
popa
ret
dumpregs2:
mov ebx, 8
.top:
rol eax, 4
push eax
and al, 0Fh
cmp al, 10
sbb al, 69h
das
mov [ecx + edx], al
inc edx
pop eax
dec ebx
jnz .top
ret
;---------------
write_stdout:
mov eax, 4
mov ebx, 1
int 80h
ret