LOGO
Oleh. Junartho Halomoan (juned_new@yahoo.com)
Mikroprosesor dan Antarmuka
Dasar Mikroprosesor Intel 8088
Dasar Sistem Komputer [1]
JUN
Mikroprosesor
Memory I/O
Data Bus Address Bus Control Bus
Dasar Sistem Komputer [2]
Dasar Sistem Komputer [3]
JUN
Dasar Sistem Komputer [4]
Arsitektur Bus ada 3 buah:
Address:
If I/O, a value between 0000H and FFFFH is
issued.
If memory, it depends on the architecture:
20-bits (8086/8088)
24-bits (80286/80386SX)
25-bits (80386SL/SLC/EX)
32-bits (80386DX/80486/Pentium)
36-bits (Pentium Pro/II/III)
Dasar Sistem Komputer [5]
Data:
8-bits (8088)
16-bits (8086/80286/80386SX/SL/SLC/EX)
32-bits (80386DX/80486/Pentium)
64-bits (Pentium/Pro/II/III)
Control:
Most systems have at least 4 control bus
connections (active low).
MRDC (Memory ReaD Control), MWRC, IORC
(I/O Read Control), IOWC (I/O Write Control), .
JUN
Dasar Sistem Komputer [5]
Dasar Sistem Komputer [6]
JUN
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET BHE/S7 MN/MX RD WR M/IO DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 Data Bus GND A14 A13 A12 A11 A10 A9 A8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC A15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET SS0 MN/MX RD WR IO/M DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8088
Konfigurasi Pin 8088 [1]
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET BHE/S7 MN/MX RD WR M/IO DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 INTR: Interrupt Request-Aktif pada saat level high
-Masukan
-Di monitor pada cycle clock terakhir setiap instruksi
NMI: Nonmaskable interrupt
-Positif Edge triggered signal
-Masukan
-Tidak dapat di-masked (enable/disable) secara s/w
Konfigurasi Pin 8088 [2]
JUN
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET BHE/S7 MN/MX RD WR M/IO DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 Clock
- Mikroprosesor membutuhkan clock untuk sinkronisasi semua aktifitasnya
- Maksimum 10 MHz - Clok generator : i8284
Konfigurasi Pin 8088 [3]
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE BHE/S7 MN/MX RD WR M/IO DT/R DEN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 31 30 29 28 27 26 25 40 39 38 37 36 35 34 33 32 8086 Reset•Menghentikan aktifitas mp saat itu
•masukan
•Aktif ‘high’
•Kondisi register di dalam mikroprosesor setelah reset:
Contents register FFFFH CS 0000H DS 0000H SS 0000H ES
Konfigurasi Pin 8088 [4]
JUN
- ITTELKOM
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET BHE/S7 MN/MX RD WR M/IO DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 READY: •Masukan •Aktif‘high’
•Digunakan untuk memasukkan waktu tunggu (wait state), untuk akses memori atau I/O yang
lambat.
Konfigurasi Pin 8088 [5]
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NMI INTR CLK GND VCC AD15 A16/S3 A17/S4 A18/S5 A19/S6 HOLD HLDA ALE READY RESET BHE/S7 MN/MX RD WR M/IO DT/R DEN INTA TEST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 30 29 28 27 26 25 24 23 22 21 40 39 38 37 36 35 34 33 32 8086 Mode Min Logic 1 Mode Max Logic 0 0 GT / RQ 1 GT / RQ LOCK S2 S1 0 S QS0 QS1* Pin-pin diatas digunakan untuk sinyal kontrol memori dan I/O
Konfigurasi Pin 8088 [6]
Fungsi pin 24 s/d 31 dari 8088 dan 8086 berubah sesuai mode yang digunakan, max atau min
JUN
Bus Timing [1]
Writing:
Dump address on address bus.
Dump data on data bus.
Issue a write (WR) and set M/IO to 1.
Bus Timing [2]
Reading:
Dump address on address bus.
Issue a read (RD) and set M/IO to 1.
Wait for memory access cycle.
JUN
Bus Timing [3]
Bus Timing [4]
During T1:
The address is placed on the Address/Data bus.
Control signals M/IO, ALE and DT/R specify memory or I/O, latch the address onto the address bus and set the direction of data transfer on data bus.
During T2:
8086 issues the RD or WR signal, DEN, and, for a write, the data. DEN enables the memory or I/O device to receive the data for writes and the 8086 to receive the data for reads.
During T3:
This cycle is provided to allow memory to access data.
READY is sampled at the end of T2.
If low, T3 becomes a wait state. Otherwise, the data bus is sampled at the end of T3.
During T4:
All bus signals are deactivated, in preparation for next bus cycle.
Data is sampled for reads, writes occur for writes.
JUN
ES CS SS DS 4 3 2 1 CONTROL SYSTEM AH AL BH BL CH CL DH DL SP BP SI DI OPERAND FLAGS C-BUS IP ALU INSTRUCTION STREAM BYTE QUEUE A- BUS BIU EU
Diagram Internal intel 8088
Fungsi BIU (BUS Interface Unit)
Sebagai antarmuka (pengalamatan)
dengan peripheral di luar mikroprosesor.
Bertanggung jawab terhadap semua
operasi bus eksternal, seperti :
Instruction fetch
Operasi baca-tulis memori atau I/O
Antrian instruksi dan perhitungan alamat (PA)
JUN
Fungsi EU (Execution Unit)
Bertanggung jawab terhadap decoding dan
executing instruksi
Mengambil instruksi dari Queue
Transfer data dari dan ke general purpose
Registers
Check & update flag .
Perhitungan alamat operand (EA)
Memberi perintah ke BIU untuk operasi memori
atau I/O
Register 8088/8086 [1]
JUN
Nama Register Bit Kategori AX,BX,CX,DX 16 general AH,AL,BH,BL,CH,CL,DH,DL 8 SP,BP 16 pointer SI,DI 16 index CS,DS,SS,ES 16 segment IP 16 instruction FR 16 flag
Catatan : register general 16 bit tidak bisa digunakan bersamaan dengan register general 8 bit, contoh : mov ax,bltidak dilayani
Register 8088/8086 [2]
Register General Purpose [1]
EAX: Accumulator: Referenced as EAX, AX, AL or AH.
Used for mult, div, etc.
Used to hold an offset.
EBX: Base Index:
Used to hold the offset of a data pointer.
ECX: Count:
Used to hold the count for some instructions, REP and
LOOP.
JUN
Register General Purpose [2]
EDX: Data:
Used to hold a portion of the result for mult, of the operand for div.
Used to hold the offset of a data pointer.
EBP: Base Pointer:
Holds the base pointer for memory data transfers.
EDI: Destination Index:
Holds the base destination pointer for string
instructions.
ESI: Source Index:
Holds the base source pointer for string instructions.
Register Special Purpose
EIP: Instruction Pointer:
Points to the next instruction in a code segment.
16-bits (IP) in real mode and 32-bits in protected mode.
ESP: Stack Pointer:
Used by the stack, call and return instructions.
EFLAGS:
Store the state of various conditions in the
microprocessor
JUN
Register Flag [1]
5 flag bit yang paling kanan berubah
sesudah instruksi operasi aritmatika
dan operasi logika sedangkan instruksi
operasi transfer data dan kontrol tidak
merubah register flag
Register Flag [2]
C (Carry):
Holds the carry out after addition or the borrow after subtraction.
Also indicates error conditions.
P (Parity):
0 for odd number of bits and 1 for even.
Obsolete feature of the 80x86.
A (Auxiliary Carry):
Highly specialized flag used by DAA and DAS
JUN
Register Flag [3]
Z (Zero):
1 if the result of an arithmetic or logic instruction is 0.
S (Sign):
1 if the sign of the result of an arith. or logic instruction is negative.
T (Trap):
Trap enable. The microprocessor interrupts the flow of instructions on conditions
indicated by the debug and control registers.
Register Flag [4]
I (Interrupt):
Controls the operation of the INTR (Interrupt request) pin. If 1, interrupts
are enabled. Set by STI and CLI instructions.
D (Direction):
Selects with increment or decrement mode for the DI and/or SI registers during
string instructions. If 1, registers are automatically decremented. Set by
STD and CLD instructions.
O (Overflow):
Set for addition and subtraction instructions.
JUN
Register Segment [1]
CS (Code Segment):
In real mode, this specifies the start of a 64KB
memory segment.
In protected mode, it selects a descriptor.
The code segment is limited to 64KB in the
8086-80286 and 4 GB in the 386
and above.
Register Segment [2]
DS (Data Segment):
Similar to the CS except this segment holds data.
ES (Extra Segment):
Data segment used by some string instructions to hold destination data.
SS (Stack Segment):
Similar to the CS except this segment holds the stack.
ESP and EBP hold offsets into this segment. FS and GS: 80386 and up.
JUN
Akses Memori
Sebelum 8088, uP mepunyai memori
sekitar 64 kB
Digunakan untuk penyimpan : os,
program aplikasi dan data
Peta Alamat Memori & I/O i8088
External Memory Address Space Code segment 64 k byte Data Segment 64 K Byte Stack segment 64 k Byte Extra Segment 64 k Byte IP SP BP SI DI CS DS SS ES AH AL BH CH DH BL CL DL Input / output Address space 00000 FFFFF 0000 FFFF Limit PC 9FFFF
JUN
- ITTELKOM
Peta Alamat I/O i8088/86
Peta Memori [1]
FFFFF Operating System Program Aplikasi Program Data 00200?
JUN
- ITTELKOM
Peta Memori [2] - App. 48 kB
Aplikasi : 48 kB
Dimisalkan pembagian besar memori aplikasi
untuk data dan program adalah sebagai
berikut:
• 10 kB <= data • 38 kB <= program
Besar memori untuk bagian data biasanya
lebih kecil dibandingkan bagian program
Tentukan alamat memori program dan data
dengan tanpa segmentasi atau menggunakan
segmentasi
Peta Memori [3]- App. 48 kB
Tanpa segment:
Alamat Program
Alamat awal program 200h
Alamat akhir program 99FFh
Alamat Data
Alamat awal data 9A00h
Alamat akhir data C1FFh
Contoh:
Ambil data ke-100 acc
mov acc,[9A64]
Dengan segmen
Alamat Program
Alamat awal program 0000h
di Code Segment
Alamat akhir 97FFh di Code
Segment
Alamat Data
Alamat awal data 0000h di
Data Segment
Alamat akhir data 27FFh
Contoh :
Ambil data ke-100 acc
mov acc,[0064]
JUN
Peta Memori [4] - Segmentasi
Segmentasi
Membagi memori menjadi blok-blok 64 kB
secara dinamis
Dipisahkan blok memori menjadi blok fungsi
• 64 kB untuk program Code Segment
• 64 kB untuk data Data Segment • 64 kB untuk stack Stack Segment
• 64 kB untuk tambahan data (option) Extra Segment 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB 64 KB DS SS CS ES CS DS SS ES
Peta Memori [5]-statis/dinamis
JUN
Peta Memori [6]-MultiSegment
Karena tersedia lebih dari 4 segment,
maka bisa dibuat lebih dari 1
kelompok segment
multi tasking
Pindah program (task) hanya mengubah
segment
Setiap program bisa dimulai dari alamat 0000
Program1 0000 Program2 0000 Program3 0000
Peta Memori [7]-Contoh Dinamis
FFFFF DS 10100 DS =1000 0100 DS 0700 20700 DS = 2000 DS 0064 2070FDS = XXXX CS CS CS
JUN
- ITTELKOM
Segmen untuk Program
Format : CS : IP
physical address A19-A0=2E5F3 IP=95F3
CS=2500 0
Adder
Geser kiri CS satu digit
Segmen untuk Data
Format : DS : EA (Effective Address)
physical address A19-A0=2E5F3 EA=95F3
DS=2500 0
Adder
Geser kiri DS satu digit
Perhitungan alamat fisik [1]
Segmen untuk Stack
Format : SS : SP
physical address A19-A0=2E5F3 SP=95F3
SS=2500 0
Adder
Geser kiri SS satu digit
Perhitungan alamat fisik [2]
JUN
H/W Segment
Program IP offset CS segment
Data
Offset sesuai mode pengalamatannya DS segment Stack SP offset SS segment ES CS SS DS 4 3 2 1 CONTROL SYSTEM AH AL BH BL CH CL DH DL SP BP SI DI OPERAND FLAGS C-BUS IP ALU INSTRUCTION STREAM BYTE QUEUE A- BUS BIU EU
Perhitungan alamat fisik [3]
H/W Alamat Alamat program IP offset CS segment Alamat Fisik: IP + CS(digeser) ES CS SS DS 4 3 2 1 CONTROL SYSTEM AH AL BH BL CH CL DH DL SP BP SI DI OPERAND FLAGS C-BUS IP ALU INSTRUCTION STREAM BYTE QUEUE A- BUS BIU EU
Perhitungan alamat fisik [4]
JUN
Perhitungan alamat fisik [5]
Contoh:
Jika CS=24F6H dan IP=634AH, Tentukan:
a) The logical address, b) The offset address
c) The physical address, d) The lower range of the code segment
e) The upper range of the code segment
Solusi
a) The logical address/ Alamat Logika ; 24F6:634A
b) The offset address/ Alamat Offtset ; 634A
c) The Physical address/ Alamat fisik ; 24F60+634A= 2B2AA
d) The lower range of the code segment: 24F6:0000 =>
24F60+0000 =24F60
e) The upper range of the code segment: 24F6:FFFF =>
24F60+FFFF=34F5F
Perhitungan alamat fisik [6]
Ciri Alamat Segment:
Tidak bisa diletakkan di alamat awal selain xxxx0
Alamat segmen terakhir pasti F000
Contoh : CS= F100 tidak boleh
» Min CS:IP F100:0000 alamat fisik F1000
» Maks CS:IP F100:FFFF alamat fisik 100FFF diluar batas maksimum FFFFF
JUN
PUSH DX PUSH DI PUSH AX START SS:1236 24 24 24 SS:1235 B6 B6 B6 SS:1234 85 85 SS:1233 C2 C2 SS:1232 5F SS:1231 93 SS:1230
Instruksi PUSH
Asumsi : SS=5FFF SP=1236, AX=24B6,DI=85C2,DX=5F93 Perhatikan isi stack setiap dijalankan perintah sbb: PUSH AX PUSH DI PUSH DX (gunakan prinsip little endian ) SP=1234 SP=1232 SP=1230 POP BX POP DX POP AX START SS:1236 24 24 24 SS:1235 B6 B6 B6 SS:1234 85 85 SS:1233 C2 C2 SS:1232 5F SS:1231 93 SS:1230
Instruksi POP
Asumsi : SP=1230 Perhatikan isi stack setiap dijalankan perintah berikut :
POP AX POP DX POP BX (gunakan prinsip LIFO)
AX=5F93 DX=85C2 BX=24B6
JUN
Instruksi MOV [1]
MOV instruction:
MOV destination, source ; copy source operand to destination Example: (8-bit ) MOV CL,55H MOV DL,CL MOV BH,DL MOV AH,BH
Instruksi MOV [2]
Example: (16-bit) MOV CX,468FH MOV AX,CX MOV BX,AX MOV DX,BX MOV DI,AX MOV SI,DI MOV DS,SI MOV BP,DSJUN
- ITTELKOM
Instruksi MOV [3]
Examples (diperiksa Instruksi yang ilegal):
MOV BX,14AFH MOV SI,2345H MOV DI,2233H MOV CS,2A3FH MOV DS,CS MOV FR,BX MOV DS,14AFH
Instruksi ADD [1]
ADD instructionADDdestination, source ; add the source operand to destination Example 8 bit: MOV AL,24H MOV DL,11H ADD AL,DL MOV CH,24H MOV BL,11H ADD CH,BL MOV CH,24H ADD CH,11H
JUN
- ITTELKOM
Instruksi ADD [2]
Example 16bit: MOV AX,34EH MOV DX,6A5H ADD DX,AX MOV CX,34EH ADD CX,6A5HQ&A uP 8088 [1]
Q : IO atau Memori yang diakses oleh uP pada saat
pertama kali bootup (sesudah reset) ?
A : Memori
Q : Tahu dari mana yang diakses memori?
A : Register CS di isi FFFF
Q : Memangnya di peta I/O tidak ada segmen?
A : Tidak ada karena peta I/O hanya 64 kB
Q : Apa yang anda tahu tentang segmen? Ukuran? Jenis?
A : Ukuran segmen 64kB, Jenis 4 : Code, Data, Stack,
Extra
JUN
Q&A uP 8088 [2]
Q : kenapa 8088 dibagi menjadi BIU dan EU?
A : sesuai fungsi, yaitu BIU menghitung alamat, EU menghitung data
Q : apa bedanya ALU di BIU dengan ALU di EU? A : ALU di BIU menggabungkan 16 bit offset dengan
16 bit segmen menjadi 20 bit alamat fisik, sedangkan ALU di EU menghitung data 8/16 bit dengan data 8/16 bit menjadi 8/16/32 bit
LOGO
Thank You!
Please study this subject at home