Friday, 11 November 2011

Mupi Lab exam open forum

Dear Friends,
Hope u did well in the practical exam..


pls share ur questions ( pgm & Viva) ...

Lets try to find out its answers...

Regards
Jinesh K J





Tuesday, 8 November 2011

Program to check leap year or not

MOV CX,7D4h ;LOAD YEAR TO CX

MOV AX,CX
MOV BX,04h
DIV BX
CMP DX,0000h
JNE L1

MOV AX,CX
MOV BX,64h
DIV BX
CMP DX,0000h
JNE L0

MOV AX,CX
MOV BX,0190h
DIV BX
CMP DX,0000h
JNE L1

L0:MOV [2000H],01h
HLT

L1:MOV [2000H],00H
HLT

Leap year

How to determine whether a year is a leap year? To determine whether a year is a leap year, follow these steps: If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. The year is a leap year (it has 366 days). The year is not a leap year (it has 365 days).

program to rotate the stepper motor 360 degree if the value in memory location 3000h is FF else rotate 360 degree anti clockwise


mov al,80
out 0026,al
l3:mov cx,32
dec cx
l5:mov al,[3000]
cmp al,ff
jz l8
jmp l9
l8:mov si,1050
jmp l10
l9:mov si,1054
l10:mov bl,04
l2:mov al,[si]
out 0020,al
call l1
inc si
dec bl
jnz l2
jmp l7
l1:mov dx,0a03
l4:dec dx
jnz l4
ret
l7:loop l5
jz l6
l6:hlt

Friday, 4 November 2011

prime or not


MOV DI,02H
MOV CX,[2000H]
MOV BX,CX
L1:INC DI
DEC BX
MOV AX,CX
MOV DX,00H
DIV BX
CMP BX,02H
JNZ L4
JMP L5
L4:CMP DX,00H
JNZ L1
L5:CMP DI,CX
JZ L2
JMP L3
L2:MOV [3000H],01H
HLT
L3:MOV [3000H],00H
HLT

program to find LCM


mov bx,[2002h]
mov cx,[2000h]
mov di,[2002h]
dec di
l1: inc di
mov ax,di
 div cx
 cmp dx,00h
jz l5
jnz l1
l5:mov ax,di
div bx
cmp dx,00h
jz l6
jnz l1
l6:mov [4000h],di
hlt