Microprocessor and Microcontroller Lab 9 | Read Now

Microprocessor and Microcontroller Lab 9

9] Design and devlop an assembly program to display messages ‘FIRE’ and ‘HELP’ alternately with flickering effects on a 7-segment display interface for a suitable period of time. Ensure a flashing rate that makes it easy to read both the messages( Examiner does not specify these delay values nor is it necessary for the student to compute these values).


9] Program code (lab9.asm)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
.model small
.stack 64
.data
pa equ 0e880h
pb equ 0e881h
pc equ 0e882h
ctrl equ 0e883h
fire db 71h,11h,0ah,61h
help db 91h,61h,0e3h,31h
msg db 'press any key on kbd to return to dos','$'
.code
mov ax,@data
mov ds,ax
mov al,90h
mov dx,ctrl
out dx,al
mov ah,09h
lea dx,msg
int 21h
again:lea bp,fire
call disp
call delay
lea bp,help
call disp
call delay
mov ah,6h
mov dl,0ffh
int 21h
jz again
mov ah,4ch
int 21h
delay proc
mov ax,08fffh
agn1:mov cx,05fffh
agn:loop agn
dec ax
jnz agn1
ret
delay endp
disp proc
mov si,3
nxtchr:mov ah,8
mov al,ds:[bp+si]
nxtseg:mov dx,pb
out dx,al
mov ch,al
mov al,0
mov dx,pc
out dx,al
mov al,0f0h
out dx,al
dec ah
jz below
mov al,ch
ror al,1
jmp nxtseg
below: dec si
cmp si,-1
jne nxtchr
ret
disp endp
end
.model small .stack 64 .data pa equ 0e880h pb equ 0e881h pc equ 0e882h ctrl equ 0e883h fire db 71h,11h,0ah,61h help db 91h,61h,0e3h,31h msg db 'press any key on kbd to return to dos','$' .code mov ax,@data mov ds,ax mov al,90h mov dx,ctrl out dx,al mov ah,09h lea dx,msg int 21h again:lea bp,fire call disp call delay lea bp,help call disp call delay mov ah,6h mov dl,0ffh int 21h jz again mov ah,4ch int 21h delay proc mov ax,08fffh agn1:mov cx,05fffh agn:loop agn dec ax jnz agn1 ret delay endp disp proc mov si,3 nxtchr:mov ah,8 mov al,ds:[bp+si] nxtseg:mov dx,pb out dx,al mov ch,al mov al,0 mov dx,pc out dx,al mov al,0f0h out dx,al dec ah jz below mov al,ch ror al,1 jmp nxtseg below: dec si cmp si,-1 jne nxtchr ret disp endp end
.model small
.stack 64
.data
pa equ 0e880h
pb equ 0e881h
pc equ 0e882h
ctrl equ 0e883h

fire db 71h,11h,0ah,61h
help db 91h,61h,0e3h,31h
msg db 'press any key on kbd to return to dos','$'

.code
mov ax,@data
mov ds,ax
mov al,90h
mov dx,ctrl
out dx,al
mov ah,09h
lea dx,msg
int 21h

again:lea bp,fire
      call disp
      call delay

      lea bp,help
      call disp
      call delay

      mov ah,6h
      mov dl,0ffh
      int 21h
      jz again
      mov ah,4ch
      int 21h
      delay proc
      mov ax,08fffh

 agn1:mov cx,05fffh

 agn:loop agn
     dec ax
     jnz agn1
     ret
     delay endp
     disp proc
     mov si,3

nxtchr:mov ah,8
       mov al,ds:[bp+si]

nxtseg:mov dx,pb
       out dx,al
       mov ch,al
       mov al,0

       mov dx,pc
       out dx,al
       mov al,0f0h
       out dx,al
       dec ah
       jz below
       mov al,ch
       ror al,1
       jmp nxtseg

below:  dec si
        cmp si,-1
        jne nxtchr
        ret
        disp endp
        end

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp Icon Join For Job Alerts