Implementing Absolute Loader in C++

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();

int data[4],stadd,readd,i;
char ch;

cout<<"Enter starting address\n";
cin>>stadd;

for(i=0;i<4;i++)
{
cout<<"Enter value for byte "<<i<<" : ";
cin>>data[i];
}


do
{
cout<<"\nEnter reloaction address\n";
cin>>readd;

for(i=0;i<4;i++)
{
cout<<"\nValue for "<<readd + i<<" = "<<data[i];
}

cout<<"\nDo you want to continue relocating (Y/N) : ";
cin>>ch;
}

while(ch=='Y');

getch();

}

/* Output

Enter starting address
2224
Enter value for byte 0 : 1000
Enter value for byte 1 : 1001
Enter value for byte 2 : 1010
Enter value for byte 3 : 1110

Enter reloaction address
5231

Value for 5231 = 1000
Value for 5232 = 1001
Value for 5233 = 1010
Value for 5234 = 1110
Do you want to continue relocating (Y/N) : Y

Enter reloaction address
5777

Value for 5777 = 1000
Value for 5778 = 1001
Value for 5779 = 1010
Value for 5780 = 1110
Do you want to continue relocating (Y/N) : N

*/

One thought on “Implementing Absolute Loader in C++”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.