Square root of a number (Assembly Language)

; Program to compute squareroot of a number DATA SEGMENT ;INITIALIZE DATA SEGMENT NUM1 DD 125.0 ;INTIALIZE NUM1 ANY DATA. ;WHEN DATA DOUBLE IS DEFINED, DEFINE THE NUMBER WITH DECIMAL RES DD ? ;INITIALIZE RES DATA ENDS ;END OF DATA SEGMENT CODE SEGMENT ;INITIALIZE CODE SEGMENT START: ;START THE CODE ASSUME CS:CODE,DS:DATA ;ASSUMPTION OF CODE AND DATA MOV AX,DATA ;MOVE DATA INTO ACCUMULATOR AX REGISTER … Continue reading Square root of a number (Assembly Language)

Palindrome or Not (Assembly Language)

; Program to check if the given string is a palindrome or not DATA SEGMENT ;INITIALIZE THE DATA SEGMENT STR1 DB “NITIN” ;INITIALIZE THE STRING STR2 DB 5 DUP(?) ;INITIALIZE AN EMPTY STRING OF SAME STRING TO DUPLICATE IT PAL DB 0 ;INITIALIZE PAL AS A FLAG COUNT DW 5 ;INITIALIZE COUNT EQUAL TO STRING LENGHT DATA ENDS ;END OF DATA SEGMENT CODE SEGMENT ;INITIALIZE … Continue reading Palindrome or Not (Assembly Language)

Calculator (Mixed Language Programming)

Problem Definition: Write a mixed language program to function as a calculator. #include <iostream.h> #include <conio.h> void main(){ clrscr(); int a,b,result; int ch; cout<<“Enter two numbers:”; cin>>a>>b; cout<<“1.Add /n 2.Sub /n 3.Mul /n 4.Div”<<endl; cin>>ch; switch(ch){ case 1:{ asm mov ax,a; asm mov bx,b; asm add ax,bx; asm mov result,ax; cout<<“Result:”<<result; break; } case 2:{ asm mov ax,a; asm mov bx,b; asm sub ax,bx; asm … Continue reading Calculator (Mixed Language Programming)

Fibonnaci Sequence of a given number (Assembly Language)

; Program to compute fibonnaci sequence of a given number DATA SEGMENT ;INITIALIZE DATA SEGMENT COUNT DW 0AH ;INITIALIZE COUNT TO 0AH ANY DATA RES DB 10 DUP(?) ;INITIALIZE RESULT DATA ENDS ;END OF DATA SEGMENT CODE SEGMENT ;INTIALIZE CODE SEGMENT START: ;START THE CODE ASSUME CS:CODE,DS:DATA ;ASSUMPTION OF CODE AND DATA MOV AX,DATA ;MOVE DATA INTO THE ACCUMULATOR AX REGISTER MOV DS,AX ;MOVE AX … Continue reading Fibonnaci Sequence of a given number (Assembly Language)