Thursday, April 07, 2011



PC Interfacing - Introduction Computers and Programming


Machine Language

The machine language (also known as machine code or native code) is a system of instructions for a specific processor or a data processing system which can be run without compilation process.
In contrast to assembly language or high level language , it is very hard for us to understand the   code , It can be read only by experts and usually they will try to understand machine code with the help of special programs which is called machine language monitors . 
 The machine code is usually generated from assembler or compiler from other programming languages.  Machine language can be programmed directly which means no assembler for the target processor is needed.
Normally if we want to program a processor we need an assembler to translate our program from a text file assembly program into binary machine instructions.
For the execution and translation of machine code on unsuitable processors, we can use emulators .

Assembly Language

An assembly language is a special programming language , which is written in a human readable form for a specific processor. Each computer architecture has its own assembly language.
program in assembly language is also known as assembler code. It has a special compiler or also known as assembler. It converts the assembly language directly to executable machine language. The process to convert back the machine code to human-readable assembly code is called disassembly . However after this process some information such as identifiers and comments could not be recovered, as this information already lost during compiling process and it makes us difficult to understand the program.
When we program a computer in assembly language, the full range of computer hardware and chip program can be directly exploited. It is because assembly language programs works very well since they are often much smaller and faster than higher level programs that have a similar degree of complexity.  Nowadays assembly language is rarely used, unless the programs are very critical (for example, the programming for device drivers of graphics cards ) or completely new technologies whereby the high-level language libraries are still not exist. In principle, nowadays most machines use high-level programming.  Other disadvantage of assembly code is there are higher error rate (due to the complexity.


High Level Language

A high-level programming is a programming language , which allows the writing of a computer program in an abstract language (it is understandable for humans).
The first computers were using programs in machine code instruction. This is merely a sequence of numbers. The processors will interpret the sequence of commands. These commands consist of simple instructions such as arithmetic, memory access, etc. The first innovation was the invention of assembly languages ​​. It is not abstract, but the command is represented in text form.

In the end of 1950 , computer was so powerful that translation software programs could significantly facilitate the input. Fortran , Algol , and Lisp was the first generation of high level languages:
§  Fortran - FOR mula TRAN slation = formula translation
§  ALGOL - ALGO rithmic L anguage = language algorithms
§  LISP - LIS t P rocessing for list processing
These first generation of higher-level languages ​​contain abstract elements such as conditional statements ("if X is true, then do y") and loops ("while x, leads from y"). This make the program are more readable.

Most "modern" programming languages ​​( BASIC , C , C + + , C # , Pascal - known by the IDE Borland Delphi and Lazarus IDE - and Java ) are the languages ​​of the third generation .

Comparison between assembly language and high – level language
High-level programming
Assembly language
Syntax often adapted to human ways of thinking
Space-saving, highly compressed syntax
Mostly machine-independent
Only on a particular type of processor running
Loss of speed through abstraction (trend)
Machine-oriented commands increase the speed
Abstract, machine-independent data types (integer, float, ...)
Data types of the processor ( byte , word , long word)
Several control structures ( if , while ,...)
Jump instructions, macros
Data structures (field record)
Only simple types
Extensive semantic analysis is possible
Only basic semantic analysis is possible
Example:
  A: = 2; FOR I: = 1 TO 20 LOOP A: = A * I; END LOOP; PRINT (A);
Example:
      . ST ST START: MOV R1, # 2 MOV R2, # 1 M1: CMP R2, # 20 BGT M2 MUL R1, R2, R2 JMP INI M1 M2. JSR PRINT END

Borland C++ Builder

C++Builder is Borland’s hot new rapid application development (RAD) product for writing C++ applications.
With C++Builder you can write C++ Windows programs more quickly and more easily than was ever possible before. You can create Win32 console applications or Win32 GUI (graphical user interface) programs.
When creating Win32 GUI applications with C++Builder, you have all the power of C++ wrapped up in a RAD environment. What this means is that you can create the user interface to a program (the user interface means the menus, dialog boxes, main window, and so on) using drag-and drop techniques for true rapid application development.
You can also drop OCX controls on forms to create specialized programs such as Web browsers in a matter of minutes.
C++Builder gives you all of this, but you don’t sacrifice program execution speed because you still have the power that the C++ language offers you.

Object Oriented programming (OOP)

OOP is a new technique in software development. By emphasizing software reusability in program coding, OOP has the potential of increasing programmer productivity while reducing the cost of software maintenance. It does this by treating data as objects capable of manipulating themselves and gives great importance to relationships between objects.
C++ is one of the widely-used OOP languages today. C++ provides classes for declaring objects. In fact, before it was called C++ this programming language was called C with classes.

No comments: