Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in main.asm when we present the output in Message Box, sometimes the output result is wrong when a character is encrypted to '\0' (NULL char) #43

Closed
MariamGad opened this issue Jan 8, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MariamGad
Copy link
Collaborator

BUG in main.asm

main.asm have a bug: When we present the output in Message Box, sometimes the output result is wrong when a character is encrypted to '\0' (NULL char) because MsgBox prints the string till it find a NULL char.

Failed test cases:

Enter your text: asdfklsjalfkjaslkjfaslkf
Enter 4 keys
Enter Key 1: 1
Enter Key 2: 2
Enter Key 3: 3
Enter Key 4: 4

Program Output:
image

The output result is 4 characters only not 24!

Expected Output:

Encrypted: îٌَF ش-اُd┌قث�نB¤:~≡█|hر

✔️

@MostafaAE
Copy link
Collaborator

MostafaAE commented Jan 9, 2021

Sat 9/1/2021
Me and @MostafaSaad7 collaborated together and solved this bug by replacing every charcater encrypted to NULL char ('\0') by a space char (' ') in copyTeaOut loop in TEA proc.

Updated code:

mov ecx, inputLen
lea ebx, teaOut
lea edx, printString

copyTeaOut:
        
        mov al, [ebx]
        ;if (char == '\0') replace with ' '
        cmp al, 0
        jne putChar
        mov al, ' '

        putChar:
            mov [edx], al

        inc ebx
        inc edx

    LOOP copyTeaOut

@MostafaAE MostafaAE moved this from In progress to Done in Microprocessor course project Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

5 participants