BENCHMARK:
Bubble
Sort
PROCESSOR:
iAPX
88
APPENDIX
;
REG
ISTER
USAGE:
AX
ACCUMULATOR
BL
EXCHANGE
FLAG
(OFF=TRUE,
0=
FALSE)
Bytes Cycles
2 4
;
3
4
A 1 :
2
4/16
2
3
4
14
1 2
2
3
;
3
17
A2:
3
18
2
4/16
3
26
3
18
2 4
;
1
2
A3:
1
2
2
5/17
2
15
A4:
CX
COUNT
OF
ELEMENTS
OX
-
ACCUMULATOR
SI
INDEX
OF
ARRAY
MOv
BL,OFFH
CMP
BL,OFFH
JNE
A4
XOR
BL,BL
MOv
CX,COUNT
DEC
CX
XOR
SI,SI
MOv
AX,ARRAY[SI]
CMP
AX,ARRAY[SI+2]
JLE
A3
XCHG
ARRAY[SI+2]
,AX
MOv
ARRAY[SI],AX
MOv
BL,OFFH
INC
SI
INC
SI
LOOP
A2
JMP
Al
38
bytes
of
code
17
lines
of
code
18
;EXCHANGE=TRUE
;E
XCHANGE
=TR
UE
?
;
NO,
FINISHED
;EXCHANGE=FALSE
;CX=COUNT=l
;SI,=O
;ARRAY(I)
;
ARRAY(I+l)
?
;NO
;EXCHANGE
ELEMENTS
;EXCHANGE=TRUE
;SI=SI+2
;DEC
CX
&
,LOOP
IF
CX=O
AFN·01664A