回覆列表
  • 1 # 使用者9364575890814

    數放在ax裡面

    MOV AX,DATAS

    MOV DS,AX

    mov ax,0f2h

    mov cl,4

    push ax

    shl ax,cl

    cmp ah,9

    ja n1

    add ah,30h

    mov dl,ah

    mov ah,02h

    int 21h

    jmp n2

    n1:

    add ah,37h

    mov dl,ah

    mov ah,02h

    int 21h

    n2:

    pop ax

    and al,0fh

    cmp al,9

    ja n3

    add al,30h

    mov dl,al

    mov ah,02h

    int 21h

    jmp n4

    n3:

    add al,37h

    mov dl,al

    mov ah,02h

    int 21h

    n4:

    mov ah,4ch

    int 21h

    上面是16進位制輸出

    /////////////////////////////////////

    DATAS SEGMENT

    str1 db 100 dup(?)

    str2 db "No Match!$"

    str3 db "Match and the position is:$"

    str4 db "Sentence:$"

    str5 db "Keyword:$"

    DATAS ENDS

    CODES SEGMENT

    ASSUME CS:CODES,DS:DATAS

    START:

    MOV AX,DATAS

    MOV DS,AX

    lea dx,str4

    mov ah,09h

    int 21h

    mov str1,100

    lea dx,str1

    mov ah,0ah

    int 21h

    call changeline

    lea dx,str5

    mov ah,09h

    int 21h

    mov ah,01h

    int 21h

    mov bx,0

    check:

    mov cl,[str1+2+bx]

    cmp cl,al

    jz do

    cmp bl,[str1+1]

    jz Nomatch

    inc bx

    jmp check

    do:

    call changeline

    lea dx,str3

    mov ah,09h

    int 21h

    mov dl,bl

    mov ah,02h

    int 21h

    jmp done

    Nomatch:

    call changeline

    lea dx,str2

    mov ah,09h

    int 21h

    done:

    MOV AH,4CH

    INT 21H

    changeline proc near

    mov dl,0dh

    mov ah,2h

    int 21h

    mov dl,0ah

    mov ah,2h

    int 21h

    ret

    changeline endp

    CODES ENDS

    END START

  • 中秋節和大豐收的關聯?
  • 蘆葉船作者吳珹簡介?