# System Programming Lec 01

Post on 06-Dec-2015

215 views

DESCRIPTION

the description about computer programming from Peshawar university.TRANSCRIPT

System Programming Week 1 By Mr. Sadiq Shah Date: 09 Sep 2013System ProgrammingWeek 1By Ayesha DurraniPrerequisites for CourseComputer ArchitectureDeep understanding of Assembly languageBasic Number SystemsBinary, Hexadecimal, Decimal and OctalSystem programmingSystem programming(orsystems programming) is the activity ofComputer Programming System Software.Application programming: aims to produce software which provides services to the user e.g. MS officeSystem Programming: aims to produce software which provides services to thecomputer hardwareApplication Software Vs System Software (1)Application software: helps users solve particular problemsIn most cases, application software resides on the computers hard diskApplication 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 softwareControls operations of computer hardwareE.g. Operating systemsOperating 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 IntegersBinary numbers are base 2 numbers, in which each binary digit (called a bit) is either 0 or 1Bits 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 DecimalFor 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 Binaryrepeatedly divide decimal integer by 2Save each remainder as a binary digit.translate decimal 37 to binaryThe remainder digits, starting from the top row, are the binary digitsExample next slideExample binary of 37 is 100101== 00100101 ?Integer Storage Sizesbasic 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 StorageOne kilobyte=210, or 1024 bytes.One megabyte (1 MByte)=220 bytes.One gigabyte (1 Gbyte) = 230bytes.One terabyte (1 Tbyte) = 240 bytesOne petabyte = 250 bytes One exabyte=260 bytesOne zettabyte =270 bytesOne yottabyte = 280 bytesHexadecimal IntegersWhy Hexadecimal Integers??Large binary numbers are difficult to readhexadecimal digits offer a convenient way to represent binary data.Each digit in a hexadecimal integer represents four binary bits called nibbleBase is 16Binary, Decimal, and Hexadecimal EquivalentsPractice ExerciseConvert the following binary to Hexadecimal01101010011110010100??Converting Hexadecimal to Decimalhexadecimal 3BA4 is equal to:(3 x 163) + (11 x 162) + (10 x 161) (4 x 160), or decimal 15,268.Converting Decimal to HexadecimalTo 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: 1A616Practice ExerciseQ1: What is the decimal representation of each of the following unsigned binary integers?111110001100101011110000Q2 What is the sum of each pair of binary integers?00001111 + 0000001011010101 + 0110101100001111 + 00001111Practice ExerciseQ3: What is the binary representation of the following hexadecimal numbers?E5B6AED7B697C7A1234B6D92Q4: What is the unsigned decimal representation of each hexadecimal integer?621C96A5BBoolean OperationsA 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 operatorThe NOT operator is unary, and the other operators are binary.The NOT operation reverses a boolean valuewritten in mathematical notation as X,The following truth table shows all the possible outcomes:AND operationAND: The Boolean AND operation requires two operands:expressed using the notation X YOR operationOR The Boolean OR operation requires two operands:expressed using the notation X Y.Practice ExerciseQ1: 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