Assembly Language Lesson3 Flashcards
(25 cards)
High-Level
Language
Level 5
* Application-oriented languages
◦ C++, Java, Visual Basic . . .
* Programs compile into assembly language (Level 4)
Operation from High level to machine language
High-level language
program (in C)
| (compiler)
Assembly language program
| (Assembler)
Binary machine language
program
Assembly
Language (level 4)
Level 4
* Instruction mnemonics that have a one-to-one
correspondence to machine language
* Calls functions written at the operating system level
(Level 3)
Operating System level 3
Level 3
* Provides services to Level 4 programs
* Programs translated and run at the instruction set
architecture level (Level 2)
call writelnt
Instruction Set
Architecture (ISA) level 2
Level 2
* Also known as conventional machine language
* Executed by Level 1 (microarchitecture, Level 1)
Microarchitecture
Level 1
* Interprets conventional machine instructions
(Level 2)
* Executed by digital hardware (Level 0)
Digital Logic level 0
Level 0
* CPU, constructed from
oDigital logic gates
oSystem bus
oMemory
* Implemented using bipolar transistors
Functions of the Operating System
Multitasking/multiprogramming
Multithreading
Multiprocessing
Virtual Memory
Graphical user interface (GUI)
Basic Microcomputer
Design
A bus: a group of parallel wires that transfer data
o bus types:
address
data
control
Basic Microcomputer
Design #2
The Address bus holds the addresses of instructions and
data, when the currently executing instruction transfers
data between the CPU and memory.
* The Data bus transfers instructions and data between the
CPU and memory.
* The Control bus uses binary signals to synchronize actions
of all devices attached to the system bus.
Execution Cycle
An instruction is a binary pattern designed inside a microprocessor to perform a specific function.
* The entire group of instructions that a microprocessor supports is called Instruction Set.
* 8086 has more than 20,000 instructions.
Classification of Instruction Set
Data Transfer Instructions: mov, push, pop,…
Arithmetic Instructions: add, sub, inc …
Bit Manipulation Instructions: and, or, xor, ….
Program Execution Transfer Instructions: jmp, call, ret, ….
String Instructions: cmps, movs, rep, …
Processor Control Instructions: stc, clc, wait…
sequence of steps to execute a machine
instruction
An operand can be register, memory location or immediate (ex. mov 5,R0) operand
Fetch
Decode
Fetch operands (not always needed?)
Address calculation?
Execute
Update few status flags: zero, carry, overflow
Store output (not always needed?)
Memory
The memory unit supports two fundamental operations: read and write .
o The read operation reads a previously stored data
o The write operation stores a value in memory.
Both of these operations require an address in memory
Memory
write operation requires specification of the data to be written.
* The read and write signals come from the control bus.
General-Purpose Registers
Registers are high speed storage locations inside the CPU.
Accessing Parts of
Registers
- Use 8-bit name, 16-bit name, or 32-bit name
- Applies to EAX, EBX, ECX, and EDX
Specialized Register Uses
General-Purpose
◦ EAX – accumulator: automatically used by multiplication
and division instructions
◦ ECX – loop counter: contain the loop count value for
iterative instructions
oESI, EDI – index registers: used by high-speed memory
transfer instructions.
Specialized Register Uses #2
EIP – instruction pointer (also called program counter): contains the address of the next
instruction to be executed .
* EFLAGS- a register consists of individual binary bits that control the operation of the CPU or
reflect the outcome of some CPU operation.
o status and control flags
o Each flag is a single binary bit
Status Flags
Status flags record certain information about the most recent arithmetic or logical operation.
26
* Carry
◦ unsigned arithmetic out of range
* Overflow
◦ signed arithmetic out of range
* Sign
◦ result is negative
* Zero
◦ result is zero
* Auxiliary Carry
◦ carry from bit 3 to bit 4
* Parity
◦ sum of 1 bits is an even number
64-Bit General Purpose
Registers
32-bit general purpose registers:
◦ EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D
* 64-bit general purpose registers:
◦ RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15
Adding a
Variable
Declarations
o Identify Code and Data areas (directives)
.data
.code
o Segments (how about .stack)
* Variable declaration (sum)
* DWORD (keyword): size of 32 bits
* No checking in what gets into inside the
variable (not like C/Java)
* Must defined and initialized to zero
Server
a computer program or a piece of software that runs on a device. There is different types of servers, serving different types of servers.
Type of Servers
Common servers:
Database servers:(store and access data)
Email server: (store, forward email)
File servers: (file storaging)
Web server: (store,process and deliver to client web pages)
Game server: (multile players to a play at the same time)
Print server:(print document)
Application servers: (create and store web applications)
Multiple servers can be run on one device.