汇编 编写程序段把int1和int2中以字符串形式存放的两个长整数相加,结果仍然以同样的形式放会变量int1中,不计溢出

;设变量int1和int2的定义如下

;int1 ‘935797238’

;int2 ‘843758912’

;编写程序段把int1和int2中以字符串形式存放的两个长整数相加,结果仍然以同样的形式放会变量int1中,不计溢出!

20080430132538[1]

data segment
int1 db ‘935797238’,13,10,24h
int2 db ‘843758912’,13,10,24h
data ends
code segment
     assume cs:code,ds:data
main: mov ax,data
      mov ds,ax
      lea dx,[int1]
      mov ah,9
      int 21h
      lea dx,[int2]
      mov ah,9
      int 21h
      lea si,[int1+8]
      lea di,[int2+8]
      mov cx,9
      mov ah,0
again:sub [si],30h
      sub [di],30h
      mov al,[si]
      add al,[di]
      add al,ah
      mov ah,0
      cmp al,0ah
      jge lab
      jmp lab1
  lab:mov ah,1
      sub al,10
lab1:add al,30h
      mov [si],al
      dec si
      dec di
      loop again
      mov al,ah
      add al,30h
      mov ah,2
      mov dl,al
      int 21h
      lea dx,[int1]
      mov ah,9
      int 21h
      mov ax,4c00h
      int 21h
      code ends
          end main

- THE END -
版权声明:
转载原创文章请注明,文章出处:http://kinggoo.com
原文地址:http://kinggoo.com/chengxu-huibian-changzhengshuxiangjia.htm
发表评论?

0 条评论。

发表评论