Showing posts with label Microprocessor. Show all posts
Showing posts with label Microprocessor. Show all posts

Wednesday, 28 May 2014

Microprocessor lab external-2

          The program that I had got in interfacing part was an ALP to perform logical XOR operation.The reason for me writing this program is very simple.Later in life whenever I recall microprocessor lab external and if I am not able to recall which program I had got,my blogpost will be there to help me recollect the question as well as the answer.
    Here is the solution for above mentioned question:

Data segment
Pa equ 0e800h
Pb equ 0e801h
Pc equ 0e802h
Cr equ 0e803h
Data ends
Code segment 
Assume cs:code,ds:data
Start:mov ax,data
        Mov ds,ax
        Mov al,082h
        Mov dx,cr
        Out dx,al
Repeat:mov dx,pb
            In al,dx
            And al,03h
            Cmp al,00h
            Jz display
             Cmp al,03h
             Jz display
             Mov al,0ffh
             Mov dx,pa
              Out dx,al
              Jmp repeat
Display:mov al,00h
             Mov dx,pa
             Out dx,Al
              Jmp repeat
Code ends 
End start

Microprocessor lab external-1

       I have already explained in my previous blog post about how my microprocessor lab external was but now I would like to just write the program I had got in the exam so that I can recall easily later whenever necessary.
     The question I had got was : Write an alp to perform block interchange of data.
The solution goes like this :
Data segment 
X db 01h,02h,03h,04h,05h
Y db 11h,12h,13h,14h,15h
Data ends
Code segment
Assume cs:code,ds:data
Start:mov ax,data
         Mov ds,ax
         Mov cx,05h
         Lea si,x
         Lea di,y
Up:mov bl,[si]
      Mov al,[di]
      Mov [si],al
      Mov [di],bl
      Inc cx
      Inc dx
      Dec cx
      Jnz up
      Mov ah,4ch
      Int 21h
Code ends
End start