beautypg.com

HP 15c User Manual

Page 103

background image

Section 9: Subroutines 103

MAIN PROGRAM

´ CLEAR M

(Not programmable.)

000-

001- ´ b 9

Start main program.

002- | R

Radians mode.

003- O 0

Stores x

2

in

R

0

.

004- ®

Brings x

1

into X; x

2

into Y.

005- O - 0

(x

2

- x

1

) in R

0

.

006- G .3

Transfer to subroutine ―.3‖ with x

1

.

Return from subroutine ―.3‖.

007-

- y

1

.

008- ®

Brings x

2

into X-register.

009- G .3

Transfer to subroutine with x

2

.

Return from subroutine ―.3‖.

010- +

y

2

- y

1

.

011- l ÷ 0

Recalls (x

2

– x

1

) from R

0

and

calculates (y

2

- y

1

)/(x

2

- x

1

).

012- | n

Program end (return to line 000).

SUBROUTINE

013- ´ b .3

Start subroutine .3.

014- | x

x

2

.

015- |

K

Recall x.

016- [

sin x.

017- -

x

2

– sin x, which equals y.

018- | n

Return to origin in main program.

Calculate the slope for the following values of x

1

and x

2

: 0.52, 1.25; -1, 1;

0.81, 0.98. Remember to use G 9 (rather than ´ 9) when addressing a
routine with a digit label.

Answers: 1.1507; -0.8415; 1.1652.