[SOLVED] CS

$25

File Name: CS.zip
File Size: 18.84 KB

5/5 - (1 vote)

Introduction to Assembly Language and Operating systems
CHAPTER 1: BASIC CONCEPTS
IRVINE, KIP R. ASSEMBLY LANGUAGE FOR INTEL-BASED COMPUTERS 7/E, 2015.

Copyright By Assignmentchef assignmentchef

IRVINE, KIP R. ASSEMBLY LANGUAGE FOR INTEL-BASED COMPUTERS 7/E, 2015.

Chapter Overview
Welcome to Assembly Language
Virtual Machine Concept
Data Representation
Boolean Operations

Welcome to Assembly Language
Why learn AL?

Device drive and embedded programming
Telephone, security system, video card, sound card, AC control systems etc.
Simulation/Monitoring
Real-time applications dealing with simulation and hardware monitoring require precise timing and responses.
High-level languages do not give programmers exact control over machine code generated by compilers.
Assembly language permits you to precisely specify a programs executable code
Game and real-time apps
Software need to be highly optimized for small code size and fast execution.
Assembly language permits direct access to computer hardware, and code can be hand optimized for speed
Understanding Hardware, OS, and Apps
Assembly language helps you to gain an overall understanding of the interaction between computer hardware, operating systems, and application programs.

Assembly Language Applications
Large application programs rarely coded completely in assembly language
Assembly languagecode would take too much time to write and maintain.
Assembly language is used to optimize certain sections of application programs for speed and to access computer hardware
Some representative types of applications:

Business application for single platform
Hardware device driver
Business application for multiple platforms
Embedded systems & computer games

Virtual Machine Example: JVM
JVM, the main component of Java architecture and the part of JRE. Provides the cross platform functionality to java.
A software process that converts the compiled Java byte code to machine code.
Byte code is an intermediary language between Java source and the host system.

http://en.wikipedia.org/wiki/Java_virtual_machine

Virtual Machine Example: .NET CLR
Common Language Runtime (CLR) is the virtual machine of Microsofts .NET framework, responsible for managing the execution of .NET programs.
A process known as just-in-time (JIT) compilation, the CLR compiles the intermediate language code (CIL) into the machine instructions executed by the computers CPU.

http://en.wikipedia.org/wiki/.NET_Framework

Virtual Machines
Programming Language analogy:

Each computer has a native machine language (language L0) that runs directly on its hardware
A more human-friendly language is usually constructed above machine language, called Language L1
Programs written in L1 can run two different ways:

Interpretation L0 program interprets and executes L1 instructions one by one
Translation L1 program is completely translated into an L0 program, which then runs on the computer hardware

Translating Languages
English: Display the sum of A times B plus C.
C++:cout << (A * B + C);Assembly Language:call WriteIntIntel Machine Language:A1 00000000F7 25 0000000403 05 00000008E8 00500000 one to many one to oneSpecific Machine LevelsHigh-Level LanguageApplication-oriented languagesC++, Java, Pascal, Visual Basic . . .powerful statements that translate into multiple assembly language instructionsPrograms compile into assembly language (Level 4) Assembly LanguageInstruction mnemonics (such as ADD, SUB, and MOV) Have a one-to-one correspondence to machine languagePrograms are translated into Instruction Set Architecture Level – machine language (Level 2)Assembly language programs are translated (assembled) in their entirety into machine language before they begin to executeInstruction Set Architecture (ISA)Also known as conventional machine languageFirst level at which users can write programsThe programs consist of binary values called machine language.Each machine-language instruction is executedDirectly by the computers hardware or by a program embedded in the microprocessor chip called a microprogramExecuted by Level 1 (Digital Logic)Digital Logic HardwareCPU, constructed from digital logic gatesSystem busImplemented using bipolar transistorsnext: Data RepresentationData RepresentationBinary NumbersTranslating between binary and decimalBinary AdditionInteger Storage SizesHexadecimal IntegersTranslating between decimal and hexadecimalHexadecimal subtractionSigned IntegersBinary subtractionCharacter StorageDigits for the Numbering in Hardware and Software ManualsBinary NumbersComputer stores instructions and data in memory as collections of electronic charges on/offDigits are 1 and 0, called bitBits are numbered sequentially starting at zero on the right side and increasing toward the left.MSB most significant bitLSB least significant bit658.unknownBinary NumbersEach digit (bit) is either 1 or 0Each bit represents a power of 2:659.unknownTranslating Binary to DecimalWeighted positional notation shows how to calculate the decimal value of each binary bit:dec = (Dn-1 2n-1) + (Dn-2 2n-2) + … + (D1 21) + (D0 20)D = binary digit, 0 or 1binary 00001001 = decimal 9:(1 23) + (1 20) = 9Translating Binary to DecimalHorner’srule: http://en.wikipedia.org/wiki/Horners_ruledec =((( (Dn-1 2) + Dn-2) 2) + … + D1) 2 + D0 10001001b = 128 +8 +1 = 137ddec =((( (D7 2) + D6) 2) + … + D1) 2 + D0 = ((( (1 2) + 0) 2) + … + 0) 2 + 1Good for code implementationExample: 10010101101b 1197dTranslating Unsigned Decimal to BinaryRepeatedly divide the decimal integer by 2. Each remainder is a binary digit in the translated value:37 = 100101Binary AdditionStarting with the LSB, add each pair of digits, include the carry if present.In Binary:2 represented as 1 0666.unknownInteger Storage SizesWhat is the largest unsigned integer that may be stored in 20 bits?Standard sizes:667.unknownHexadecimal IntegersBinary values are represented in hexadecimal.Translating Binary to HexadecimalEach hexadecimal digit corresponds to 4 binary bits.Example: Translate the binary integer 101101010011110010100 tohexadecimal:Try to separate:0001,0110,1010,0111,1001,0100Converting Hexadecimal to DecimalMultiply each digit by its corresponding power of 16:dec = (D3 163) + (D2 162) + (D1 161) + (D0 160)Hex 1234 equals (1 163) + (2 162) + (3 161) + (4 160), or decimal 4,660. Hex 3BA4 equals (3 163) + (11 162) + (10 161) + (4 160), or decimal 15,268.Horner’srule:(((3 16) + 11) 16) + 10 ) 16) + 4Powers of 16Converting Decimal to Hexadecimaldecimal 422 = 1A6 hexadecimalHexadecimal AdditionDivide the sum of two digits by the number base (16). The quotient becomes the carry value, and the remainder is the sum digit.3628286A4245584B786D80B521 / 16 = 1, rem 5Hexadecimal SubtractionWhen a borrow is required from the digit to the left, add 16 (decimal) to the current digit’s value:16 + 5 = 21Signed IntegersThe highest bit indicates the sign. 1 = negative, 0 = positiveIf the highest digit of a hexadecimal integer is > 7, the value is negative. Examples: 8A, C5, A29D, B1234567
Whats this?

668.unknown

Forming the Twos Complement
Negative numbers are stored in twos complement notation
Represents the additive Inverse

Note that 00000001 + 11111111 = 00000000
Twos Complement operation is reversible. Twos Complement of 11111111 is 00000001

Binary Subtraction
When subtracting A B, convert B to its twos complement
Add A to (B)

0 0 0 0 1 1 0 00 0 0 0 1 1 0 0
0 0 0 0 0 0 1 11 1 1 1 1 1 0 1
0 0 0 0 1 0 0 1

Learn How To Do the Following:
Form the twos complement of a hexadecimal for (-27197d)
Convert signed binary to decimal
Convert signed decimal to binary
Convert signed decimal to hexadecimal
Convert signed hexadecimal to decimal

95C2h+1 95C3h
00001111+1 -16d
(43d 00101011b, 11010100b+1) 11010101b
(2Ah+1 = 2Bh) -43d

Ranges of Signed Integers
The highest bit is reserved for the sign. This limits the range:
10000000 01111111

Character Storage
Character sets : mapping of characters to integers
Standard ASCII(0 127)
ASSCI: American Standard Code for Information Interchange
Unique 7-bit integer is assigned to each character
Extended ASCII (0 255)
The extra bit is used on various computers to create a proprietary character set
IBM use values 128 through 255 represent graphics symbols and Greek characters
ANSI (0 255)
ANSI: American National Standards Institute
The first 128 characters correspond to the letters and symbols on a standard U.S. keyboard.
The second 128 characters represent special characters such as letters in international alphabets, accents, currency symbols, and fractions.
http://en.wikipedia.org/wiki/ASCII

Character Storage
Character sets : mapping of characters to integers
Unicode(0 65,535)
Universal way of defining characters and symbols
Represent a wide variety of international languages in computer software.
Defines codes for characters, symbols, and punctuation used in all major languages
European alphabetic scripts, Middle Eastern right-to-left scripts, and many scripts of Asia
Null-terminated String
It is a string of characters followed by a single byte containing zero.
Array of characters followed by a null byte
The C and C++ languages use null terminated strings, and many DOS and Windows functions require strings to be in this format.

Boolean Algebra
Based on symbolic logic, designed by
http://en.wikipedia.org/wiki/George_Boole
Boolean expressions created from:
NOT, AND, OR

Inverts (reverses) a Boolean value
Truth table for Boolean NOT operator:

Digital gate diagram for NOT:

Truth table for Boolean AND operator:

Digital gate diagram for AND:

Truth table for Boolean OR operator:

Digital gate diagram for OR:

Operator Precedence
Examples showing the order of operations:

Truth Tables (1 of 3)
A Boolean function has one or more Boolean inputs and returns a single Boolean output.
A truth table shows all the inputs and outputs of a Boolean function

Example: X Y

Truth Tables (2 of 3)
Example: X Y

Truth Tables (3 of 3)
Example: (Y S) (X S)

http://en.wikipedia.org/wiki/Multiplexer
Two-input multiplexer

Assembly language helps you learn how software is constructed at the lowest levels
Assembly language has a one-to-one relationship with machine language
Boolean expressions are essential to the design of computer hardware and software

1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0

bit position:

doubleword

CS: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS
$25