Assignment_3_Solution.pdf

MOV
RAR
MOV
RAR
MOV
RAR
MOV
RAR
MOV
RAR
END
A,C
; store carry flag ( LSB of C store in carry without changing C)
A,B
; B rotate right through carry
B,A
B
A,C
; C rotate right trough carry
C,A ;
C
SEARCH: PUSH
PUSH
PUSH
PUSH
LXI
MOV
LXI
LXI
L1:
MOV
CMP
JZ
MOV
SUB
JNZ
MOV
SUB
JNZ
JMP
L2:
INX
JMP
FOUND: SHLD
NFOUND: POP
POP
POP
POP
RET
PSW
B
D
H; storing data
H,KEY; KEY the key char address
B,M
H,START; START the first address
D,END; END the end address
A,M
B
FOUND
A,D
L
L2
A,E
H
L2
NOTFOUND
H
L1
FADD; store the found char address
H
D
B
PSW
-1
-2
-3
LXI B, 0000H
MVI E, FFH
LXI B, 927BH
LOOP DCX B
MOV A, C
ORA B
JNZ LOOP
Æ 10 T-State
Æ 7 T-State
Æ 10 T-State
Æ 6 T-State
Æ 4 T-State
Æ 4 T-State
Æ 10 T-State
927BH = 37499 Decimal
Freq = 3 MHZ
Td = { (10 + 7 +10) + (37499 * (6 + 4 + 4 + 10) – 3) }*1/(3*10^6) = 9*105*1/3*106
|
|
|
|
|
|
‫زﻣﺎن اﺟﺮاﯼ ﺧﺎرج ﺣﻠﻘﻪ‬
|
|
‫ﺗﻌﺪاد اﺟﺮاهﺎﯼ ﺣﻠﻘﻪ‬
|
‫زﻣﺎن ﻳﮏ ﺑﺎر اﺟﺮا ﺷﺪن ﺣﻠﻘﻪ‬
Î Td = 0.3 sec
‫ ﺗﺎ‬10 ‫ ﺑﻪ ﺟﺎﯼ‬،‫ در ﺁﺧﺮﻳﻦ ﺑﺎر اﺟﺮاﻳﺶ ﻏﻠﻂ ﻣﯽ ﺷﻮد‬JNZ ‫ ﭼﻮن دﺳﺘﻮر‬،‫* در ﻣﺤﺎﺳﺒﻪ ﯼ زﻣﺎن اﺟﺮاﯼ ﮐﻞ ﺣﻠﻘﻪ‬
.‫ ﺗﺎ ﮐﻢ ﮐﺮدﻩ اﻳﻢ‬3 ‫ ﺑﻪ هﻤﻴﻦ دﻟﻴﻞ‬.‫ زﻣﺎن ﻣﯽ ﺑﺮد‬T-State ‫ ﺗﺎ‬7 ، T-State
.‫ ﺛﺎﻧﻴﻪ ﻣﯽ ﺑﺎﺷﺪ‬1 ‫ﺗﺎﺧﻴﺮ اﺟﺮاﯼ ﮐﺪ زﻳﺮ دﻗﻴﻘﺎ ﺑﺮاﺑﺮ‬
LOOP
LXI B, 0000H
NOP
LXI B, 0000H
MVI E, FFH
LXI B, 1000H
LXI B, F423H
DCX B
MOV A, C
ORA B
NOP
NOP
NOP
NOP
NOP
NOP
JNZ LOOP
10 T-State
4 T-State
10 T-State
7 T-State
10 T-States
10 T-States
6 T-States
4 T-States
4 T-States
4 T-States
4 T-States
4 T-States
4 T-States
4 T-States
4 T-States
10 T-States
-4
PRICE: PUSH
PUSH
PUSH
PUSH
IN
LXI
MOV
MVI
DAD
MOV
LHLD
DAD
SHLD
POP
POP
POP
POP
RET
PSW
B
D
H; storing data
PORT; port is the input address in I/O mapped I/O method
H,TABLE ;table is the price table address
C,A
B,00H
B
C,M; the price of the input is in C
accum; accum is the price sum accumulator address
B; the price is added to accumulator of prices
accum; the new sum is stored
H
D
B
PSW