Flag This Hub

vtu microprocessor lab programs

By


PGM TO READ A CHAR FROM THE KEYBOARD IN THE MODULE1 DISPLAY A CHAR IN MODULE2

stack segment
  dw 64 dup(0)
stack ends

data segment
  str db 100 dup(0)
  msg db 0Ah, 0Dh, '$'
data ends

code segment
    assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      extrn scan:far
      extrn display:far
      lea si,str
      mov cl,00h

again:call scan                                                   
      cmp al,0Dh
      je exit
      mov [si],al
      inc si
      inc cl
      jmp again

exit:lea dx,msg
     mov ah,09h
     int 21h
     lea si,str

repeat:cmp cl,00h
       je t1
     
       mov al,[si]
       call display
       inc si
       dec cl
       jmp repeat

t1:mov ah,4ch
   int 21h

  code ends
end start
_

2 (a1) ;READ A CHARACTR FROM THE KEYBOARD

rdkb macro
  mov ah,01h
  int 21h
endm
code segment
    assume cs:code
start:public scan
      scan proc far
      rdkb
      ret
      scan endp
   code ends
end start

2 (a2) ;TO DISPLAY A CHARACTER IN MODULE[2]

echo macro
  mov dl,al
  mov ah,02h 
  int 21h
endm
stack segment
  dw 64 dup(0)
stack ends
code segment
   assume cs:code, ss:stack
start:public display
      display proc far
      echo
      ret
     display endp
  code ends
end start

PROGRAMME TO IMPLEMENT THE BCD UPCOUNTER

data segment
    porta equ 0280h
    cwr equ 0283h
data ends

code segment
   assume cs:code,ds:data
start:    mov ax,data
          mov ds,ax
      
           mov dx,cwr
           mov al,82h
           out dx,al

           mov ah,01h
           int 21h
      
           cmp al,31h
           je up
           jmp down
	    
      up:  mov al,00h
           mov dx,porta

   again:  out dx,al
           inc al
 	   cmp al,0ah
   	   je stop
 	   call delay
 	   jmp again

    down:  mov al,09h
           mov dx,porta
  
    next:   out dx,al
            dec al
	    cmp al,0ffh
            je stop
       	    call delay
	    jmp next

stop:  mov ah,4ch
            int 21h
       
    delay proc
         mov si,0ffffh
         t2: mov di,200h
         t1: dec di
         jnz t1
         dec si
         jnz t2
         ret
    delay endp
 code ends
end start

PROGRAMME TO PERFORM THE RING COUNTER

data segment 
    porta equ 0280h
    cwr equ 0283h
data ends

code segment
   assume cs:code,ds:data
start:	    mov ax,data
            mov ds,ax
     
            mov dx,cwr
            mov al,82h
            out dx,al

      
            mov al,01h
     
            mov cl,08h
            mov dx,porta

    again:  out dx,al
            call delay
            rol al,1
            dec cl
            jnz again


           int 3h

     delay proc
             mov si,0ffffh
        t2:  mov di,200h
        t1:  dec di
             jnz t1
             dec si 
             jnz t2
           ret
     delay endp

  code ends
end start

TO SORT A GIVEN NO IN ASCENDING AND DESCENDING ORDER

data segment
   num1 db 12h,21h,17h,19h 
   num2 db 4 dup(0) 
   num3 db 4 dup(0)
   l1 dw 0004
data ends
code segment
   assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax 
      lea si,num1
      lea di,num2
      lea bx,num3
      mov cx,l1
repeat1:mov al,[si]
       mov [di],al
       mov [bx],al
       inc si
       inc di
       inc bx
       dec cx
       jnz repeat1
       mov bx,l1
       dec bx
outlp1:mov cx,bx
       lea si,num2
inlp1:mov al,[si]
     inc si
     cmp al,[si]
     jb next1
     xchg al,[si]
     mov [si-1],al
next1:dec cx
     jnz inlp1
     dec bx
     jnz outlp1
     mov bx,l1
     dec bx
outlp2:mov cx,bx
       lea si,num3
inlp2:mov al,[si]
      inc si
      cmp al,[si]
      ja next2
      xchg al,[si]
      mov [si-1],al
next2:dec cx
      jnz inlp2
      dec bx
      jnz outlp2
      int 3h
code ends
end start

READ A STATUS OF TWO 8 BITS INPUTS FROM THE LOGIC CONTROLLER X AND Y. DISPLAY X*Y.

data segment
    porta equ 0280h 
    portb equ 0281h
    cwr equ 0283h
data ends

code segment
  assume cs:code, ds:data
start:    mov ax,data
      	  mov ds,ax

          mov dx,cwr 
          mov al,82h
          out dx,al

          mov dx,portb
          in al,dx

          mov bl,al
      
          mov ah,01h
          int 21h

          in al,dx
     	  mul bl
      	  mov cx,ax
      
          mov dx,porta
          out dx,al

          mov ah,01h
          int 21h

          mov al,ch
          out dx,al

          mov ah,4ch
          int 21h

    code ends
end start

READ AN ALPHANUMERIC CHARACTERS AND DISPLAY ITS EQUIVALENT ASCII CODE AT THE CENTRE OF THE SCREEN

stack segment
  dw 64 dup(0)
stack ends

data segment
  str db 'enter the character:$'
data ends

code segment
    assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      lea dx,str
      mov ah,09h
      int 21h
      mov ah,01h
      int 21h
      mov bl,al
      call clrscr
      call curset
      call display
      mov ah,4ch
      int 21h


clrscr proc
  mov cx,0000h
  mov dx,184fh
  mov bh,01h 
  mov al,00h
  mov ah,06h
  int 10h
ret
clrscr endp

curset proc
  push ax 
  push bx
  push dx
  mov bh,00h
  mov bh,02h
mov dl,38
  mov dh,12
  int 10h
  pop dx
  pop bx
  pop ax
ret
curset endp


display proc
  mov al,bl
  mov cl,04h
  shr al,cl
  cmp al,09h
  jb t1
  add al,07h

t1:add al,30h
   mov dl,al
   mov ah,02h
   int 21h
   mov al,bl
   and al,0fh
   cmp al,09h
   jb t2
   add al,07h

t2:add al,30h
   mov dl,al
   mov ah,02h
   int 21h
ret
display endp

 code ends
end start

DISPLAY MESSAGES FIRE AND HELP ALTERNATELY WITH FLICKERING EFFECTS ON A 7-SEGMENT DISPLAY INTERFACE FOR A SUITABLE PERIOD OF TIME.

data segment
     portb equ 281h
     portc equ 282h
     cwr equ 283h
     num1 db 086h,0ceh,0f9h,8eh
     num2 db 8ch,0c7h,86h,89h
     n dw 04h
data ends

code segment
   assume cs:code,ds:data
start:    mov ax,data
          mov ds,ax

          mov al,80h
          mov dx,cwr
          out dx,al

      

     ne:  lea si,num1
          call display
          
          call delay
          
          lea si,num2
          call display
          
          
          call delay
          
          dec n
          jnz ne         
        

          mov ah,4ch
          int 21h

       
          display proc
               mov di,0004
        
        again: mov al,[si]
               mov bh,08h

         next: rol al,01h
               mov bl,al
               
               mov dx,portb
               out dx,al
               
               mov al,00h
               mov dx,portc
               out dx,al
               mov al,0ffh
               mov dx,portc
               out dx,al
              
               mov al,bl
               dec bh
               jnz next

               inc si
               dec di
               jnz again
               
               ret
        display endp
      delay proc 
               mov si,0ffffh
           t2: mov di,134h
           t1: dec di
              jnz t1
              dec si
              jnz t2
              ret
          delay endp

  code ends
end start

PGM TO REVERSE A GIVEN STRING A CHECK WHEATHER IT IS A PALINDROME OR NOT

stack segment
  dw 64 dup(0)
stack ends

data segment
   str1 db "abcd"
   str2 db 4 dup(0)
   len dw 0004h
   res dw ?
data ends

code segment
       assume cs:code,ss:stack,ds:data
start:mov ax,data
      mov ds,ax
      lea si,str1
      lea di,str2
      add di,len
      dec di
      mov cx,len

again:mov al,[si]
      mov [di],al
      inc si
      dec di
      dec cx
      
jnz again
 
lea si,str1
mov di,si
add di,len
dec di
mov cx,len
shr cx,1

repeat:mov al,[si]
       cmp al,[di]
       jne no
       inc si
       dec di
       dec cx
jnz repeat

mov res,1111h
jmp stop

no:mov res,0000h

stop:int 3h
  code ends
end start

ASSUME ANY SUITABLE MESSAGE OF 12 CHARACTERS LENGHT AND DISPLAY IT IN THE ROLLING FASHION ON A 7-SEGMENT DISPLAY INTERFACE.

data segment
    portb equ 281h
    portc equ 282h
    cwr equ 283h
    num db 0ffh,0ffh,0ffh,0ffh,8ch,0c7h,86h,89h,0f9h,0c0h,0f9h,0c0h
    n dw 04
data ends

code segment
     assume cs:code,ds:data
start:     mov ax,data
	   mov ds,ax

	   mov al,80h
	   mov dx,cwr
	   out dx,al

      

   again1: lea si,num
	   call display
           dec n
	   jnz again1
   

	    mov ah,4ch
	    int 21h

	   
       display proc
		  mov di,0012
    
	   again: mov al,[si]
		  mov bh,08h

	   next:  rol al,01h
		  mov bl,al
		  
		  mov dx,portb
		  out dx,al

		  mov al,00h
		  mov dx,portc 
		  out dx,al
		  mov al,0ffh
		  mov dx,portc     
		  out dx,al
      
		  mov al,bl
		  dec bh
		  jnz next
		  call delay

		  inc si
		  dec di
		  jnz again
    
		    ret
	display endp



	delay proc  
	      push si
	      push di
  
	      mov si,0ffffh
	  t2: mov di,123h
	  t1: dec di
	      jnz t1
	     
	      dec si
	      jnz t2
	    
	     pop di
	     pop si

	    ret
	delay endp


    code ends
end start

PGM TO READ TWO STRINGS,STORED THEM IN LOCATION STR1,STR2.DISPLAY THEIR LENGHTS AND CHECK THEY ARE EQUAL OR NOT

stack segment
  dw 64 dup(0)
stack ends

data segment
  dms1 db 'enter the string1:$'
  msg1 db 20
  len1 db 00
  str1 db 20 dup(0)
  dms2 db 'enter the string2:$'
  msg2 db 20
  len2 db 00
  str2 db 20 dup(0)
  dis1 db 'strings are equal $'
  dis2 db 'strings are not equal $'
  dsl1 db 'length1:$'
  dsl2 db 'length2:$'
  nexl db 0ah,0dh,'$'
data ends

code segment
     assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      lea dx,dms1
      mov ah,09h
      int 21h
      lea dx,msg1
      mov ah,0ah
      int 21h
      lea dx,nexl
      mov ah,09h
      int 21h

      lea dx,dms2  
      mov ah,09h
      int 21h
      lea dx,msg2
      mov ah,0ah
      int 21h
      lea dx,nexl
      mov ah,09h
      int 21h
      lea dx,dsl1
      mov ah,09h
      int 21h  


      mov al,len1
      call display
      lea dx,dsl2
      mov ah,09h
      int 21h
      mov al,len2
    call display
     mov al,len1
     cmp al,len2
     jne exit
     lea si,str1
     lea di,str2
     mov cl,len1

again:mov al,[si]
      cmp al,[di]
      jne exit 
      inc si
      inc di
      dec cl
      jnz again
      lea dx,dis1
      mov ah,09h
      int 21h
      jmp stop

exit:lea dx,dis2
     mov ah,09h
     int 21h

stop:mov ah,4ch
     int 21h

display proc
    aam
    mov cx,ax
    mov dx,cx
    add dh,30h
    mov dl,dh
    mov ah,02h
    int 21h
    mov dx,cx
    add dl,30h
    mov ah,02h
    int 21h
ret
display endp

  code ends
end start

READ YOUR NAME FROM THE KEYBOARD AND DISPLAY IT AT A SPECIFIED LOCATION ON SCREEN

data segment
   msg1 db 20
   len1 db 00
   str1 db 20 dup('$')
   str2 db 0ah,0dh,'$'
   msg2 db 'what is your name?$'
data ends

code segment
   assume cs:code,ds:data
start:      mov ax,data
            mov ds,ax
         
            lea dx,msg1
            mov ah,0ah
            int 21h

            call clrscr
            call curset

            lea dx,msg2
            mov ah,09h
            int 21h
 
            lea dx,str1
            mov ah,09h
            int 21h

            mov ah,01h
            int 21h

            mov ah,4ch
            int 21h


clrscr proc
      mov cx,0000
      mov dx,184fh
            
      mov al,00
      mov bh,01
      mov ah,06h
      int 10h
ret
clrscr endp


curset proc
    mov ah,02h
    mov bh,00h
    mov dh,10h
    mov dl,10h
    int 10h
ret
curset endp

  code ends
end start

A STEPPER MOTOR INTERFACE TO ROTATE THE MOTOR IN CLOCKWISE DIRECTION BY N STEPS.

data segment
   portc equ 282h
   cwr equ 283h
   n equ 10
data ends

code segment
 assume cs:code,ds:data
start:    mov ax,data
          mov ds,ax
      
          mov al,80h
          mov dx,cwr
          out dx,al

          mov dx,portc
          mov al,77h
          mov cx,n

   again: out dx,al
          call delay
          ror al,1
          dec cx
          jnz again
 
          int 3h

         delay proc
                mov si,0ffffh
           t2:  mov di,123h
           t1:  dec di
                jnz t1
                dec si
                jnz t2
                ret
         delay endp

   code ends
end start

PGM TO COMPUTE THE FACTORIAL OF A POSITIVE INTEGER N USING RECURSIVE PROCEDURE

stack segment
  dw 64 dup(0)
stack ends

data segment
  n dw 0004
  res dw 1 dup(0)
data ends

code segment
        assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      mov bx,n
      call fact
      mov res,ax
      int 3h
      
fact proc
     cmp bx,0000
     je exit 
     push bx
     dec bx
     call fact
     pop bx
     mul bx
     ret
 exit:mov ax,0001
     ret
fact endp
  
    
 code ends
end start

DRIVE A STEPPER MOTOR INTERFACE TO ROTATE THE MOTOR IN ANTICLOCKWISE DIRECTION BY N STEPS.

data segment
   portc equ 282h
   cwr equ 283h
   n equ 10
data ends

code segment
 assume cs:code,ds:data
start:    mov ax,data
          mov ds,ax
      
          mov al,80h
          mov dx,cwr
          out dx,al

          mov dx,portc
          mov al,77h
          mov cx,n

   again: out dx,al
          call delay
          rol al,1
          dec cx
          jnz again
 
          int 3h

         delay proc
                mov si,0ffffh
           t2:  mov di,123h
           t1:  dec di
                jnz t1
                dec si
                jnz t2 
                 ret
         delay endp

  
  code ends end start
;PROGRAMME TO COMPUTE NCR USING RECURSIVE PROCEDURE

stack segment
  dw 64 dup(0)
stack ends

data segment
  n dw 0007
  r dw 0004
 ncr dw ?
data ends

code segment
  assume cs:code,ds:data,ss:stack
start:
      mov ax,data
      mov ds,ax
      mov ax,n
      mov bx,r
      call ncrp 
   int 3h

ncrp proc
   cmp ax,bx
   je t1
   cmp bx,0000
   je t1
   cmp bx,0001
   je t2
   dec ax 
   cmp ax,bx
   je t3 
   push ax
   push bx
   call ncrp
   pop bx
   pop ax
   dec bx
   push ax
   push bx
   call ncrp
   pop bx
   pop ax
 ret
  t1:add ncr,0001
    ret
t3:add ncr,0001
t2:add ncr,ax
ret
ncrp endp

code ends
  end start

DRIVE A STEPPER MOTOR INTERFACE TO ROTATE THE MOTOR IN CLOCKWISE AND ANTICLOCKWISE DIRECTION BY N STEPS.

data segment
   portc equ 282h
   cwr equ 283h
   n equ 10
data ends

code segment
 assume cs:code,ds:data
start:    mov ax,data
          mov ds,ax
      
          mov al,80h
          mov dx,cwr
          out dx,al

          mov dx,portc
          mov al,77h
          mov cx,n

   again: out dx,al
          call delay
          ror al,1
          dec cx
          jnz again
   
           mov cx,n

   again1: out dx,al
           call delay
           rol al,1
           dec cx
           jnz again1
 
          int 3h

         delay proc
                mov si,0ffffh
           t2:  mov di,123h
           t1:  dec di
                jnz t1
                dec si
                jnz t2
                ret
         delay endp
  
  code ends
end start

SCAN A 8*3 KEYPAD FOR KEY CLOSURE AND STORE THE CODE OF THE KEY PRESSED ;IN A MEMORY LOCATION OR DISPLAY ON SCREEN.ALSO DISPLAY ROW AND COLUMN ;NUMBERS POF TH

data segment
     cwr equ 283h
     porta equ 280h 
     portc equ 282h
     cod db ?
     rowcol db ?
table db 00h,01h,02h,03h,04h,05h,06h,07h,10h,11h,12h,13h,14h,15h,16h,17h,
      db 20h,21h,22h,23h,24h,25h,26h,27h                              
data ends

code segment
    assume ds:data,cs:code
start:   mov ax,data
         mov ds,ax
        
         mov al,90h
         mov dx,cwr
         out dx,al

again:   mov ch,00h
         mov al,01h
         mov dx,portc
         out dx,al
         call scan
         cmp al,00h
         jne exit
         
         mov ch,08h 
         mov al,02h
         mov dx,portc
         out dx,al
         call scan
         cmp al,00h
         jne exit

         mov ch,10h
         mov al,04h
         mov dx,portc
         out dx,al
         call scan
         cmp al,00
         jne exit
         jmp again

   exit: mov cod,ch
         mov al,ch
         lea bx,table
         xlat
         mov rowcol,al
         int 3h

    
   scan proc
           mov dx,porta
           in al,dx
           mov bh,08h
   
   repeat: ror al,1
           jc yes
           inc ch
           dec bh
           jnz repeat
     
       yes: ret
    scan endp


   code ends
end start

PGM TO FIND OUT WHETHER A GIVEN SUB-STRING IS PRESENT OR NOT IN S MAIN STRING OF CHARACTERS

stack segment
  dw 64 dup(0)
stack ends

data segment
   char db 'yz'
   result dw ?
   l1 dw 0004
data ends

extra segment
  string db 'xyzp'
extra ends

code segment
       assume cs:code,ds:data,ss:stack,es:extra
start:mov ax,data
      mov ds,ax
      mov ax,extra
      mov es,ax
      lea di,string
      mov cx,l1
      mov al,char
      dec cx
repeat:scasw
      je yes
      inc di
      dec cx
   jnz repeat

mov result,0000h
jmp stop

yes:mov result,1111h

stop:int 3h
  code ends
end start

PGM TO GENERATE THE FIRST N FIBONACCI NUMBERS

stack segment
   dw 64 dup(0)
stack ends

data segment
   fib dw 50 dup(0)
   n dw 0010
data ends

code segment
       assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      
      lea si,fib
      mov cx,n
      
      mov ax,0000h
      mov bx,0001h
      
      mov[si],ax 
      
      add si,2 
      
      mov [si],bx
      
      add si,2
      
      sub cx,2
      
      
	
again:cmp cx,0000
       je exit
       mov bx,[si-4]
       add bx,[si-2]
       mov [si],bx
       add si,2
       dec cx
       jnz again

exit:int 3h
   code ends
  end start
stack segment
   dw 64 dup(0)
stack ends

data segment
   fib dw 50 dup(0)
   n dw 0010
data ends

code segment
       assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      
      lea si,fib
      mov cx,n
      
      mov ax,0000h
      mov bx,0001h
      
      mov[si],ax 
      
      add si,2 
      
      mov [si],bx
      
      add si,2
      
      sub cx,2
      
      
	
again:cmp cx,0000
       je exit
       mov bx,[si-4]
       add bx,[si-2]
       mov [si],bx
       add si,2
       dec cx
       jnz again

exit:int 3h
   code ends
  end start

SCAN A 8*3 KEYPAD FOR KEY CLOSURE AND SIMULATE ADD AND SUBTRACT ;OPERATIONS AS IN A CALCULATOR.

data segment
     cwr equ 283h
     porta equ 280h 
     portc equ 282h
     sum db 0
     key db 20 dup(0)
data ends

code segment
  assume ds:data,cs:code
start:   mov ax,data
         mov ds,ax
         mov al,90h
         mov dx,cwr
         out dx,al

         lea si,key
         
again:   cmp  ch,0ah
         je calc
         mov ch,00h
         mov al,01h
         mov dx,portc
         out dx,al
         
         call scan
         cmp al,00h
         jne exit
         mov ch,08h 
         mov al,02h
         mov dx,portc
         out dx,al
         
         call scan
         cmp al,00h
         jne exit

         mov ch,10h
         mov al,04h
         mov dx,portc
         out dx,al
         
         call scan
         
         cmp al,00
         jne exit
         
         jmp again

    exit: cmp ch,[si-1]
          je t3
          mov [si],ch
          inc si

     t3:  jmp again
   calc:  mov [si],ch
          lea si,key
          mov bl,00h

          add bl,[si]
          inc si

   next:  mov al,[si]
          cmp al,0ah
          je stop
          
          cmp al,0bh
          je addition
          
          inc si
          sub bl,[si]
          inc si
          jmp next

addition:inc si
         add bl,[si]
         inc si 
         jmp next
 
  stop:  mov sum,bl
         int 3h

         scan proc
               mov dx,porta
               in al,dx
               mov bh,08h
          repeat:ror al,1
                 jc yes
                 inc ch 
                 dec bh
                 jnz repeat
            yes:ret
          scan endp      

       

   code ends
end start

PGM TO READ A CURRENT TIME FROM THE SYSTEM

stack segment
  dw 64 dup(0)
stack ends

code segment
  assume ss:stack,cs:code
start:mov ah,2ch
      int 21h
      push cx
      mov al,ch
      call display
      mov dl,':'
      mov ah,02h
      int 21h
      pop cx
      mov al,cl
      call display
mov ah,4ch
int 21h


display proc
   aam
   mov cx,ax
   mov dx,cx
   add dh,30h
   mov dl,dh
   mov ah,02h
   int 21h
   mov dx,cx
   add dl,30h
   mov ah,02h
 int 21h
ret
display endp

code ends
end start

PGM TO STIMULATE A DECIMAL UP-COUNTER TO DISPLAY 00-99

stack segment
  dw 64 dup(0)
stack ends

data segment
  x db 00
  count db 100
data ends

code segment
  assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
again:mov ch,x
      call curset
      mov al,ch
      call display
      call delay
      inc x
      dec count
      jnz again
      
   mov ah,4ch
   int 21h
   

display proc
  aam
  mov cx,ax
  mov dx,cx
  add dh,30h
  mov dl,dh
  mov ah,02h
  int 21h
  mov dx,cx
  add dl,30h
  mov ah,02h
  int 21h
ret
display endp


delay proc
     mov si,0100h
  t1:mov di,0ffffh
  t2:dec di
     jnz t2
     dec si
     jnz t1
ret
delay endp


curset proc
   mov ah,02h
   mov bh,00h
   mov dh,15h
   mov dl,20h
   int 10h
ret
curset endp

  
   code ends
end start

PGM TO CREATE A FILE(INPUT FILE)AND TO DELETE AN EXISTING FILE

data segment
   ftbc db 'ac.asm',0
   ftbd db 'eg.asm',0
data ends

code segment
  assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      mov cx,0020h
      lea dx,ftbc
      mov ah,3ch
      int 21h
      lea dx,ftbd
      mov ah,41h
      int 21h
      int 3h
  code ends
end start

DRIVE AN ELEVATOR INTERFACE IN THE WAY TO MOVE AN ELEVATOR FROM GROUND ;TO TOP FLOOR AND TOP TO GROUND FLOOR.

data segment
   pa equ 280h
   cwr equ 283h
data ends
code segment
assume cs:code,ds:data
 start:   mov ax,data
          mov ds,ax
          
          mov al,80h
	  mov dx,cwr
	  out dx,al
	  mov bl,00
  top:  mov al,bl
	  mov dx,pa
	  out dx,al
	  call delay
	  inc bl
	  cmp bl,0ah
	  jb top
 top1:  dec bl
	 mov al,bl
	 out dx,al
	 call delay
	 cmp bl,00h
	 jne top1
	int 3h
 delay proc
  	   push bx
           mov cx,0ffffh
    loop1: mov bx,123h
      t1:  dec bx
	   jnz t1
	   loop loop1
           pop bx
	   ret
       delay endp

  exit: mov ah,4ch
        int 21h

  code ends end start

PGM TO READ A PAIR OF I/P CO-ORDINATES IN BCD

stack segment
  dw 64 dup(0)
stack ends

data segment
  row db ?
  col db ?
data ends

code segment
   assume cs:code,ds:data,ss:stack
start:mov ax,data
      mov ds,ax
      
      call readdigit
      mov row,bl
      
      call readdigit
      mov col,bl
      
      call clearscreen
      
      mov dl,row
      mov dh,col
      
      call curset
      
      mov ah,01h
      int 21h
      
      mov ah,4ch
      int 21h


readdigit proc
  mov ah,01h
int 21h
mov cl,04h
shl al,cl
mov bl,al
mov ah,01h
int 21h
sub al,30h
add bl,al
ret
readdigit endp

clearscreen proc
mov cx,0000
mov dx,184fh
mov al,00
mov bh,01
mov ah,06h
int 10h
ret
clearscreen endp

curset proc
mov ah,02h
mov bh,0h
int 10h
ret
curset endp

 code ends
end start  

Comments

jay em preem 23 months ago

Thats awsome programs.u tnx to each of one ov you. :)

kumar 22 months ago

superb

sharath kumar t k 8 weeks ago

superb sir........... excellent..; bcz of this many of students improve there knowledge...

that's awsome....

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working