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

📄 23.asm

📁 1. 要求程序建立一个可存放50项的电话号码表
💻 ASM
字号:
datarea segment
t1     db 'letter:$'
t2     db 'digit :$'
t3     db 'other :$'
t4     db 'please input a string:$'
letter dW 1 dup(0)
digit  dW 1 dup(0)
other  dW 1 dup(0)  
count label byte
max    db 81
len    db 1 dup(?)
countfld  db 81 dup(?)
datarea ends

ente    macro
        mov dl,0ah
        mov ah,02h
        int 21h
        mov dl,0dh
        mov ah,02h
        int 21h
        endm

stack_seg segment para stack 'stack'   
dw 100 dup(?)
stack_seg ends

prognam segment
main proc far
assume cs:prognam,ds:datarea,ss:stack_seg
start:
push ds
sub ax,ax
push ax
mov ax,datarea
mov ds,ax
lea dx,t4
mov ah,09h
int 21h

lea dx,count
mov ah,0ah
int 21h
mov dl,0ah
mov ah,02h
int 21h
cld
mov di,0
mov bl,len[di]
inc bl

again:
dec bl
cmp bl,0
jbe exit
mov dl,countfld[di]
cmp dl,'0'
JNB CMP1
JMP CMP5

CMP1:
CMP dl,'9'
JBE CMP2

CMP DL,'A'
JNB CMP3
JMP CMP5

CMP3:
CMP DL,'Z'
JBE CMP4
CMP DL,'a'
JB CMP5
CMP DL,'z'
JBE CMP4
JMP CMP5

CMP4:
MOV AX,letter[0]
inc AX
mov letter[0],AX
inc di
jmp again

CMP2:
mov AX,digit[0]
inc AX
mov digit[0],AX
inc di
JMP AGAIN

CMP5:
mov AX,other[0]
inc AX
mov other[0],AX
inc di
jmp again

exit:
lea dx,t1
mov ah,09h
int 21h
MOV DX,letter[0]
call MATH
ente
lea dx,t2
mov ah,09h
int 21h
MOV DX,digit[0]
call MATH
ente
lea dx,t3
mov ah,09h
int 21h
MOV DX,other[0]
call MATH
mov ah,4ch
int 21h
main endp

MATH proc near
        mov cl,0
        pp:
        cmp dl,0ah
        mov bl,dl
        jb below
        sub dl,0ah
        inc cl
        jmp pp
        below:
        mov dl,cl
        add dl,30h
        mov ah,02h
        int 21h
        mov dl,bl
        add dl,30h
        mov ah,02h
        int 21h
        ret
MATH endp

prognam ends
end start

⌨️ 快捷键说明

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