APPENDIX

BENCHMARK: l6-Bit Multiply

PROCESSOR: Motorola 6809

;REGISTER

USAGE:

 

D -

ACCUMULATOR

X -

OPERAND

POINTER

Y -

OPERAND

POINTER

U -

PRODUCT

POINTER

Bytes

Cycles

 

 

 

 

 

 

 

 

 

 

3

3

 

LDX

 

#M

 

;Pointer to multiplicand A(MS Byte)

4

5

 

LDY

 

#BB

 

;Pointer to multiplicand B(MS Byte)

3

3

 

LDU

 

#MO

 

;Pointer

to product

~

6

 

CLR

 

O,U

 

;CLR

MO

 

 

 

~

6

 

CLR

 

1,U

 

;CLR

Ml

 

 

 

~

5

 

LDA

 

1,X

 

;Read

 

LS

byte

of

A (AL)

~

5

 

LDB

 

1, Y

;Read

 

LS

byte

of

B (BL)

1

11

 

MUL

 

 

 

;AL*BL

 

 

 

 

~

6

 

STD

 

2,U

 

;Store

in

M3:M2

 

~

4

 

LDA

 

O,X

 

;Read MS byte of A (AH)

~

5

 

LDB

 

1,Y

 

;Read LS byte of B (BL)

1

11

 

MUL

 

1,U

 

;AH*BL

 

 

 

 

~

7

 

ADDD

 

;AH*BL + MS byte from AL*BL

~

6

 

STD

 

1,U

 

;Store

in

M2:Ml

 

~

3

 

BCC

 

ABl

 

;Skip INC if no carry

~

6

 

INC

 

O,U

 

;Add

carry to

MO

 

~

5

ABl

LDA

 

1,X

 

;Read

 

LS

byte

of

A (AL)

~

4

 

LDB

 

O,Y

 

;Read LS byte of B (BH)

1

11

 

MUL

 

1,U

 

;AL*BH

 

 

 

 

~

7

 

ADDD

 

;AL*BH+ M2:Ml

 

 

2

6

 

STD

 

1,U

 

;Store

in

M~:Ml

 

~

3

 

BCC

 

AB2

 

;Skip INC if no carry

~

6

 

INC

 

O,U

 

;Add

carry to

MO

 

~

4 AB~

LDA

 

O,X

 

;Read

 

AH

 

 

 

~

4

 

LDB

 

O,Y

 

;Read

BH

 

 

 

1

11

 

MUL

 

O,U

 

;AH*BH

+Ml + carries

2

7

 

ADDD

 

;AH*BH

~

6

 

STD

 

O,U

 

;Store

in

Ml :MO

 

 

 

 

56

bytes

of

code

 

 

 

 

 

 

 

 

 

28

lines

of

code

 

 

 

 

 

 

30

AFN 01532A

Page 299
Image 299
Intel 210200-002 manual Addd