Figure 2-2. Sample Program Listing - HP 64700 Series User Manual

64000-ux case solutions for microprocessors, softkey interface
Hide thumbs Also See for 64700 Series:
Table of Contents

Advertisement

Cmdline - as68k -Lh anly.s
Line Address
1
2
3
4
00000000 2E7C 0000 01FC
5
6
7
8
9
10
11
00000006 2241
12
00000008 2200
13
14
15
16
0000000A 6100 0044
17
18
19
20
21
22
0000000E 0801 0001
23
00000012 6700 0006
24
00000016 6000 000E
25
0000001A 0801 0000
26
0000001E 6700 0012
27
00000022 6000 0014
28
00000026 0801 0000
29
0000002A 6700 0012
30
0000002E 6000 0014
31
32
33
34
35
36
00000032 6100 0016
37
00000036 60CE
38
00000038 6100 0010
39
0000003C 60C8
40
0000003E 6100 000A
41
00000042 60C2
42
00000044 6100 0004
43
00000048 60BC
44
45
46
47
48
49
0000004A 1340 0000
50
0000004E 4E75
51
52
53
54
55
56
00000050 2039 0000 0100
2-4 Getting Started
R START
*********************************************
* The next two instructions move the second
* previous random number into A1 (offset to
* RESULTS area, and the previous random
* number into D1.
*********************************************
AGAIN
*********************************************
* RAND returns random number in D0.
*********************************************
*********************************************
* The following instructions determine which
* caller calls WRITE_NUMBER (depends on last
* two bits of the previous random number).
*********************************************
ZERO_ONE
TWO_THREE
*********************************************
* The WRITE_NUMBER routine is called from
* four different places.
* repeated after the subroutine return.
*********************************************
CALLER_0
CALLER_1
CALLER_2
CALLER_3
*********************************************
* The WRITE_NUMBER routine writes the random
* number to the RESULTS area. The second
* previous number is the offset in this area.
*********************************************
R WRITE_NUMBER
*********************************************
* The RAND routine generates a pseudo-random
* number from 0-0FFH, and leaves the result
* in D0.
*********************************************
R RAND

Figure 2-2. Sample Program Listing

XDEF
START,AGAIN
XDEF
RESULTS,RAND_SEED
SECT
PROG,,C
MOVE.L
#STACK,A7
MOVE.L
D1,A1
MOVE.L
D0,D1
BSR
RAND
BTST
#1,D1
BEQ
ZERO_ONE
BRA
TWO_THREE
BTST
#0,D1
BEQ
CALLER_0
BRA
CALLER_1
BTST
#0,D1
BEQ
CALLER_2
BRA
CALLER_3
The program is
BSR
WRITE_NUMBER
BRA
AGAIN
BSR
WRITE_NUMBER
BRA
AGAIN
BSR
WRITE_NUMBER
BRA
AGAIN
BSR
WRITE_NUMBER
BRA
AGAIN
MOVE.B D0,RESULTS(A1)
RTS
MOVE.L RAND_SEED,D0

Advertisement

Table of Contents
loading

Table of Contents