global _start _start : section .text %macro disp_macro 2 mov rax,1 mov rdi,1 mov rsi,%1 mov rdx,%2 syscall %endm disp_macro msg1,len1 mov rsi,sarr l1:mov al,[rsi] push rsi call display disp_macro msg3,len3 pop rsi inc rsi dec byte[cnt] jnz l1 ;displaying over block disp_macro msg2,len2 std mov rsi,sarr mov rdi,sarr add rsi,09 add rdi,13 mov rcx,0Ah; rep movsb ;actual display after overlap mov rsi,sarr l3:mov al,[rsi] push rsi call display disp_macro msg3,len3 pop rsi inc rsi dec byte[cnt1] jnz l3 ;mov rsi,sarr ;mov rdi,sarr ;l4:mov al,[rsi] ;mov [rdi],al ;inc rsi ;dec rdi ;dec byte[cnt2] ;jnz l4 %macro exitm 0 mov rax,60 mov rdi,0 syscall %endm exitm display: mov rsi,disparr+1 mov rcx,02 a2:mov rdx,0 mov rbx,10H div rbx cmp dl,09H jbe a1 add dl,07h a1:add dl,30H mov[rsi],dl dec rsi dec rcx jnz a2 disp_macro disparr,02 ret section .data msg1 db "The Array before overlap is: ",0Ah len1 equ $-msg1 msg3 db "",0Ah len3 equ $-msg3 sarr db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,0Bh,0Ch,0Dh,0Eh,0Fh msg2 db "the array after overlap is ",0Ah len2 equ $-msg2 cnt db 15 cnt1 db 15 cnt2 db 15 section .bss disparr resb 64
To embed this project on your website, copy the following code and paste it into your website's HTML: