How can I check for a down arrow in terminal input on Linux?

61 Views Asked by At

i can't understand how can i read the down arrow input in assembly. I need this input to pass to the next string.

i checked the register ebx and ecx and inside of them there are different values. i tried to initialize a string that contains ^[[B the char that appear when you press down arrow key but when i pres it and then enter , the process go in the lable "sbaglio" it send write "check_olio" and the content of var a that is the new line code.

.section .bss
        .lcomm a 256

.section .data

Freccia_giu:
    .string "^[[B"

Freccia_giu_len:
    .long . - Freccia_giu

_start:

# write the first string
    movl $4, %eax 
    movl $1 ,%ebx
    movl $Menu, %ecx
    mov Menu_len, %edx
    int $0x80

# interupt call to save the down arrow in a
    rileva_freccia:
        # get down arrow
        movl $3, %eax
        movl $0 ,%ebx
        movl $a, %ecx        
        movl $255, %edx
        int $0x80
        movb $0, (%ecx, %eax, 1)

    # verifiy down arrow
    movl $a, %ecx
    movl $Freccia_giu ,%ebx
    cmp %ebx ,%ecx
    jne sbaglio
    je fine

#non equity lable
sbaglio:
    movl $4, %eax 
    movl $1 ,%ebx
    movl $Check_Olio, %ecx
    mov Check_Olio_len, %edx
    int $0x80
    movl $4, %eax 
    movl $1 ,%ebx
    movl $a, %ecx
    mov $256, %edx
    int $0x80
    
fine:
    movl $4, %eax 
    movl $1 ,%ebx
    movl $Setting_Automobile, %ecx
    mov Setting_Automobile_len, %edx
    int $0x80
0

There are 0 best solutions below