Skip to main content
GameDev.net gamedev.net
🔒 Locked

Another assembly question....call DumpRegs

Started by chadsxe Aug 8, 2006 at 12:09 PM 0 replies 5.5k views
Original Post
chadsxe
chadsxe
TITLE MASM Template						(main.asm)

; This program subtracts three integers using only 16-bit registers
; 08/08/06

INCLUDE Irvine32.inc
.data
val1 WORD 300d
val2 WORD 50d 
val3 WORD 150d
finalVal WORD ?

.code
main PROC

	mov ax,val1		;Start with 300d in ax
	sub ax,val2		;Subtract 50d from ax
	sub ax,val3		;Subtract 150d from ax
	mov finalVal,ax	;store the result (100d)
	
	call DumpRegs
	
	exit
	
main ENDP

END main

So I am using 16-bit registers (ax), correct? When you call DumpRegs it displays the 32-bit registers, correct? How can I get it to display 16-bit registers back to me? Thanks Chad
JasonBlochowiak
JasonBlochowiak
Quote:
Original post by chadsxe
*** Source Snippet Removed ***

So I am using 16-bit registers (ax), correct? When you call DumpRegs it displays the 32-bit registers, correct? How can I get it to display 16-bit registers back to me?

Thanks

Chad


Well, the 16 and 32 bit registers are the same - the 16 bit "registers" live in the lower 16 bits of the 32 bit registers. AX is the low 16 bits of EAX, etc.

Presumably you could take a look at the source for DumpRegs and create a DumpRegs16 or somesuch if you specifically want it to only display the 16 bit part.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.