Skip to main content

8086 Assembly Program to Check if String is Palindrome or not

A palindrome is a word, phrase, or sequence that reads the same forward and backward. This 8086 assembly program determines whether a given string is a palindrome by reversing the string and comparing it to the original. The program follows these steps: Initialize the Data Segment: Load the string to be checked. Reverse the String: Store the reversed string in another memory location. Compare the Original and Reversed Strings: Use CMPSB to compare byte-by-byte. Print the Result: Display whether the string is a palindrome or not.

Mix (C++ and Assembly) Program to Find Whether Number is Odd or Even

This C++ program determines whether a given number is even or odd using 8086-style inline assembly. It utilizes the div instruction to divide the number by 2 and then checks the remainder stored in the dx register. #include<iostream.h> #include<conio.h> void main() { clrscr(); int a, res; cout << "\n Enter a number"; cin >> a; asm mov ax, a // Move input number into AX asm mov bx, 02h // Move divisor 2 into BX asm div bx // Divide AX by BX, quotient in AX, remainder in DX asm mov res, dx // Store remainder in res if(res == 0) { cout << "\n Even"; } else { cout << "\n Odd"; } getch(); }

Mix (C++ and Assembly) Program to Find Whether Number is Positive or Negative

This program demonstrates how to use inline 8086 assembly in C++ to determine whether a given number is positive or negative. It's a great way to understand how conditional branching works at the assembly level. #include<iostream.h> #include<conio.h> void main() { clrscr(); int a; cout << "\n Enter a number:"; cin >> a; asm mov ax, 0000h // Clear AX asm mov ax, a // Move user input into AX asm cmp ax, 0000h // Compare AX with 0 asm jl less // Jump to 'less' if AX < 0 asm jge greater // Jump to 'greater' if AX >= 0 less: cout << "\n Number is negative"; asm jmp end greater: cout << "\n Number is positive"; end: getch(); }

Mix (C++ and Assembly) Program to Subtract Two 8 bit Numbers

While modern high-level languages like C++ abstract away many low-level operations, sometimes it's useful to get closer to the hardware to understand how things work under the hood. This example demonstrates how to subtract two 8-bit numbers using inline assembly in a simple C++ program. #include<iostream.h> #include<conio.h> #include<stdio.h> void main() { clrscr(); short int a, b, c; cout << "Enter First Number:"; cin >> a; cout << "Enter Second Number:"; cin >> b; asm mov ax, a // Move 'a' into AX asm mov ah, 00h // Ensure AH is cleared asm mov bx, b // Move 'b' into BX asm mov bh, 00h // Ensure BH is cleared asm sub al, bl // Subtract BL from AL asm mov c, ax // Store result in 'c' cout << "Result:"; cout << c; getch(); }

8086 Assembly Program to Search an Element in an Array

Array search is where assembly starts feeling like real programming — you need a pointer, a counter, a comparison, and a conditional branch, all working together. This program searches a five-element byte array for a target value and prints either “FOUND” or “NOT FOUND” using a reusable MACRO that wraps the DOS print call.

Implementing Socket Programming in Java

Socket programming is the foundation of network communication in Java. A socket is one endpoint of a two-way communication channel between two programs running on a network. Java provides the java.net package with high-level abstractions — ServerSocket for the server side and Socket for the client side — that handle the underlying TCP/IP details so you can focus on reading and writing data streams. This example implements a simple interactive TCP chat between a server and a client. Both sides can send and receive messages. Either side can type Q or q to close the connection gracefully. The server listens on port 5000; the client connects to localhost:5000.

Illustrating Working of Bit-Map Protocol with C++ Program

The Bit-Map Protocol is a contention-free MAC (Medium Access Control) layer protocol used to coordinate which stations are allowed to transmit on a shared channel. Before any data frame is sent, each station broadcasts a single bit during its reserved slot in a contention slot period: a 1 signals that the station has a frame ready to send, while a 0 means the station has nothing to transmit. Once every station has announced its status, transmissions occur in station order, eliminating collisions entirely. This C++ program simulates the Bit-Map Protocol. The user specifies the number of stations and their ready/not-ready status. The program reads each station's status, then announces which stations are ready to transmit in station-number order.