|
-
May 16th, 2005, 04:39 AM
#1
Thread Starter
Lively Member
Addition problem
Hi guys.
I've got a problem in my addition for my assembly. i'll post the code here
Code:
CheckBit1 proc
mov dl,hammingNum[2] ;lets say [2] stored in side is 1
add dl,hammingNum[4] ;lets say [4] stored in side is 1 also
mov hammingNum[0],dl ;store the 1+1 =2 to [0]
;=====REMOVE WHEN NOT NEEDED=====
call ClearScreen
mov dl,hammingNum[0]
mov ah,02h ;display the output here
int 21h
ret
CheckBit1 endp
when i tried to add what's in [2] and [4], the output i got is 'b'! The output i want is suppose to be 1+1 = 2 ! not 1+1 = 11 where in ascii value is 'b'. How do i solve this problem? Please do help me! Thanks!
Anime is what i LIVE for, BREATH for, and DIE for!
-
May 26th, 2005, 07:46 PM
#2
Addicted Member
Re: Addition problem
hi, this is a small example how to add from memory address.
u could use the debug program in command prompt to try.
Code:
-a
0AE6:0100 mov ax,1
0AE6:0103 mov [0400],ax
0AE6:0106 mov bx,2
0AE6:0109 mov [0402],bx
0AE6:010D mov dl,[0400]
0AE6:0111 add dl,[0402]
0AE6:0115
-r
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0100 NV UP EI PL NZ NA PO NC
0AE6:0100 B80100 MOV AX,0001
-t
AX=0001 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0103 NV UP EI PL NZ NA PO NC
0AE6:0103 A30004 MOV [0400],AX DS:0400=0001
-t
AX=0001 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0106 NV UP EI PL NZ NA PO NC
0AE6:0106 BB0200 MOV BX,0002
-t
AX=0001 BX=0002 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0109 NV UP EI PL NZ NA PO NC
0AE6:0109 891E0204 MOV [0402],BX DS:0402=0002
-t
AX=0001 BX=0002 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=010D NV UP EI PL NZ NA PO NC
0AE6:010D 8A160004 MOV DL,[0400] DS:0400=01
-t
AX=0001 BX=0002 CX=0000 DX=0001 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0111 NV UP EI PL NZ NA PO NC
0AE6:0111 02160204 ADD DL,[0402] DS:0402=02
-t
AX=0001 BX=0002 CX=0000 DX=0003 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0115 NV UP EI PL NZ NA PE NC
0AE6:0115 07 POP ES
if u felt my post make u happy ,
then u could make me happy too by rating my post
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|