ICS312 Lecture1

Download Report

Transcript ICS312 Lecture1

ICS 312
Set 2
Microcomputer Systems
Uses of Assembly Language
Programming:






To understand the architecture of computers
Critical code sections in programs written in
other languages for applications such as
Excel.
Drivers for printers, hard disks, etc.
Games
Graphics
Compilers (also critical code sections)
Components







digital circuits
binary digits
cpu
memory circuits
motherboard
expansion slots
peripheral devices
Memory
memory operations
 read
 Write



RAM
ROM





buses
address bus
data bus
control bus
The CPU






external bus
internal bus
ALU
IP
machine language
instruction set
Ports



serial port
parallel port
USB
Instruction Execution





machine
instruction
opcode
operands
fetch-execute
cycle
clock timing
Programming Languages





Machine Language
Assembly Language
assembler
High-Level Languages
compiler
Examples of Pentium instructions:
1. Move a byte from memory to an internal register within the
Pentium.
2.
Add a number encoded in 2 bytes to an internal register.
Typically a single C instruction is transformed by a C compiler
into many assembler or machine code instructions.
Example:
In C:
int x = 5, y = 7, z;
z = x + y;
Equivalent code in assembler
TITLE EXAMPLE FOR ICS 312
.MODEL SMALL
.STACK 100H
; declares the size of the hardware stack
; data
comments begin with semi-colons
.DATA
X
DW 5
Y
DW 7
Z
DW ?
; value is uninitialized
.CODE
MAIN
PROC
; mysterious 2 lines to be explained later
MOV AX,@DATA
MOV DS,AX
; add the numbers
MOV AX, X
; AX has X
ADD AX, Y
; AX has X+Y
MOV Z, AX
; Z = X+Y
; code to end the program
; also to be explained later
MOV AX,4C00H
INT 21H
MAIN ENDP
END MAIN
Textbook Reading (Jones):
Chapter 1.