Sie sind auf Seite 1von 15

Computer Architecture

1 Introduction
2 Computer Logic
3 Computer Arithmetic
4 Instruction Set
5 Assembly Language
6 Processing Unit
7 Memory System
8 Input-Output
9 High Performance Computing
Computer Architecture - UPB, FILS, 2008

Opcodes

Assembly is a programming language that gives


the programmer control over the machine code.
The assembly code has DIRECT mapping in the
opcodes (commands in the executable code).

assembler

code binary code

mov AL, 1

B0 01 10110000 00000001

Computer Architecture - UPB, FILS, 2008

Codes for register operands

Register
AL
CL
DL
BL

Code
000
001
010
011

Register
AH
CH
DH
BH

Code
100
101
110
111

Computer Architecture - UPB, FILS, 2008

LEA Instruction

The LEA (Load Effective Address)


instruction and alternative OFFSET
operator are used to get the offset address
of a variable.
LEA is more powerful because it works
also for indexed variables.

Computer Architecture - UPB, FILS, 2008

II. Stack Operations

The stack is a memory space used to store data


in a last in first out manner.
There are two typical instructions that work with
the stack:
PUSH - stores 16 bit word in the stack.
POP - gets 16 bit word from the stack.

PUSH

POP

Computer Architecture - UPB, FILS, 2008

PUSH AX ; store value of AX in stack.


PUSH BX ; store value of BX in stack.
POP AX ; get AX from the stack (former
value of BX)
POP BX ; get BX from the stack (former
value of AX)
PUSH BX

POP AX

PUSH AX

POP BX

Computer Architecture - UPB, FILS, 2008

II. Conversion Operations


cbw, cwd, xlat

Computer Architecture - UPB, FILS, 2008

III. Arithmetic Operations


add, inc sub, dec, cmp, neg, mul, imul,
div, idiv

Computer Architecture - UPB, FILS, 2008

IV. Logic Operations


and, or, xor, not, shl, shr, rcl, rcr

Computer Architecture - UPB, FILS, 2008

V. String Operations
movs, stos, lods

Computer Architecture - UPB, FILS, 2008

10

VI. I/O Operations


in, out

Computer Architecture - UPB, FILS, 2008

11

VII. Flow Control Operations


jmp, call, ret, conditional jumps

Computer Architecture - UPB, FILS, 2008

12

VIII. Other Operations


clc, stc, cmc

Computer Architecture - UPB, FILS, 2008

13

Simple program to add two variables


ORG 100h
; This program adds two numbers
MOV AL, x
MOV BL, y
ADD AL, BL
; ADD AL, y
MOV z, AL
RET

; stops the program.

x DB 1 ; define byte initialized to 1


y DB 2 ; define byte initialized to 2
z DB 0 ; define byte initialized to 0
Computer Architecture - UPB, FILS, 2008

14

Interrupts

INT 10h / AH = 0 - set video mode.


INT 10h / AH = 2 - set cursor position
INT 10h / AH = 05h - select active video
page
INT 10h / AH = 08h - read character and
attribute at cursor position
INT 10h / AH = 09h - write character and
attribute at cursor position
Computer Architecture - UPB, FILS, 2008

15

Das könnte Ihnen auch gefallen