banner



How To Print Register Value In Assembly

 How to print register value on screen?

I demand to print annals value on screen for debug purpose. Because there is
no
debug program which can debug assembler in the ROM carte du jour.

Does anyone tin can testify me some sample codes?

Thank a lot.

 How to print register value on screen?

Quote:

> I need to print register value on screen for debug purpose. Because
there is
> no
> debug plan which can debug assembler in the ROM carte du jour.

> Does anyone can show me some sample codes?

I use this:

;=======================================================================
====
;Procedure: PrintReg
;Purpose:   Displays the contents of a register.
;           Displays data at electric current cursor location
;Input:     EAX  Register to print
;           CL   Length of output (eight for total EAX, iv for AX, 2 for
AL...)
;
;Output:    Data written to screen using Stdout
;Processing: Move crumb into output annals, display it, loop til
finished
;-----------------------------------------------------------------------
----
printreg proc

        push    cx
push button    dx

        push    cx
xor     ch, ch
mov     dx, 8
sub     dx, cx
mov     cx, dx
shl     cx, 2                   ; multply by 4 for shift#
rol     eax, cl
popular     cx

nextchar:
rol     eax,iv                      ;impress next character
mov     dl,al                      ;
and     dl,0fh                     ;strip out upper 4 $.25
call    display_hex_char
loop    nextchar
pop     dx
pop     cx
ret
printreg endp

;=======================================================================
====
;Procedure: Display_hex_char
;Purpose:   Displays the hex value in DL equally ASCII
;           Displays data at current cursor location
;Input:     DL = hex value to print
;
;Output:    Data printed to screen using Stdout
;Processing: add xxx or 37 to character, brandish to screen using int 10
;-----------------------------------------------------------------------
----
display_hex_char proc
push    dx
add     dl,30h
cmp     dl,3ah
jb      charok
add     dl,7
charok:
push    ax
button    bx
push button    cx
mov     ah,2
int     21h
pop     cx
popular     bx
pop     ax
pop     dx
ret
display_hex_char endp

Sent via Deja.com http://www.deja.com/
Before you buy.

How To Print Register Value In Assembly,

Source: http://computer-programming-forum.com/46-asm/26d9439981f93463.htm

Posted by: juarezalloss.blogspot.com

0 Response to "How To Print Register Value In Assembly"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel