Question

In my assignment I have to make a code that will ask me for my name and then read it, but the name will have to respect some conditions , for example the first 2 letters will have to be in capital and the others will have to be normals letters + the name can only contains the 26 letters of the alphabet and can have more than only one word separated by " " or "-"

There are others conditions, but i can handle them like the number of characters. Although for the ones below I'm completely lost. I know i will have to compare each character but i don't know how to make the difference between a capital letter and a normal one and i don't see how to use ASCII table here. I saw many example of assembly language but they don't look like the one I'm using (the structure of course)

Here is an example of a code with the structure I'm using:

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
Was it helpful?

Solution

for capital letters the ascii character code must be between 0x41 and 0x5A for lowercase letters the ascii character code must be between 0x61 and 0x7A for space ascii character code must be 0x20 and for hyphen(-) ascii character code must be 0x2D

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top