fb7755ff1a01f69e42a95ffbf5f78b2034cae423aa17b209dd

Sunday, 8 January 2012

OPCODE GENERATOR FOR 8085 MICROPROCESSOR.

OPCODE GENERATOR FOR 8085 MICRO PROCESSOR

    Hi Friends!  Its been a long time since my last Post.  When I was trying to convert the Machine Instructions into Opcode I found it very boring and its a Time Sucker.  It is Damn Boring to check word by word and convert it into Opcode.  So I have Created an Application for Generating Opcode for 8085 Microprocessor using C# .NET.  It generates Opcode for the given Assembly Language Instruction through just a single mouse click which can help you to save your time.  

"Opcode is a Machine Readable Instruction for performing a task".

   You can follow the following instructions to install  OPCODE GENERATOR 1.0  for windows.

1.  Click here to download OPCODE GENERATOR 1.0 .

2.  After downloading it, Click RUN.



3.  An installation wizard appears.  Click INSTALL.




4.  Wait few seconds for the installation to complete.



5.  Click on the CLOSE button.

6.  Now fire up the OPCODE GENERATOR 1.0 and Type your instructions.




7.  After typing your instructions click on the GENERATE OPCODE button.  You will get the opcode location once you click that button.

8.  Save your time and spend it in facebook... :)

     The Advantages of OPCODE GENERATOR 1.0 is,

1.  It is not case-sensitive.

2.  Proper spaces is not necessary.

     Since this is the first version of  OPCODE GENERATOR 1.0  ,  there are few drawbacks.  

1.   OPCODE GENERATOR 1.0  cannot understand hexa-decimel number as its 16-bit input.  For Example,  800e is not understood by the compiler whereas 8034 is understood.

     Use this application and leave your comments.  If you find any errors, please do inform me. :)

If the application says: ".NET framework is needed for running the application", please download Microsoft .NET framework 4.0.

Thursday, 4 August 2011

C PROGRAM WITHOUT MAIN( )

        Hi Friends! We all know to write a C program with main function.  How to write a C program without a main function?. Is it possible to do that. Yes there can be a C program without a main function. Here’s the code of the program without a main function…


#include<stdio.h>
#include<conio.h>
#define decode(h,a,r,i,s,z,e)## i##s##r##a
#define begin decode(a,n,i,m,a,t,e)
void begin()
{
printf(” hello “);

getch();
return 0;
}

         Does the above program run without the main function? Yes, the above program runs perfectly fine even without a main function. But how, whats the logic behind it? How can we have a C program working without main?

        Here we are using preprocessor directive #define with arguments to give an impression that the program runs without main. But in reality it runs with a hidden main function.

       The ‘##‘ operator is called the token pasting or token merging operator. That is we can merge two or more characters with it.

NOTE: A Preprocessor is program which processess the source code before compilation.



Look at the 2nd line of program -

#define decode(h,a,r,i,s,z,e) i##s##r##a


        What is the preprocessor doing here. The macro decode(h,a,r,i,s,z,e) is being expanded as “isra” (The ## operator merges i,s,r & a into isra). The logic is when you pass (h,a,r,i,s,z,e) as argument it merges the 4th,5th,3rd & the 2nd characters(tokens).


Now look at the third line of the program -

#define begin decode(a,n,i,m,a,t,e)



         Here the preprocessor replaces the macro “begin” with the expansion decode(a,n,i,m,a,t,e). According to the macro definition in the previous line the argument must be expanded so that the 4th,5th,3rd & the 2nd characters must be merged. In the argument (a,n,i,m,a,t,e) 4th,5th,3rd & the 2nd characters are ‘m’,'a’,'i’ & ‘n’.

       So the third line “int begin” is replaced by “int main” by the preprocessor before the program is passed on for the compiler. That’s it…

      The bottom line is there can never exist a C program without a main function. Here we are just playing a gimmick that makes us beleive the program runs without main function, but actually there exists a hidden main function in the program. Here we are using the proprocessor directive to intelligently replace the word "begin" by “main”. In simple words int begin=int main.

      Thankyou friends for reading this.....