Basics of Assembly language : Part 1

Basics of Assembly language

1- Number System

Virtual Machine Concept in Assembly Languages:

Levels of instructions

level 1:

level 2:

level 3:

level 4:

Binary Integers:

  • Binary Integers can be signed or unsigned
  • Signed Integers can be either positive or negative
  • An unsigned integer is by default positive
  • Zero is considered positive<
  • Dots can be inserted after every four binary integers for readability

Translating Unsigned Binary Integers to Decimal:

Translating Unsigned Decimals Integers to Binary:

Binary Addition:

Integer Storage Sizes (Data types):

  • Byte 8bit
  • Word 16bit
  • Double Word 32bit
  • Quad Word 64bit

Hexadecimal Addition:

Signed Binary Integers

Two’s-Complement Representation

Hexadecimal Two’s-Complement:

Converting Signed Binary to Decimal:

  • Step 1: Reverse the bits 00001111
  • Step 2: Add 1 to the value from above step 00001111 + 1
  • Step 3: Create the two’s complement00010000
  • Step 4: Convert to decimal =16

Coverting Signed Decimal to Binary:

  • First, Convert The decimal integer to Binary
  • If original Decimal was negative create two’s complement of the binary number from previous conversion
  • 43 in Binary is 00101011.
  • As the original value is negative we take two’s complement of its binary which will be 11010101.That is how -43 will be represented.

Converting Signed Decimal to Hexadecimal:

  • Convert the absolute Decimal value to Hexadecimal.
  • If original decimal was negative take two’s complement of its hexadecimal equivalent.

Converting Signed Hexadecimal to Decimal:

  • If the giver hexadecimal number is negative, take its two’s complement ,otherwise retain the original number
  • Convert it to decimal after the earlier step.
  • if original value was negative add minus sign to it.

Binary Subtraction:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

I am a Cyber Security Engineer(currently studying) and a technology enthusiast.Looking forward to engage with the Medium community and share knowledge!