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

📄 522.asm

📁 汇编语言课后习题答案
💻 ASM
字号:
;522.asm

;*****************************************************************************
datasg segment
buffer label byte
  max  db  81
  act  db  ?
  char db  81 dup(?)
;
letter db  'letter:',?,?,13,10,'$'
digit  db  'digit:',?,?,13,10,'$'
other  db  'other:',?,?,13,10,'$'
datasg ends
;****************************************************************************
codesg segment
;----------------------------------------------------------------------------
main   proc   far
       assume cs:codesg,ds:datasg
start:
       push ds
       sub  ax,ax
       push ax
       mov ax,datasg
       mov ds,ax
       lea dx,buffer
       mov ah,0ah
       int 21h
       mov cl,act
       mov si,00h
       mov bh,00h
       mov bl,00h
       mov dl,00h
again: cmp cl,0
       jz  next
       mov al,char[si]
       cmp al,7ah
       jg othe
       cmp al,60h
       jg lette
       cmp al,5ah
       jg othe
       cmp al,40h
       jg lette
       cmp al,39h
       jg othe
       cmp al,2fh
       jg digi
othe:  mov al,1
       add al,dl
       daa
       mov dl,al
       jmp short repeat
lette: mov al,1
       add al,bh
       daa
       mov bh,al
       jmp short repeat
digi:  mov al,1
       add al,bl
       daa
       mov bl,al
repeat:inc si
       dec cl
       jmp short again
next:  mov cl,4
       mov al,bh
       and al,0fh
       add al,30h
       mov letter+8,al
       mov al,bh
       rol al,cl
       and al,0fh
       add al,30h
       mov letter+7,al
       mov al,bl
       and al,0fh
       add al,30h
       mov digit+7,al
       mov al,bl
       rol al,cl
       and al,0fh
       add al,30h
       mov digit+6,al
       mov al,dl
       and al,0fh
       add al,30h
       mov other+7,al
       mov al,dl
       rol al,cl
       and al,0fh
       add al,30h
       mov other+6,al
;
       mov dl,0dh
       mov ah,02h
       int 21h
       mov dl,0ah
       mov ah,02h
       int 21h
       lea dx,letter
       mov ah,09h
       int 21h
       lea dx,digit
       mov ah,09h
       int 21h
       lea dx,other
       mov ah,09h
       int 21h
       ret
main   endp
;----------------------------------------------------------------------------
codesg ends
;***************************************************************************
       end start

⌨️ 快捷键说明

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