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

📄 name.asm

📁 用汇编语言编写的一个小程序
💻 ASM
字号:
;定义数据段
data segment 
    myname db 'Ren Fang Li$'  
    n equ  $ - myname        ;名字的长度
    msg1 db 'my name is:$'    ;定义字符串my name is:
    msg2 db 0dh,0ah,'the sum of ascii of my name is:$'     ; 定义字符串the sum of ascii of my name is
    
data ends

code segment     ;定义代码段
    assume cs:code,ds:data
  start: mov ax,data
         mov ds,ax          ; 给段寄存器DS附段地址
         ;显示字符串my name is:
         mov dx,offset msg1
         mov ah,09h
         int 21h
         ;display my name
         mov dx,offset myname
         mov ah,09h
         int 21h
         ; 显示字符串the sum of ascii of my name is
         mov dx,offset msg2
         mov ah,09h
         int 21h
         ;计算ascii字符串码的和
         
         mov si,offset myname
         mov ax,0
         mov cx,n-1 
         clc
   next: mov bh,0
         mov bl,[si]
         add ax,bx
         inc si 
         loop next
         ;显示这个ascii和的第一个字
         mov dx,0
         mov bx,1000
         div bx
         mov bx,dx 
         add al,30h 
         mov dl,al
         mov ah,02h
         int 21h
         ;显示第二个ascii字
         mov ax,bx
         mov bl,100
         div bl 
         mov bl,ah
         add al,30h
         mov dl,al
         mov ah,02h
         int 21h
         ;显示第3个ascii字
         mov al,bl
         mov ah,00h
         mov bl,10
         div bl
         mov bl,ah
         add al,30h
         mov dl,al
         mov ah,2h
         int 21h
         ;显示第四个ascii字 
         add bl,30h
         mov dl,bl
         mov ah,2h
         int 21h
        
              
code ends
    end start

⌨️ 快捷键说明

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