Beruflich Dokumente
Kultur Dokumente
& Programming
PART 1
INR R
• Example of JMP
• Symbol HERE is
:
address where the
MOV A, B
instruction INR A is
JMP HERE
stored in memory.
LDA 2500H • Execution of JMP
DCR B HERE, skips the
HERE: INR A execution of LDA &
MOV B, A DCR in program.
:
JMP (Contd.)
• Example of JZ
• DCR A sets ZF=1.
MVI A, 01
• So JZ HERE makes a
DCR A
jump.
JZ HERE • Execution of JZ
STAX D HERE, skips the
DCR B execution of STAX &
HERE: INR D DCR in program.
MOV C, A
:
Conditional JMPs (Contd.)
• Example of JZ
• INR A, sets ZF=0.
MVI A, 01
• So, JZ HERE does
INR A
not make a jump.
JZ HERE • Hence, STAX D and
STAX D DCR B is executed
DCR B next and so on.
HERE: INR D
MOV C, A
:
Conditional JMPs (Contd.)
All Data Y
STOP
N Cleared?
Program P6 (Contd.)
All Data Y
STOP
N Cleared?
Alternate Program P6 (Contd.)
All Data Y
STOP
N Copied?
Program P7 (Contd.)
• SUB R
– A←A-R
– A ← A + 2’s Comp (R)
– Affects All the conditional flags.
• SBB R
– A ← A - R – CY
– A ← A + 2’s Comp (R) + 2’s Comp(CY)
– Affects All the conditional flags.
• SUB M
– A ← A – ((HL))
– Affects All the conditional flags.
Subtractions (Contd.)
• SBB M
– A ← A – ((HL)) - CY
– Affects All the conditional flags.
• SUI DATA8
– A ← A – DATA8
– Affects All the conditional flags.
• SBI DATA8
– A ← A – DATA8 - CY
– Affects All the conditional flags.
A Simple Program (P9)
HLT ; Stop
Alternate Programs (P9)
LDA 2500H
HLT ; Stop
Alternate Programs (P9) (Contd.)
HLT ; Stop
Program (P10)
Write an 8085 ALP to add two 8-bit numbers and result may be
16-bit. Assuming data are stored in memory at locations 2500H
and 2501H.