2014-03-04 69 views
-1

在我的任務中,我必須創建一個代碼,它會詢問我的名字然後閱讀它,但名稱必須遵守一些條件,例如前兩個字母必須在首都人將不得不法線字母 + 的名稱只能包含字母的26個字母,可以有比只有一個字的「」或「分離更多 - 」彙編語言條件

有其他條件,但我可以像字符數處理它們。雖然對於下面的我完全失去了。我知道我將不得不比較每個字符,但我不知道如何區分大寫字母和普通字母,我不知道如何在這裏使用ASCII表格。我看到了彙編語言的許多例子,但他們並不像我使用的是一個(當然結構)

這是與我使用結構的代碼示例:

segment .data 
    msg: db "Voici la chaine initiale : " 
    len: equ $-msg 
    msg1: db "AAAAAAAAAA", 10 
    len1: equ $-msg1 
    msg2: db "Entrez l'indice a modifier : " 
    len2: equ $-msg2 
    msg3: db "Entrez le nouveau caractere : " 
    len3: equ $-msg3 
    msg4: db "Voici la chaine modifiee : " 
    len4: equ $-msg4 
    retour: db 10 
    lecture1 : times 1 db 0 

segment .bss 
    lecture2 : resb 1 

segment .text 
    global _start 

_start: 
    mov eax, 4 
    mov ebx, 1 
    mov ecx, msg 
    mov edx, len 
    int 0x80 

    mov eax, 4 
    mov ebx, 1 
    mov ecx, msg1 
    mov edx, len1 
    int 0x80 

    mov eax, 4 
    mov ebx, 1 
    mov ecx, msg2 
    mov edx, len2 
    int 0x80 

回答

0

對於大寫字母ascii字符代碼必須介於0x41和0x5A之間(對於小寫字母)ascii字符代碼必須介於0x61和0x7A之間,用於空格ascii字符代碼必須爲0x20並且連字符( - )ascii字符代碼必須爲0x2D