What Is the Computer's Basic Language?

What Is the Computer's Basic Language? thumbnail
Assembly is the most fundamental computer language.

Computer programs are written in a wide variety of languages depending upon the resources available to the computer itself and upon the needs of the programmers themselves. However, there is only one language natively understood by a given processor, and these languages are collectively known as assembly.

  1. The Most Basic Language

    • In assembly language, each command relates to an operation that can be performed directly by the computer's hardware with no further interpretation required. For this reason, the programming structures available for assembly languages are defined more by the capabilities of the hardware and what commands can be cheaply implemented, and not by what programmers would find easiest or the most natural to work with.

    Common Assembly Languages

    • The most common assembly language for personal computers by far is the language used by Intel's X86 line of computer processors. Nearly all consumer personal computers contain processors either produced by Intel or deliberately designed to be compatible with Intel's X86 assembly. However, there are exceptions. Sun Microsystems produces Solaris workstations that use SPARC assembly, many video game consoles and older Apple computers use IBM's PowerPC assembly, and small computing devices like smart phones and PDAs commonly use ARM.

    CISC and RISC

    • Assembly languages can be divided into two design philosophies: Complex Instruction Set Computing (CISC) and Reduced Instruction Set Computing (RISC). RISC languages have fewer instructions. This means an assembly program must be longer to achieve the same task, but each individual instruction can execute more quickly. Examples of RISC languages include ARM, PowerPC, and SPARC. CISC languages take the opposite approach: they have more instructions, allowing programmers to achieve more with each instruction. X86 is an example of a CISC architecture.

    Example of Assembly

    • This is a relatively simple assembly program in X86 that prints a short message to the screen.

      .model small
      .stack
      .data
      message db "Hello world, I'm learning Assembly !!!", "$"

      .code

      main proc
      mov ax,seg message
      mov ds,ax

      mov ah,09
      lea dx,message
      int 21h

      mov ax,4c00h
      int 21h
      main endp
      end main

    Advantages of Direct Use

    • Because assembly instructions correlate directly to the operations performed by the machine, efficiently written assembly programs will run a given program in the fastest possible way.

    Advantages of Higher-Level Languages

    • Assembly has some profound disadvantages as well. While assembly can theoretically produce the fastest code possible, in practice the automated optimization provided by higher-level languages like C++ will outperform the optimization efforts of most programmers. Assembly programs also tend to be extremely complex compared to their equivalents in Java or C. For example, the following C program achieves the same result as the assembly program above:

      cout << "Hello world, C is much easier than Assembly!"

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured