Copy-CMP 212 LECTURE NOTE
Copy-CMP 212 LECTURE NOTE
✓Machine Language
✓Low Level Language
✓High level Language
MACHINE LANGUAGE
Any computer can directly understand its own machine language.
• It is time consuming
• It is very tedious to write
• It is subject to human error
LOW LEVEL LANGUAGE
Machine Language were simply too slow and tedious for most
programmers. Instead of using strings of numbers that computers
could directly understand, programmers began using English like
abbreviations to represent elementary operations. These
abbreviations form the basis of Low Level Language. In low level
language, instructions are coded using mnemonics. E.g. DIV, ADD,
SUB, MOV.
LOW LEVEL LANGUAGE
• Although, low level language codes are clearer to humans, they are incomprehensible
to computers until they are translated to machine language
HIGH LEVEL LANGUAGE
Computers usage increased rapidly with the advent of assembly
languages, but programmers still had to use many instructions to
accomplish even the simplest tasks. To speed up the programming
process, high level language were developed in which simple statements
could be written to accomplish substantial tasks. Translator programs
called compilers convert high level language programs into machine
language. High level language allows programmers to write instructions
that look almost like everyday English and contain commonly used
mathematical notations.
HIGH LEVEL LANGUAGE
The binary numbering system works just like the decimal numbering
system, with two exceptions: binary only allows the digits 0 and 1
(rather than 0-9), and binary uses powers of two rather than powers
of ten. Therefore, it is very easy to convert a binary number to
decimal. For each "1" in the binary string, add in 2**n where "n" is
the zero-based position of the binary digit.
THE OCTAL NUMBERING SYSTEM
need to perform over and over again, you should take a few minutes and
memorize the table below. Even if you have a calculator that will do the
conversion for you, you'll find manual conversion to be a lot faster and
• Sign-magnitude is the simplest method for representing signed binary numbers. One bit (by
universal convention, the highest order or leftmost bit) is the sign bit, indicating positive or
negative, and the remaining bits are the absolute value of the binary integer. Sign-magnitude is
simple for representing binary numbers, but has the drawbacks of two different zeros and much
more complicates (and therefore, slower) hardware for performing addition, subtraction, and
any binary integer operations other than complement (which only requires a sign bit change). In
sign magnitude, the sign bit for positive is represented by 0 and the sign bit for negative is
represented by 1.
MODES OF DATA REPRESENTATION
• Examples: 1.
• Convert +52 to binary using an 8 bits machine
• Answer: The binary equivalence of 52 is 110100 but 0 is used to represent
positive magnitude, hence 0 is added to the front of this binary equivalence. This
makes a total of 7bits, since we are working on an eight bit machine, we have to
pad the numbers with 0 so as to make it a total of 8bits. Thus the binary
equivalence 0f 52 is 00110100.
MODES OF DATA REPRESENTATION
• 1’s COMPLEMENT: The 1’s complement form of any binary number is simply
by changing each 0 in the number to a 1 and vice versa.
+ 00100
01101