APPENDIX

BENCHMARK: Bubble Sort

PROCESSOR: iAPX 88

; REG ISTER USAGE:

 

AX

ACCUMULATOR

BL

EXCHANGE

FLAG (OFF=TRUE, 0= FALSE)

CX

COUNT OF

ELEMENTS

OX

- ACCUMULATOR

SI

INDEX OF

ARRAY

Bytes

Cycles

 

 

 

 

 

 

 

2

4

;

MOv

 

BL,OFFH

;EXCHANGE=TRUE

 

 

4

 

 

 

 

 

 

 

3

A1:

CMP

 

BL,OFFH

;E XCHANGE =TR UE

?

2

4/16

 

JNE

 

A4

 

;

NO, FINISHED

2

3

 

XOR

 

BL,BL

;EXCHANGE=FALSE

4

14

 

MOv

 

CX,COUNT

;CX=COUNT=l

 

1

2

 

DEC

 

CX

 

 

 

 

2

3

;

XOR

 

SI,SI

;SI,=O

 

3

17

 

 

 

 

 

 

 

A2:

MOv

 

AX,ARRAY[SI]

;ARRAY(I)

 

3

18

 

CMP

 

AX,ARRAY[SI+2]

;

ARRAY(I+l)

?

2

4/16

 

JLE

 

A3

 

;NO

 

 

3

26

 

XCHG

ARRAY[SI+2] ,AX

;EXCHANGE ELEMENTS

3

18

 

MOv

 

ARRAY[SI],AX

 

 

 

2

4

;

MOv

 

BL,OFFH

;EXCHANGE=TRUE

 

1

2

 

 

 

 

 

 

 

A3:

INC

 

SI

 

;SI=SI+2

 

1

2

 

INC

 

SI

 

;DEC CX &,LOOP IF CX=O

2

5/17

 

LOOP

A2

 

2

15

A4:

JMP

 

Al

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

38

bytes

of

code

 

 

 

 

 

 

17

lines

of

code

 

 

 

18

AFN·01664A

Page 287
Image 287
Intel 210200-002 manual Accumulator