Md. Iftekharul Islam Sakib Lecturer Cse, Buet
Md. Iftekharul Islam Sakib Lecturer Cse, Buet
Md. Iftekharul Islam Sakib Lecturer Cse, Buet
8
In Port 1 8 8 ALU 2 Flag
8
Ready 0
8
Serial In
7 In Port 2 8 TEMP
PC 16
8 B
MAR 16 8 C
16
Memory
8
8 0
IR 8 Out Port 4 7
Serial Out
Ack
8
CON
Architecture (Like as SAP2)
PC A
SP B C
D E
F H L
Program Counter
16 bit address
Same as SAP-1
ALU and Flags
• ALU: Includes both arithmetic and logical operation
• 4 or more control bits for determining the operation
to be performed
1.Add Carry
2.Sub Borrow
Carry Flag Instructions
• STC
SeT Carry (CY =1)
• CMC CompleMent Carry
• CY =
ADD
ADD reg
reg = A, B, C, D, E, H, L
ADC
ADC ADD with Carry (CY).
SUB reg
reg = A, B, C, D, E, H, L
reg = A, B, C, D, E, H, L
Compare Instruction
CMP reg
reg = A, B, C, D, E, H, L
• Z flag effected after the operation
Arithmetic & Logic Immediate
ANI byte
ORI byte
XRI byte
SAP3
• JP (Jump if positive)
• JC ( Jump id Carry)
• JNC ( Jump if not Carry)
• JPE (Jump if Even Parity)
• JPO (Jump if Odd Parity)
Extended Register
• Register pairs 16 bits
• 3 pairs (BC, DE and HL)
Extended Instructions
• X for Extended instruction
LXI B, dble
LXI D, dble
LXI H, dble
HL M
Indirect Write
MOV M, reg
reg = A, B, C, D, E, H, L
M = memory address
HL M
Indirect Immediate Instructions
MVI M, byte
M = memory address
HL M
Other Instructions by HL pointer
• ADD M
• ADC M
• SUB M
• SBB M
• INC M
• DEC M
• ANA M
• ORA M
• XRA M
• CMP M
STACK Instructions
• Begin Address: 20FFh
• End Address: 20E0h
• PUSH, POP
• Before call we need to store registers & Flags
PUSH B (BC)
PUSH D (DC)
PUSH H (HL)
PUSH PSW
PUSH operation
• When PUSH instruction is executed, the
following things happen:
– The SP is decremented to get a new value of SP-1
– The high byte in the specified register pair is
stored in M[SP-1]
– The SP is decremented again to get SP-2
– The low byte in the specified register pair is
stored in M[SP-2]
POP Operation
• When POP is executed, the following happens:
– REVESE of PUSH !!
Call & RET Instructions
CALL
Subroutine ????