Write X86/64 Assembly Language Program (ALP) to perform Non-Overlapped and Overlapped Block Transfer.

Second Year Computer Engineering Microprocessor programs:

Microprocessor Lab:

Practical 2:

     Write X86/64 Assembly Language Program (ALP) to perform Non-Overlapped and Overlapped Block Transfer.

--------------------------------------------------------------------------------------------------------
%macro print 2
  mov rax,1
  mov rdi,1
  mov rsi,%1
  mov rdx,%2
  syscall
%endmacro


section .data
msg1 db 10,"Source Block",10,13
msg1len equ $-msg1

msg2 db 10,"Destination Block",10,13
msg2len equ $-msg2
space db " "
spacelen equ $-space
srcblk db 10h,20h,30h,40h,50h
count equ 05h


section .bss
ans resb 4
dstblk resb 5


section .text
global _start
_start:

print msg1,msg1len
mov rsi,srcblk
call disp_block
mov rsi,srcblk
mov rdi,dstblk
mov rcx,05
s1: mov al, [rsi]
    mov [rdi],al
    inc rsi
    inc rdi
    loop s1
    print msg2,msg2len
    mov rsi,dstblk
    call disp_block
mov rax,60
syscall


disp_block: mov rbp,count
back: mov al,[rsi]
     push rsi
     call disp_8
     print space,spacelen
     pop rsi
     inc rsi
     dec rbp
     jnz back
     ret


disp_8:
mov rsi,ans
mov bl,al
mov dl,bl
rol dl,04
and dl,0Fh
cmp dl,09h
jbe add30
add dl,07h
add30:add dl,30h
mov [rsi],dl

inc rsi

mov dl,bl
and dl,0Fh
cmp dl,09
jbe add301
add dl,07
add301:add dl,30h
mov [rsi],dl
print  ans,2
ret


--------------------------------------------------------------------------------------------------------


Comments

Popular posts from this blog

Write C++ program to maintain club member‘s information using singly linked list. Store student PRN and Name.

Implement C++ program for expression conversion as infix to postfix and its evaluation using stack.

Write C++ program for simulating job queue. Write functions to add job and delete job from queue.