System Programming
Week 1By Ayesha Durrani
Prerequisites for Course
• Computer Architecture• Deep understanding of Assembly language• Basic Number Systems– Binary, Hexadecimal, Decimal and Octal
System programming
• System programming (or systems programming) is the activity of Computer Programming System Software.
• Application programming: aims to produce software which provides services to the user e.g. MS office
• System Programming: aims to produce software which provides services to the computer hardware
Application Software Vs System Software (1)
• Application software: helps users solve particular problems
• In most cases, application software resides on the computer’s hard disk
• Application software includes packaged software such as word processing, spreadsheet, database, and programming languages such as BASIC, COBOL, C, Visual Basic etc.
Application Software Vs System Software (2)
• Systems software– Controls operations of computer hardware– E.g. Operating systems– Operating system (OS): set of programs that
controls the computer hardware and acts as an interface with application programs
– interface between the application program and the hardware.
Data Representation (1)
• Each numbering format, or system, has a base, or maximum number of symbols that can be
assigned to a single digit.
Binary Integers
Binary Integers Binary numbers are base 2 numbers, in which each
binary digit (called a bit) is either 0 or 1 Bits are numbered sequentially starting at zero on
the right side and increasing toward the left. most significant bit (MSB), vs least significant bit
(LSB).
Translating Binary Integers to Decimal
• For example, binary 00001001 is equal to 9. We calculate this value by leaving out terms equal to zero:
• The same calculation is shown by the following figure:
Translating Decimal Integers to Binary
• repeatedly divide decimal integer by 2• Save each remainder as a binary digit.• translate decimal 37 to binary• The remainder digits, starting from the top
row, are the binary digits• Example next slide
Example
• binary of 37 is 100101== 00100101 ?
Integer Storage Sizes• basic storage unit for all data in an x86
computer is a byte.• Other storage sizes are:• Word (2 bytes), • doubleword (4 bytes),• and quadword (8 bytes).
Large Measurements of Storage
• One kilobyte=210, or 1024 bytes.• One megabyte (1 MByte)=220 bytes.• One gigabyte (1 Gbyte) = 230bytes.• One terabyte (1 Tbyte) = 240 bytes• One petabyte = 250 bytes
• One exabyte=260 bytes• One zettabyte =270 bytes• One yottabyte = 280 bytes
Hexadecimal Integers
• Why Hexadecimal Integers??• Large binary numbers are difficult to read• hexadecimal digits offer a convenient way to represent binary data.• Each digit in a hexadecimal integer represents
four binary bits called nibble• Base is 16
Binary, Decimal, and Hexadecimal Equivalents
Practice Exercise
• Convert the following binary to Hexadecimal• 01101010011110010100??
Converting Hexadecimal to Decimal
• hexadecimal 3BA4 is equal to:• (3 x 163) + (11 x 162) + (10 x 161) (4 x 160), • or decimal 15,268.
Converting Decimal to Hexadecimal
• To convert a decimal integer to hexadecimal, repeatedly divide the decimal value by 16
• retain each remainder as a hexadecimal digit.• Example 422 can be converted as:
• Result: 1A616
Practice Exercise
Q1: What is the decimal representation of each of the following unsigned binary integers?
• 11111000• 11001010• 11110000Q2 What is the sum of each pair of binary integers?• 00001111 + 00000010• 11010101 + 01101011• 00001111 + 00001111
Practice Exercise
Q3: What is the binary representation of the following hexadecimal numbers?
• E5B6AED7• B697C7A1• 234B6D92Q4: What is the unsigned decimal representation of each
hexadecimal integer?• 62• 1C9• 6A5B
Boolean Operations
• A boolean expression involves a boolean operator and one or more operands.
• Each boolean expression implies a value of true or false.
• The set of operators includes the following: NOT: notated as ¬ or ~ AND: notated as ∧ OR: notated as ∨
NOT operator
• The NOT operator is unary, and the other operators are binary.
• The NOT operation reverses a boolean value• written in mathematical notation as ¬ X,• The following truth table shows all the
possible outcomes:
AND operation
• AND: The Boolean AND operation requires two operands:
• expressed using the notation X Y∧
OR operation
• OR The Boolean OR operation requires two operands:
• expressed using the notation X Y.∨
Practice Exercise
Q1: Create a truth table for the boolean function described by ¬ (A ∨ Β).
Q2: Create a truth table for the boolean function described by ( ¬ A ∧ ¬ B).
• End lecture 01