Showing posts with label Assembly Language. Show all posts
Showing posts with label Assembly Language. Show all posts

Friday 29 May 2020

Introduction to Microprocessor

Before you learn any programming language, it is important for one to understand some of the basics about computers and what are the languages that a  computer can understand. Let’s have a view on it. A computer is a collection of hardware components. Let us consider here a few hardware components such as  Microprocessor, RAM, Hard disk,  Motherboard                                                                                      
Out of these and many other hardware components,  the most important or the heart of the computer is the Microprocessoror CPU.

Microprocessor or  CPU:

A microprocessor is an electronic component that is used by a   computer to do its work. It is a   central processing unit on a single integrated circuit chip containing millions of very small components including transistors,  resistors,  and diodes that work together. They are created using a technology called Semiconductor technology.

Semiconductor Technology??

Any device which is made up of transistors is referred to as working in Semiconductor Technology. A transistor is a device that regulates current or voltage flow and acts as a switch or gate for electronic signals. The transistors have three terminals emitter,  base, and collector. There are two types of transistors:
1)NPN transistor.
2)PNP transistor.
TransistorNPN PNP Transistors can only store voltages. There are two levels of voltages: 
Low Voltage referred to as →0V
High Voltage referred to as→5V
If we see the same in Software engineer’s view, he/she looks at the two levels as 
Low level referred to as→0
High level referred to as→1
Therefore, from the perspective of a software engineer, a Microprocessor or CPU can understand combinations of 0 and 1.

Programming Languages

Language is the main medium for communicating between computer systems. A program is a collection of instructions that can be executed by a computer to perform a specific task. There were several programming languages used to communicate with the Computer.
Case-1:
The world’s the first computer was invented in the year 1940’s. During that time the task of a programmer was not simple. For example,    if they wanted the microprocessor to perform any operation then they had to use combinations of 0’s and 1’s. During this time all the programs were written in the language called Machine  Level Language. It is one of the low-level programming languages. The language which machines understand is what called as Machine Level Language.
 Codes written in1940’s so performed
 Addition of two numbers:                              0110110
To perform subtraction of two numbers:        1110111
To perform multiplication of two numbers:    1010101
To perform a division of two numbers:             0100100

The machine-level code was taken as input and given to the microprocessor as the machine understands the binary value code and it gives the output. 
The main advantage of using  Machine language is that there is no need of a translator to translate the code, as the Computer directly can understand. The disadvantage was,  it was difficult for a  programmer to write the code or remember the code in this type of language.

Case-2:
The problem with Machine level code approach was decided to be changed in the year 1950’s. They thought that instead of writing a long sequence of 0’s and 1’s a single instruction can be given. For example, we use, Codes in1950’swritten as 
To perform addition of two numbers: ADD
To perform subtraction of two numbers: SUB
To perform multiplication of two numbers: MUL
To perform division of two numbers: DIV
This approach of writing code is called Assembly  Level  Language. Instead of using numbers like in Machine languages here, we use words or names in English forms.ALLMicroprocessorADDSUBMULDIVOutputAssemblerAn  Assembler is software that takes  Assembly  Level  Language  (ALL)  programs as input and converts it into Machine Level Language (MLL) program.

Case-3:
People always want things to be simple and easier so, in the 1960’s they came up with the next type of language called High-Level Programming Language. High-Level Languages are written in a  form that is close to our human language,  enabling the programmer to just focus on the problem being solved. For example, we use, Codes in1960’swritten as
 To perform addition of two numbers: +
To perform subtraction of two numbers: -
To perform multiplication of two numbers: *
 To perform division of two numbers: / 

A compiler is a software that takes high-level Language (HLL) programs as input and converts it into Machine Level Language (MLL) program.


Tuesday 26 May 2020

Assembly Language

➤Each family of processes has its own set of instructions, the set of instructions are called machine instructions
 ➤A processor understands only machine level language instructions which are strings of ones and zeros however machine level level language is to obscure and complex for use in software development. So coma the low level assembly language is designed for a specific family of processes that represents various instructions and symbolic code and IMO understandable form.

Advantages of Using Assembly Language
 

  1. It allows complex jobs to run in a simpler way.
  2. It is memory efficient, as it requires less memory.
  3. It is faster in speed, as its execution time is less.
  4. It is mainly hardware-oriented.
  5. It requires less instruction to get the result.
  6. It is used for critical jobs.
  7. It is not required to keep track of memory locations.
  8. It is a low-level embedded system.

Disadvantages of Assembly Language

  1. It takes a lot of time and effort to write the code for the same.
  2. It is very complex and difficult to understand.
  3. The syntax is difficult to remember.
  4. It has a lack of portability of program between different computer architectures.
  5. It needs more size or memory of the computer to run the long programs written in Assembly Language.

Syntax of Assembly Language
 

An assembly program can be divided into three sections −
  • The data section,
  • The bss section, 
  • The text section.
The data Section The data section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer size, etc., in this section. The syntax for declaring data section is − section.data
The bss Section The bss section is used for declaring variables. The syntax for declaring bss section is − section.bss
The text section The text section is used for keeping the actual code. This section must begin with the declaration global _start, which tells the kernel where the program execution begins. The syntax for declaring text section is − section.text global _start _start:

Assembler

  • Assembler is a program that converts source code programs written in assembly language into object files in machine language. 
  • Popular assembler has emerged over the year for the Intel family of processor this includes-
➤ TASM (Turbo Assembler from Borland)
➤ NASM (Netwide Assembler for both Window and Linux)
➤ GNU assembler distributed by the free software foundation.
Who should know assembly language?
 There are two primary reasons to learn assembly language: because you want to use it directly, or because you want to understand computers at a fundamental level.
From a practical standpoint, only a relative handful of the world’s engineers and computer scientists actually use assembly language.
The overwhelming majority of software development, including virtually all applications development of any kind, uses high level programming languages, and not assembly code. Some specific areas where assembly language gets used are:
 
    • Firmware
    • Operating systems
    • Device drivers
    • Language design
    • Compiler design
    • Embedded systems
    • Hardware design
    • Advanced cryptography
    • Theoretical computer science
The other reason to learn assembly language is just to gain a better understanding of what is actually going on deep in the guts of a computer.


 Assembly Language is easy to Learn, but hard to master!"

Popular Posts

Categories

AI (31) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (146) C (77) C# (12) C++ (82) Course (67) Coursera (198) Cybersecurity (24) data management (11) Data Science (106) Data Strucures (8) Deep Learning (13) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (20) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (46) Meta (18) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (886) Python Coding Challenge (284) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses