⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex5.asm

📁 用汇编实现加法个可的年发个的就发个 个 个的发个的发个的发和的发和个的发个的个和的发
💻 ASM
字号:
data segment
mesg1 db 'input data1:$'
mesg2 db 'input data2:$'
mesg3 db 'the result is:$'
str1 db 20
     db ?
     db 20 dup(?)
str2 db 20
     db ?
     db 20 dup(?)
str3 db 16
     db ?
     db 15 dup(?)
     db '$'
data ends
code segment
     assume cs:code,ds:data
start:
      mov ax,data
      mov ds,ax
      mov es,ax

      mov ah,0h
      mov al,03h
      int 10h
   
      mov ah,2
      mov bh,0
      mov dh,10
      mov dl,20
      int 10h

      mov ah,09h
      mov dx,offset mesg1
      int 21h
   
      mov ah,0ah
      mov dx,offset str1
      int 21h

      mov cl,str1+1
      mov ch,0h
      mov si,offset str1+2
again:
      mov al,[si]
      and al,0fh
      mov [si],al
      inc si
      loop again
      
      mov ah,2
      mov bh,0
      mov dh,11
      mov dl,20
      int 10h

      mov ah,09
      mov dx,offset mesg2
      int 21h
   
      mov ah,0ah
      mov dx,offset str2
      int 21h

      mov cl,str2+1
      mov ch,0
      mov di,offset str2+2
again1:
      mov al,[di]
      and al,0fh
      mov [di],al
      inc di
      loop again1
      
      mov si,offset str1+1
      push si
      mov bh,0
      mov bl,str1+1
      add si,bx
      mov dx,si
      push dx
      
      mov di,offset str2+1
      push di
      mov bh,0
      mov bl,str2+1
      add di,bx
      mov ax,di
      push ax
   
      mov bx,offset str3+14
      push bx
      mov bl,str1+1
      mov cl,str2+1
      
      pop bx
      pop ax
      pop di
      pop dx
      pop si
      push bx
      push dx
      mov bl,str1+1
      
      mov dl,0h
      mov [si],dl
      dec si
      mov [si],dl
      mov [di],dl
      dec di
      mov [di],dl
      pop dx
      mov si,dx
      mov di,ax
      mov dl,0h
      
     
      cmp bl,cl
      jae la
      cmp bl,cl
      jbe lb
  la: 
      mov cl,bl
      mov ch,0
      add cx,1
      jmp next
  lb:
      mov ch,0
      add cx,1
      jmp next
 next:
           
      mov al,[si]
      mov bl,[di]
      add al,bl
      add al,dl
      cmp al,0ah
      jae ly
      cmp al,0ah
      jb ls
   ly:
      sub al,0ah
      mov dl,01h
      or al,30h
      pop bx
      mov [bx],al
      dec bx
      push bx
      dec si 
      dec di
      loop next
   ls:
      mov dl,0h
      or al,30h
      pop bx
      mov [bx],al
      dec bx
      push bx
      dec si 
      dec di
      loop next

     

      mov ah,2
      mov bh,0
      mov dh,12
      mov dl,20
      int 10h

      mov ah,09h
      mov dx,offset mesg3
      int 21h

      mov ah,2
      mov bh,0
      mov dh,12
      mov dl,35
      int 10h
      
 
      mov ah,09h
      mov dx,offset str3+2
      int 21h
 
   
       
      mov ah,4ch
      int 21h
code ends
     end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -