The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: i3fan8760 on September 17, 2009, 08:06:16 PM

Title: New to Assembly.. How do i display values of 16-bit registers...
Post by: i3fan8760 on September 17, 2009, 08:06:16 PM
Im new to assembly and having lots of issues:

i have to make a program that subtracts 3 integers using only 16-bit registers and display it using a function or procedure (idk the difference in assembly) that only displays 32-bit registers and the flags.....

Thanks to whoever helps me out

Title: Re: New to Assembly.. How do i display values of 16-bit registers...
Post by: Slugsnack on September 17, 2009, 09:16:36 PM
let's say you have result in ax. just zero extend to eax with 'movzx eax, ax' then you can display eax. zero extend puts the value of smaller source operand into larger destination one. the new bytes are zeroed
Title: Re: New to Assembly.. How do i display values of 16-bit registers...
Post by: dedndave on September 17, 2009, 11:41:36 PM

        print right$(uhex$(eax),2)

will display AL

        print left$(right$(uhex$(eax),4),2)

will display AH

        print right$(uhex$(eax),4)

will display AX
Title: Re: New to Assembly.. How do i display values of 16-bit registers...
Post by: i3fan8760 on September 21, 2009, 07:04:34 PM
I tried to use the movzx eax,ax but it gives me an error: instruction operands must be the same size
Title: Re: New to Assembly.. How do i display values of 16-bit registers...
Post by: i3fan8760 on September 21, 2009, 08:32:14 PM
nvm it worked thanx!!