How to loop back from Z to A in nasm assembly language?

Viewed 127

I have an assignment where I have to input a string and a number, and return string by adding that number to it. I have made a program, but after Z it returns awkward values, because of ascii, I guess. How to correct it?

This is my code-

section .text
global _start         

_start:                  
mov    ecx, len
mov    esi, bang        
mov    edi, tang

loop_here:
lodsb
add al, 02
stosb
loop    loop_here          
cld
rep     movsb

mov     edx,20        
mov     ecx,tang        
mov     ebx,1         
mov     eax,4       
int     0x80      

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

mov     eax,1       
int     0x80     

section .data
bang db 'password' ;source
len equ $-bang
newline db 0xa
len2 equ $ - newline  

section .bss
tang resb 10               
1 Answers
Related