3-20.asm

来自「华工电信系汇编习题的编程实现」· 汇编 代码 · 共 68 行

ASM
68
字号
stack segment stack 'stack'
      dw 32 dup(?)
stack ends

data segment 
     Outbuf db 'The ASC2 code of$'
     BufIS db ' is$'
     BufEnd db ' is 0DH$'
     ASCNum db 3 dup(?),'$'
data ends

code segment 
begin proc far
      assume ss:stack,cs:code,ds:data
      push ds
      sub ax,ax
      push ax
      mov ax,data
      mov ds,ax

AGAIN:
      mov dx,offset Outbuf
      mov ah,9
      int 21H
      
      mov ah,1
      int 21H
      CMP al,00DH
      JZ LOOPOUT
 
      mov cx,ax     
      mov dl,00AH
      mov ah,2
      int 21H
 
      mov dx,offset BufIS
      mov ah,9
      int 21H
      
      mov ax,cx
      mov ah,0
      mov bl,10
      div bl
      add ah,30H
      mov ASCNum + 2,ah
      mov ah,0
      div bl
      add ah,30H
      mov ASCNum + 1,ah
      add al,30H
      mov ASCNum,al

      mov dx,offset ASCNum 
      mov ah,9
      int 21H
            
      JMP AGAIN

LOOPOUT:    
      mov dx,offset BufEnd
      mov ah,9
      int 21H

             
      ret
begin   endp
code    ends
      end begin

⌨️ 快捷键说明

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