Hi,guys,
i`m studying addition at the moment and cant find info needed anywhere.
The following is easy:
a db 254
---
mov al,a
add al,3
jc M1
M1:
adc ah,0 ;output in AX
---
hence 2 problems:
1. a word 65534
---
mov ax,a
add ax,2
jc M1
M1:
? ;output in EAX?
---
2. a dword fffffffeh
---
mov eax,a
add eax,2
jc M1
M1:
? ;output in ? And how can i take it to put it,say,in wsprintf()?
Thanx a lot.
well - this is 16-bit code - we have a special forum for that
"a" ? - try to use longer/more descriptive names for variables
to display a 32-bit value in decimal with 16-bit code, you need a multiple precision conversion routine
give me a little time to come up with one
it would be much easier to use 32-bit code - lol
in fact, we will make this a 32-bit project - i now see you have eax in your post
i cheated by using the masm32 sstr$ macro to display the values - lol
is this for school ?
INCLUDE \masm32\include\masm32rt.inc
.DATA
Value1 dd 0FFFFFFFEh
Value2 dw 65534
Value3 db 254
.CODE
_main PROC
mov al,Value3
add al,3
xor edx,edx
mov dl,al
print sstr$(edx),13,10
mov ax,Value2
add ax,2
xor edx,edx
mov dx,ax
print sstr$(edx),13,10
mov eax,Value1
add eax,2
print sstr$(eax),13,10
inkey
exit
_main ENDP
END _main
http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/toc.html
and in particular: http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-2.html#HEADING2-28
is worth a look
or download as a pdf: http://www.planetpdf.com/codecuts/pdfs/aoa.pdf