#include<stdio.h>
#include<string.h>
#include<conio.h>
void chk_label();
void chk_opcode();
void READ_LINE();
struct optab
{
char code[10],objcode[10];
}myoptab[3]={
{ "LDA" , "00" },
{ "JMP" , "01" },
{ "STA" , "02" }
};
struct symtab{
char symbol[10];
int addr;
}mysymtab[10];
int startaddr,locctr,symcount=0,length;
char line[20],label[8],opcode[8],operand
[8],programname[10];
/*ASSEMBLER PASS 1 */
void PASS1()
{
FILE
*input,*inter;
input= fopen
( "input.txt" , "r" );
inter= fopen ( "inter.txt" , "w" );
printf( "LOCATION LABEL\tOPERAND\tOPCODE
\n" );
printf
( "_____________________________________" );
fgets(line,20,input);
READ_LINE();
if (! strcmp(opcode, "START" ))
{
startaddr= atoi (operand);
locctr=startaddr;
strcpy(programname,label);
fprintf(inter, "%s" ,line);
fgets (line,20,input);
}
else
{
programname[0]= '\0' ;
startaddr=0;
locctr=0;
}
printf ( "\n %d\t %s\t%s\t
%s" ,locctr,label,opcode,operand);
while ( strcmp(line, "END" )!=0)
{
READ_LINE();
printf( "\n %d\t %s \t%s\t
%s" ,locctr,label,opcode,operand);
if (label[0]!= '\0' )chk_label
();
chk_opcode();
fprintf(inter, "%s %s %s
\n" ,label,opcode,operand);
fgets (line,20,input);
}
printf( "\n %d\t\t
%s" ,locctr,line);
fprintf(inter, "%s" ,line);
fclose (inter);
fclose (input);
}
/*Assesmbler pass 2 */
void PASS2()
{
FILE *inter,*output;
char record[30],part[8],value[5]; /*Part
array was defined as part[6] previously*/
int
currtxtlen=0,foundopcode,foundoperand,chk,operandaddr,recaddr=0;
inter= fopen ( "inter.txt" , "r" );
output= fopen( "output.txt" , "w" );
fgets(line,20,inter);
READ_LINE();
if (! strcmp(opcode, "START" )) fgets
(line,20,inter);
printf( "\n\nCorresponding Object code
is..\n" );
printf( "\nH^ %s ^ %d ^ %d
" ,programname,startaddr,length);
fprintf(output, "\nH^ %s ^ %d ^ %d
" ,programname,startaddr,length);
recaddr=startaddr; record[0]= '\0' ;
while( strcmp(line, "END" )!=0)
{
operandaddr=foundoperand=foundopcode=0;
value[0]=part[0]= '\0' ;
READ_LINE();
for (chk=0;chk<3;chk++)
{
if (! strcmp (opcode,myoptab
[chk].code))
{
foundopcode=1;
strcpy(part,myoptab
[chk].objcode);
if (operand[0]!= '\0' )
{
for (chk=0;chk<symcount;chk++)
if (! strcmp(mysymtab
[chk].symbol,operand))
{
itoa(mysymtab
[chk].addr,value,10);
strcat(part,value);
foundoperand=1;
}
if (!foundoperand) strcat
(part, "err" );
}
}
}
if (!foundopcode)
{
if ( strcmp(opcode, "BYTE" )==0 ||
strcmp(opcode, "WORD" )|| strcmp
(opcode, "RESB" ))
{
strcat(part,operand);
}
}
if ((currtxtlen+ strlen (part))<=8)
/*This step was having buffer overflow issue
since part[6]
was defined previously which i corrected to
part[8].
Because of this first two bytes of stack are
getting lost*/
{
strcat(record, "^" );
strcat(record,part);
currtxtlen+= strlen(part);
}
else
{
printf ( "\nT^ %d ^%d
%s" ,recaddr,currtxtlen,record);
fprintf(output, "\nT^ %d ^%d
%s" ,recaddr,currtxtlen,record);
recaddr+=currtxtlen;
currtxtlen= strlen (part);
strcpy (record,part);
}
fgets (line,20,inter);
}
printf( "\nT^ %d ^%d
%s" ,recaddr,currtxtlen,record);
fprintf(output, "\nT^ %d ^%d
%s" ,recaddr,currtxtlen,record);
printf( "\nE^ %d\n" ,startaddr);
fprintf(output, "\nE^ %d\n" ,startaddr);
fclose(inter);
fclose(output);
}
void READ_LINE()
{
char buff[8],word1[8],word2[8],word3[8];
int i,j=0,count=0;
label[0]=opcode[0]=operand
[0]=word1[0]=word2[0]=word3[0]= '\0' ;
for (i=0;line[i]!= '\0' ;i++)
{
if (line[i]!= ' ' )
buff[j++]=line[i];
else
{
buff[j]= '\0' ;
strcpy(word3,word2);
strcpy(word2,word1);
strcpy(word1,buff);
j=0;
count++;
}
}
buff[j-1]= '\0' ;
strcpy(word3,word2);
strcpy(word2,word1);
strcpy(word1,buff);
switch(count)
{
case 0: strcpy (opcode,word1);
break ;
case 1:{ strcpy (opcode,word2); strcpy
(operand,word1);}
break ;
case 2:{ strcpy (label,word3); strcpy
(opcode,word2); strcpy(operand,word1);}
break ;
}
}
void chk_label()
{
int k,dupsym=0;
for (k=0;k<symcount;k++)
if (! strcmp(label,mysymtab[k].symbol))
{
mysymtab[k].addr=-1;
dupsym=1;
break ;
}
if (!dupsym)
{
strcpy (mysymtab
[symcount].symbol,label);
mysymtab[symcount++].addr=locctr;
}
}
void chk_opcode()
{
int k=0,found=0;
for (k=0;k<3;k++)
if (! strcmp(opcode,myoptab[k].code))
{
locctr+=3;
found=1;
break ;
}
if (!found)
{
if (! strcmp( opcode, "WORD" )) locctr
+=3;
else if (! strcmp
(opcode, "RESW" ))locctr+=(3* atoi (operand));
else if (! strcmp
(opcode, "RESB" ))locctr+= atoi (operand);
}
}
int main()
{
PASS1();
length=locctr-startaddr;
PASS2();
getch();
}
This blog is about the latest achievements in technology. It will provide you with the information of latest trends in technology and various other modern digital fields.
Saturday, 3 January 2015
C++ decleration of a two pass Assembler
Friday, 18 April 2014
ACCESS BLOCKED SITES
ACCESS BLOCKED SITES
It has been a long time ago that in colleges ,schools ,universities and offices that some websites are being blocked for use due to some security issues or because of pornography and social network over crowd.
Now the time had risen up to come over these limitations by some software's or by some tricks.
So that one can easily access the sites whenever he wants and whatever he want to browse or download too.
There are many methods available in tech world by which one can browse the blocked sites .
- SOFTWARES
Many softwares are available in third party software distributors market by which blocked sites can be accessed easily in which some main softwares are BLOCKED SITE ACCESSOR ,HOTSPOT SHIELD,HOLA.
- EXTENSIONS
Many extensions do the same job and some known ones are STEALTHY ,FOX PROXY,FRIGATE .These extensions need to be installed on your browser i had my self checked them to work in GOOGLE CHROME.
- MANUAL PROXY CHANGE
Browse the GOOGLE and see a list of proxies of different countries ,note them down and write them accordingly in your browser proxy settings.Restart your browser and you are done with your proxy change and access your favorite sites.
Many softwares are available in third party software distributors market by which blocked sites can be accessed easily in which some main softwares are BLOCKED SITE ACCESSOR ,HOTSPOT SHIELD,HOLA.
Many extensions do the same job and some known ones are STEALTHY ,FOX PROXY,FRIGATE .These extensions need to be installed on your browser i had my self checked them to work in GOOGLE CHROME.
Browse the GOOGLE and see a list of proxies of different countries ,note them down and write them accordingly in your browser proxy settings.Restart your browser and you are done with your proxy change and access your favorite sites.
NOW USE ANY OF THE ABOVE METHODS AND YOU CAN EASILY BROWSE THE BLOCKED SITES IN YOUR INSTITUTION .
I MYSELF PREFER TO USE THE SOFTWARE ONE AND THE EXTENSION ONE BECAUSE IN A SINGLE CLICK OR A KEYBOARD SHORTCUT YOU CAN CLOSE OR OPEN THEM WHEN YOU DON'T NEED THEM TO WORK AS YOU WILL BE EITHER IN HOME OR YOU WANT TO BROWSE THE SITES THAT ARE NOT BLOCKED AT ALL.
Saturday, 5 April 2014
Samsung's 'wonder material' could make phones super thin, internet 100 times faster'
A group of Samsung Electronics researchers claim they've made a breakthrough discovery.
They've found a technique that could help the company make your future smartphone thinner, more durable, and even a deliver internet 100 times faster.
The "wonder material" is called graphene- a substance that's stronger than steel and so thin it's considered to be two dimensional.
In fact, it's one million times thinner than paper, according to the American Physical Society. Discovered in 2004, graphene is made of a single layer of carbon atoms bonded together in hexagonal patterns.
Samsung's researchers have just discovered a method that could allow a single crystal of graphene to retain its electrical and mechanical properties across a large area, the company said.
In other words, they've found a process that could allow graphene to be used at its full potential in future electronic devices, which could include wearables, smartphones and more. Samsung said graphene will be particularly crucial in developing wearable devices, such as smartwatches and Internet-connected wristbands, The Wall Street Journal reports.
Graphene's electron mobility is said to be 100 times greater than that of silicon, the material most widely used in the components that power many of today's smartphones, tablets and computers. The Korea-based manufacturer hasn't mentioned exactly how the discovery will impact its specific future devices, but described it as "the perfect material for use in flexible displays, wearables and other next generation electronic devices."
So what exactly does this mean for the future gadgets? It will most likely keep the components inside your phone thinner and it could potentially allow for super thin, transparent screens.
Since graphene is so thin, the commercialization of it could usher in the slimmest transistors yet-potentially yielding gadgets that are much sleeker than today's existing smartphones.
Graphene could also bring flexible phones, smartwatches and gadgets to the market if its commercialized on a wide enough scale, as Gigaom reported in July. Since the material is more durable than steel, phones and future gadgets are likely to be way less prone to damage than existing devices.
Graphene is said to deliver Internet to smartphones 100 times faster, according to research from the University of Bath's Department of Physics. This is essentially because graphene can convert light faster than the materials used in today's existing smartphone components. The report explains that data travels in the form of light when it hits your smartphone, so the faster it can convert light the faster data can reach you.
The commercialization of graphene also suggests that we'll see wearable devices that are much different than products on the market today. Instead of somewhat clunky smartwatches and fitness bands without a screen, we could see devices that look much more like the iWatch concept art that's been circulating the Web for months.
It's unclear exactly when we'll see smartphones and wearable based on graphene, but Samsung's discovery marks a huge leap toward bringing it to market. During its Analyst Day in November, the company said it could bring phones that are completely bendable and foldable to market by 2015. Samsung has been showcasing its YOUM flexible displays for quite some time, but it hasn't yet found a way to bring it to market in everyday consumer gadgets. This discovery could possibly change that.
Subscribe to:
Posts (Atom)